From 0406000351c63935a218273db6d04fa1b8648755 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Sat, 5 Dec 2009 18:45:26 -0800 Subject: [PATCH] More CMake build work, added Lua support. --- cmake_modules/ConkyBuildOptions.cmake | 1 + cmake_modules/ConkyPlatformChecks.cmake | 8 +++ config.h.in | 6 ++ src/CMakeLists.txt | 76 +++++++++++++++++++------ src/llua.h | 2 +- 5 files changed, 75 insertions(+), 18 deletions(-) diff --git a/cmake_modules/ConkyBuildOptions.cmake b/cmake_modules/ConkyBuildOptions.cmake index 57bc1a50..0161c099 100644 --- a/cmake_modules/ConkyBuildOptions.cmake +++ b/cmake_modules/ConkyBuildOptions.cmake @@ -22,3 +22,4 @@ if(BUILD_X11) option(BUILD_XFT "Build Xft (freetype fonts) support" true) endif(BUILD_X11) +option(BUILD_LUA "Build Lua support" true) diff --git a/cmake_modules/ConkyPlatformChecks.cmake b/cmake_modules/ConkyPlatformChecks.cmake index e9db2aa9..d6f5273e 100644 --- a/cmake_modules/ConkyPlatformChecks.cmake +++ b/cmake_modules/ConkyPlatformChecks.cmake @@ -1,7 +1,10 @@ # vim: ts=4 sw=4 noet ai cindent syntax=cmake +include(FindPkgConfig) + check_include_files(sys/statfs.h HAVE_SYS_STATFS_H) check_include_files(sys/param.h HAVE_SYS_PARAM_H) +check_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H) # check for Xlib if(BUILD_X11) @@ -52,3 +55,8 @@ if(BUILD_X11) endif(BUILD_X11) +if(BUILD_LUA) + pkg_search_module(LUA REQUIRED lua>=5.1 lua-5.1>=5.1 lua5.1>=5.1) + set(conky_libs ${conky_libs} ${LUA_LIBRARIES}) + set(conky_includes ${conky_includes} ${LUA_INCLUDE_DIRS}) +endif(BUILD_LUA) diff --git a/config.h.in b/config.h.in index 2c5ab341..df7bc199 100644 --- a/config.h.in +++ b/config.h.in @@ -13,6 +13,7 @@ #cmakedefine HAVE_SYS_STATFS_H 1 #cmakedefine HAVE_SYS_PARAM_H 1 +#cmakedefine HAVE_SYS_INOTIFY_H 1 #cmakedefine BUILD_X11 1 #ifdef BUILD_X11 @@ -35,3 +36,8 @@ #ifdef BUILD_XDBE #define HAVE_XDBE #endif /* BUILD_XDBE */ + +#cmakedefine BUILD_LUA 1 +#ifdef BUILD_LUA +#define HAVE_LUA +#endif /* BUILD_LUA */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1473eb9d..9916ed46 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,79 +7,121 @@ set(conky_sources colours.c combine.c common.c conky.c core.c diskio.c mboxscan.c read_tcp.c scroll.c specials.c tailhead.c temphelper.c text_object.c timeinfo.c top.c algebra.c proc.c user.c) +# Platform specific sources if(CMAKE_SYSTEM_NAME MATCHES "Linux") - set(conky_sources ${conky_sources} linux.c i8k.c sony.c users.c) + set(linux linux.c linux.h users.c users.h sony.c sony.h i8k.c i8k.h) + set(optional_sources ${optional_sources} ${linux}) endif(CMAKE_SYSTEM_NAME MATCHES "Linux") -# optional +if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + set(freebsd freebsd.c freebsd.h bsdapm.c bsdapm.h) + set(optional_sources ${optional_sources} ${freebsd}) +endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + +if(CMAKE_SYSTEM_NAME MATCHES "Solaris") + set(solaris solaris.c) + set(optional_sources ${optional_sources} ${solaris}) +endif(CMAKE_SYSTEM_NAME MATCHES "Solaris") + +if(CMAKE_SYSTEM_NAME MATCHES "NetBSD") + set(netbsd netbsd.c netbsd.h) + set(optional_sources ${optional_sources} ${netbsd}) +endif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") + +if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") + set(openbsd openbsd.c openbsd.h bsdapm.c bsdapm.h) + set(optional_sources ${optional_sources} ${openbsd}) +endif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") + + +# Optional sources if(BUILD_AUDACIOUS) + set(audacious audacious.c audacious.h) set(optional_sources ${optional_sources} ${audacious}) endif(BUILD_AUDACIOUS) + if(BUILD_BMPX) + set(bmpx bmpx.c bmpx.h) set(optional_sources ${optional_sources} ${bmpx}) endif(BUILD_BMPX) + if(BUILD_IBM) + set(ibm ibm.c ibm.h smapi.c smapi.h) set(optional_sources ${optional_sources} ${ibm}) endif(BUILD_IBM) + if(BUILD_MPD) + set(mpd mpd.c mpd.h libmpdclient.c libmpdclient.h) set(optional_sources ${optional_sources} ${mpd}) endif(BUILD_MPD) + if(BUILD_MOC) + set(moc moc.c moc.h) set(optional_sources ${optional_sources} ${moc}) endif(BUILD_MOC) + if(BUILD_XMMS2) + set(xmms2 xmms2.c xmms2.h) set(optional_sources ${optional_sources} ${xmms2}) endif(BUILD_XMMS2) -if(BUILD_LINUX) - set(optional_sources ${optional_sources} ${linux}) -endif(BUILD_LINUX) -#if(BUILD_SOLARIS) -#set(optional_sources ${optional_sources} ${solaris}) -#endif -if(BUILD_FREEBSD) - set(optional_sources ${optional_sources} ${freebsd}) -endif(BUILD_FREEBSD) -#if(BUILD_NETBSD) -#set(optional_sources ${optional_sources} ${netbsd}) -#endif -if(BUILD_OPENBSD) - set(optional_sources ${optional_sources} ${openbsd}) -endif(BUILD_OPENBSD) + if(BUILD_PORT_MONITORS) + set(port_monitors libtcp-portmon.c libtcp-portmon.h tcp-portmon.c tcp-portmon.h) set(optional_sources ${optional_sources} ${port_monitors}) endif(BUILD_PORT_MONITORS) + if(BUILD_X11) set(x11 x11.c x11.h fonts.c fonts.h) set(optional_sources ${optional_sources} ${x11}) endif(BUILD_X11) + if(BUILD_HDDTEMP) + set(hddtemp hddtemp.c hddtemp.h) set(optional_sources ${optional_sources} ${hddtemp}) endif(BUILD_HDDTEMP) + if(BUILD_EVE) + set(eve eve.c eve.h) set(optional_sources ${optional_sources} ${eve}) endif(BUILD_EVE) + if(BUILD_CURL) + set(ccurl_thread ccurl_thread.c ccurl_thread.h) set(optional_sources ${optional_sources} ${ccurl_thread}) endif(BUILD_CURL) + if(BUILD_RSS) + set(rss rss.c rss.h prss.c prss.h) set(optional_sources ${optional_sources} ${rss}) endif(BUILD_RSS) + if(BUILD_WEATHER) + set(weather weather.c weather.h) set(optional_sources ${optional_sources} ${weather}) endif(BUILD_WEATHER) + if(BUILD_LUA) + set(lua llua.c llua.h) set(optional_sources ${optional_sources} ${lua}) endif(BUILD_LUA) + if(BUILD_NVIDIA) + set(nvidia nvidia.c nvidia.h) set(optional_sources ${optional_sources} ${nvidia}) endif(BUILD_NVIDIA) + if(BUILD_IMLIB2) + set(imlib2 imlib2.c imlib2.h) set(optional_sources ${optional_sources} ${imlib2}) endif(BUILD_IMLIB2) + if(BUILD_APCUPSD) + set(apcupsd apcupsd.c apcupsd.h) set(optional_sources ${optional_sources} ${apcupsd}) endif(BUILD_APCUPSD) + if(BUILD_ICONV) + set(iconv iconv_tools.c iconv_tools.h) set(optional_sources ${optional_sources} ${iconv}) endif(BUILD_ICONV) diff --git a/src/llua.h b/src/llua.h index c4e16ad8..bb763c7c 100644 --- a/src/llua.h +++ b/src/llua.h @@ -28,7 +28,7 @@ #include #include -#include "config.h" +#include #ifdef X11 #include "x11.h"