1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-06-02 07:20:47 +00:00

More work on CMake build system (see README.cmake for instructions).

This commit is contained in:
Brenden Matthews 2009-12-05 12:00:10 -08:00
parent 3764c883c7
commit 07cb6efdaf
7 changed files with 146 additions and 68 deletions

View File

@ -30,9 +30,23 @@ set(COPYRIGHT "Copyright Brenden Matthews, et al, 2005-2009")
# This is the directory for our custom CMake modules.
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules)
include(FindThreads)
find_package(Threads)
set(conky_libs ${CMAKE_THREAD_LIBS_INIT} rt c m)
set(conky_includes ${CMAKE_BINARY_DIR})
# Include CPack module for installation
include(ConkyCPackSetup)
# Handle build options
include(ConkyBuildOptions)
# Do platform checks
include(ConkyPlatformChecks)
# setup our configuration header
configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
add_subdirectory(src)
add_subdirectory(lua)

17
README.cmake Normal file
View File

@ -0,0 +1,17 @@
Hello, there.
Using CMake to build Conky is pretty easy, and here is how I do it:
1. From the top level source dir, create a build working dir, and cd into it
$ mkdir build
$ cd build
2. Run the cmake configuration process
$ cmake ../ # pass the path to the sources to cmake
OR
$ ccmake ../ # you can also use the fance curses interface, or try cmake-gui
3. Compile as usual, and enjoy the out-of-source goodness
$ make
# make install # if you want
NOTE: I haven't actually finished the CMake build system yet, because I'm lazy. I'll add all the different options eventually though.

20
config.h.in Normal file
View File

@ -0,0 +1,20 @@
#cmakedefine DEBUG
#define PACKAGE_NAME "@PROJECT_NAME@"
#define VERSION "@VERSION@"
#define SYSTEM_CONFIG_FILE "@SYSTEM_CONFIG_FILE@"
#define PACKAGE_LIBDIR "@PACKAGE_LIBRARY_DIR@"
#define DEFAULTNETDEV "@DEFAULTNETDEV@"
#define CONFIG_FILE "@CONFIG_FILE@"
#define MAX_SPECIALS_DEFAULT @MAX_SPECIALS_DEFAULT@
#define MAX_USER_TEXT_DEFAULT @MAX_USER_TEXT_DEFAULT@
#define DEFAULT_TEXT_BUFFER_SIZE @DEFAULT_TEXT_BUFFER_SIZE@
#define MAX_NET_INTERFACES @MAX_NET_INTERFACES@
#cmakedefine HAVE_SYS_STATFS_H 1
#cmakedefine HAVE_SYS_PARAM_H 1
#cmakedefine BUILD_X11 1
#ifdef BUILD_X11
#define X11
#endif /* BUILD_X11 */

View File

@ -1,64 +1,88 @@
# vim: ts=4 sw=4 noet ai cindent syntax=cmake
set(CONKY_SOURCES
algebra.c
apcupsd.c
audacious.c
bmpx.c
ccurl_thread.c
colours.c
combine.c
common.c
conf_cookie.c
conky.c
core.c
diskio.c
entropy.c
eve.c
exec.c
fonts.c
freebsd.c
fs.c
hddtemp.c
i8k.c
ibm.c
iconv_tools.c
imlib2.c
libmpdclient.c
libtcp-portmon.c
linux.c
llua.c
mail.c
mboxscan.c
mixer.c
moc.c
mpd.c
netbsd.c
net_stat.c
nvidia.c
openbsd.c
proc.c
prss.c
read_tcp.c
rss.c
scroll.c
smapi.c
solaris.c
sony.c
specials.c
tailhead.c
tcp-portmon.c
temphelper.c
template.c
text_object.c
timed_thread.c
timeinfo.c
top.c
user.c
users.c
weather.c
x11.c
xmms2.c
)
include_directories(${conky_includes})
add_executable(conky ${CONKY_SOURCES})
set(conky_sources colours.c combine.c common.c conky.c core.c diskio.c
entropy.c exec.c fs.c mail.c mixer.c net_stat.c template.c timed_thread.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)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(conky_sources ${conky_sources} linux.c i8k.c sony.c users.c)
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
# optional
if(BUILD_AUDACIOUS)
set(optional_sources ${optional_sources} ${audacious})
endif(BUILD_AUDACIOUS)
if(BUILD_BMPX)
set(optional_sources ${optional_sources} ${bmpx})
endif(BUILD_BMPX)
if(BUILD_IBM)
set(optional_sources ${optional_sources} ${ibm})
endif(BUILD_IBM)
if(BUILD_MPD)
set(optional_sources ${optional_sources} ${mpd})
endif(BUILD_MPD)
if(BUILD_MOC)
set(optional_sources ${optional_sources} ${moc})
endif(BUILD_MOC)
if(BUILD_XMMS2)
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(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(optional_sources ${optional_sources} ${hddtemp})
endif(BUILD_HDDTEMP)
if(BUILD_EVE)
set(optional_sources ${optional_sources} ${eve})
endif(BUILD_EVE)
if(BUILD_CURL)
set(optional_sources ${optional_sources} ${ccurl_thread})
endif(BUILD_CURL)
if(BUILD_RSS)
set(optional_sources ${optional_sources} ${rss})
endif(BUILD_RSS)
if(BUILD_WEATHER)
set(optional_sources ${optional_sources} ${weather})
endif(BUILD_WEATHER)
if(BUILD_LUA)
set(optional_sources ${optional_sources} ${lua})
endif(BUILD_LUA)
if(BUILD_NVIDIA)
set(optional_sources ${optional_sources} ${nvidia})
endif(BUILD_NVIDIA)
if(BUILD_IMLIB2)
set(optional_sources ${optional_sources} ${imlib2})
endif(BUILD_IMLIB2)
if(BUILD_APCUPSD)
set(optional_sources ${optional_sources} ${apcupsd})
endif(BUILD_APCUPSD)
if(BUILD_ICONV)
set(optional_sources ${optional_sources} ${iconv})
endif(BUILD_ICONV)
add_executable(conky ${conky_sources} ${optional_sources})
target_link_libraries(conky ${conky_libs})

View File

@ -35,6 +35,9 @@
#include "logging.h"
#include "specials.h"
#include <math.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif /* HAVE_SYS_PARAM_H */
/* maximum number of special things, e.g. fonts, offsets, aligns, etc. */
int max_specials = MAX_SPECIALS_DEFAULT;

View File

@ -34,7 +34,7 @@
#include <string.h>
#include <time.h>
#include <errno.h>
#include <logging.h>
#include "logging.h"
char print_times_in_seconds = 0;
@ -245,7 +245,7 @@ static void do_format_time(struct text_object *obj, char *p, unsigned int p_max_
}
}else{
currentchar--;
NORM_ERR("$format_time needs a digit behind 'S' to specify precision")
NORM_ERR("$format_time needs a digit behind 'S' to specify precision");
}
break;
case '\\':
@ -255,7 +255,7 @@ static void do_format_time(struct text_object *obj, char *p, unsigned int p_max_
output_length++;
break;
default:
NORM_ERR("$format_time doesn't have a special char '%c'", *currentchar)
NORM_ERR("$format_time doesn't have a special char '%c'", *currentchar);
}
} else if(*currentchar == '(') {
for(temp = currentchar + 1; *temp != 0 && *temp != ')'; temp++) {
@ -291,7 +291,7 @@ static void do_format_time(struct text_object *obj, char *p, unsigned int p_max_
if(output_length + strlen(temp) < p_max_size - 1) {
strcpy(p + output_length, temp);
output_length += strlen(temp);
} else NORM_ERR("The format string for $format_time is too long")
} else NORM_ERR("The format string for $format_time is too long");
free(temp);
}
currentchar++;
@ -299,10 +299,10 @@ static void do_format_time(struct text_object *obj, char *p, unsigned int p_max_
}
p[output_length] = 0;
} else {
NORM_ERR("$format_time needs a output-format starting with a \"-char as 2nd argument")
NORM_ERR("$format_time needs a output-format starting with a \"-char as 2nd argument");
}
} else {
NORM_ERR("$format_time didn't receive a time in seconds as first argument")
NORM_ERR("$format_time didn't receive a time in seconds as first argument");
}
}

View File

@ -28,7 +28,7 @@
*
*/
#include <logging.h>
#include "logging.h"
#include <pwd.h>
#include <grp.h>
#include <errno.h>