mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-02-03 20:48:31 +00:00
More CMake work.
This commit is contained in:
parent
b1cbc64f60
commit
11c76e4c0d
@ -4,44 +4,11 @@ cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
project(conky)
|
||||
|
||||
set(VERSION_MAJOR "2")
|
||||
set(VERSION_MINOR "0")
|
||||
set(VERSION_PATCH "0")
|
||||
|
||||
find_program(APP_GAWK gawk)
|
||||
find_program(APP_GIT git)
|
||||
find_program(APP_WC wc)
|
||||
find_program(APP_DATE date)
|
||||
find_program(APP_UNAME uname)
|
||||
|
||||
# The version numbers are simply derived from the date and number of commits
|
||||
# since start of month
|
||||
execute_process(COMMAND
|
||||
${APP_GIT} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git log
|
||||
--since=${VERSION_MAJOR}-${VERSION_MINOR}-01 --pretty=oneline COMMAND
|
||||
${APP_WC} -l COMMAND ${APP_GAWK} "{print $1}" RESULT_VARIABLE RETVAL
|
||||
OUTPUT_VARIABLE COMMIT_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
#BUILD_DATE=$(LANG=en_US LC_ALL=en_US LOCALE=en_US date)
|
||||
#BUILD_ARCH="$(uname -sr) ($(uname -m))"
|
||||
execute_process(COMMAND ${APP_DATE} RESULT_VARIABLE RETVAL OUTPUT_VARIABLE
|
||||
BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${APP_UNAME} -srm RESULT_VARIABLE RETVAL OUTPUT_VARIABLE
|
||||
BUILD_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}-r${COMMIT_COUNT}")
|
||||
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)
|
||||
# 'core' CMake stuff
|
||||
include(Conky)
|
||||
|
||||
# Handle build options
|
||||
include(ConkyBuildOptions)
|
||||
@ -49,10 +16,10 @@ include(ConkyBuildOptions)
|
||||
# Do platform checks
|
||||
include(ConkyPlatformChecks)
|
||||
|
||||
# setup our configuration headers
|
||||
configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/build.h.in ${CMAKE_BINARY_DIR}/build.h)
|
||||
# CPack module for installation tasks
|
||||
include(ConkyCPackSetup)
|
||||
|
||||
# Finally, add some code
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(lua)
|
||||
add_subdirectory(doc)
|
||||
|
@ -1,5 +1,23 @@
|
||||
# vim: ts=4 sw=4 noet ai cindent syntax=cmake
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||
FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
# some extra debug flags
|
||||
set(CMAKE_C_FLAGS_DEBUG "-ggdb -Wall -W -Wextra -Wunused -Wdeclaration-after-statement -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Winline -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -std=c99 -pedantic -Werror" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -Wall -W -Wextra -Wunused -std=c++0x -pedantic -Werror" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
|
||||
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
set(DEBUG true)
|
||||
endif(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
|
||||
option(RELEASE "Build release package" false)
|
||||
mark_as_advanced(RELEASE)
|
||||
|
||||
# Some standard options
|
||||
set(SYSTEM_CONFIG_FILE "/etc/conky/conky.conf" CACHE STRING "Default system-wide Conky configuration file")
|
||||
# use FORCE below to make sure this changes when CMAKE_INSTALL_PREFIX is modified
|
||||
@ -13,9 +31,19 @@ set(MAX_NET_INTERFACES "16" CACHE STRING "Maximum number of network devices")
|
||||
|
||||
|
||||
# Platform specific options
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
# Linux only
|
||||
if(OS_LINUX)
|
||||
option(BUILD_PORT_MONITORS "Build TCP portmon support" true)
|
||||
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
option(BUILD_IBM "Support for IBM/Lenovo notebooks" true)
|
||||
option(BUILD_HDDTEMP "Support for hddtemp" true)
|
||||
# nvidia may also work on FreeBSD, not sure
|
||||
option(BUILD_NVIDIA "Enable nvidia support" false)
|
||||
else(OS_LINUX)
|
||||
set(BUILD_PORT_MONITORS false)
|
||||
set(BUILD_IBM false)
|
||||
set(BUILD_HDDTEMP false)
|
||||
set(BUILD_NVIDIA false)
|
||||
endif(OS_LINUX)
|
||||
|
||||
# Optional features etc
|
||||
option(BUILD_X11 "Build X11 support" true)
|
||||
@ -28,10 +56,27 @@ endif(BUILD_X11)
|
||||
|
||||
option(BUILD_LUA "Build Lua support" true)
|
||||
|
||||
option(BUILD_AUDACIOUS "Build audacious player support" false)
|
||||
option(BUILD_AUDACIOUS "Build audacious (music player) support" false)
|
||||
if(BUILD_AUDACIOUS)
|
||||
option(BUILD_AUDACIOUS_LEGACY "Use legacy audacious player support" false)
|
||||
option(BUILD_AUDACIOUS_LEGACY "Use legacy audacious (music player) support" false)
|
||||
else(BUILD_AUDACIOUS)
|
||||
set(BUILD_AUDACIOUS_LEGACY false)
|
||||
endif(BUILD_AUDACIOUS)
|
||||
|
||||
option(BUILD_BMPX "Build BMPx (music player) support" false)
|
||||
|
||||
option(BUILD_MPD "Enable if you want MPD (music player) support" true)
|
||||
|
||||
option(BUILD_MOC "Enable if you want MOC (music player) support" true)
|
||||
|
||||
option(BUILD_XMMS2 "Enable if you want XMMS2 (music player) support" false)
|
||||
|
||||
option(BUILD_EVE "Enable if you want Eve-Online skill monitoring support" false)
|
||||
|
||||
option(BUILD_CURL "Enable if you want Curl support" false)
|
||||
|
||||
option(BUILD_RSS "Enable if you want RSS support" false)
|
||||
|
||||
option(BUILD_WEATHER_METAR "Enable METAR weather support" false)
|
||||
option(BUILD_WEATHER_XOAP "Enable XOAP weather support" false)
|
||||
|
||||
|
@ -22,8 +22,9 @@ endif(CPACK_GENERATOR MATCHES "NSIS")
|
||||
# Source package setup. Compile with "make package_source".
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION}-src")
|
||||
set(CPACK_SOURCE_GENERATOR "TBZ2")
|
||||
execute_process(COMMAND ${APP_UNAME} COMMAND ${APP_GAWK} "{print $1}" RESULT_VARIABLE RETVAL
|
||||
OUTPUT_VARIABLE CPU_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND ${APP_UNAME} COMMAND ${APP_GAWK} "{print $1}"
|
||||
RESULT_VARIABLE RETVAL OUTPUT_VARIABLE CPU_ARCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(CPACK_SOURCE_IGNORE_FILES
|
||||
# Exclude backup files generated by text editors.
|
||||
|
@ -1,11 +1,16 @@
|
||||
# vim: ts=4 sw=4 noet ai cindent syntax=cmake
|
||||
|
||||
include(FindPkgConfig)
|
||||
include(CheckFunctionExists)
|
||||
|
||||
# Check for some headers
|
||||
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 some functions
|
||||
check_function_exists(strndup HAVE_STRNDUP)
|
||||
|
||||
# standard path to search for includes
|
||||
set(INCLUDE_SEARCH_PATH /usr/include /usr/local/include)
|
||||
|
||||
@ -58,7 +63,7 @@ if(BUILD_X11)
|
||||
/usr/include/freetype2
|
||||
/usr/local/include/freetype2)
|
||||
if(freetype_INCLUDE_PATH)
|
||||
set(freetype_FOUND TRUE)
|
||||
set(freetype_FOUND true)
|
||||
set(conky_includes ${conky_includes} ${freetype_INCLUDE_PATH})
|
||||
else(freetype_INCLUDE_PATH)
|
||||
message(FATAL_ERROR "Unable to find freetype library")
|
||||
@ -73,7 +78,7 @@ if(BUILD_X11)
|
||||
if(BUILD_XDBE)
|
||||
find_path(X11_Xdbe_INCLUDE_PATH X11/extensions/Xdbe.h ${X11_INC_SEARCH_PATH})
|
||||
if(X11_Xdbe_INCLUDE_PATH)
|
||||
set(X11_Xdbe_FOUND TRUE)
|
||||
set(X11_Xdbe_FOUND true)
|
||||
set(X11_INCLUDE_DIR ${X11_INCLUDE_DIR} ${X11_Xdbe_INCLUDE_PATH})
|
||||
endif(X11_Xdbe_INCLUDE_PATH)
|
||||
if(NOT X11_Xdbe_FOUND)
|
||||
@ -110,10 +115,73 @@ if(BUILD_AUDACIOUS)
|
||||
endif(NOT BUILD_AUDACIOUS_LEGACY)
|
||||
endif(BUILD_AUDACIOUS)
|
||||
|
||||
if(BUILD_BMPX)
|
||||
pkg_check_modules(BMPX REQUIRED bmp-2.0>=0.14.0)
|
||||
set(conky_libs ${conky_libs} ${BMPX_LIBRARIES})
|
||||
set(conky_includes ${conky_includes} ${BMPX_INCLUDE_DIRS})
|
||||
endif(BUILD_BMPX)
|
||||
|
||||
if(BUILD_XMMS2)
|
||||
pkg_check_modules(XMMS2 REQUIRED xmms2-client)
|
||||
set(conky_libs ${conky_libs} ${XMMS2_LIBRARIES})
|
||||
set(conky_includes ${conky_includes} ${XMMS2_INCLUDE_DIRS})
|
||||
endif(BUILD_XMMS2)
|
||||
|
||||
if(BUILD_EVE)
|
||||
set(WANT_CURL true)
|
||||
set(WANT_LIBXML2 true)
|
||||
endif(BUILD_EVE)
|
||||
|
||||
if(BUILD_CURL)
|
||||
set(WANT_CURL true)
|
||||
endif(BUILD_CURL)
|
||||
|
||||
if(BUILD_RSS)
|
||||
set(WANT_CURL true)
|
||||
set(WANT_GLIB true)
|
||||
set(WANT_LIBXML2 true)
|
||||
endif(BUILD_RSS)
|
||||
|
||||
if(BUILD_WEATHER_METAR)
|
||||
set(WANT_CURL true)
|
||||
set(BUILD_WEATHER true)
|
||||
endif(BUILD_WEATHER_METAR)
|
||||
|
||||
if(BUILD_WEATHER_XOAP)
|
||||
set(WANT_LIBXML2 true)
|
||||
set(WANT_CURL true)
|
||||
set(BUILD_XOAP true)
|
||||
set(BUILD_WEATHER true)
|
||||
endif(BUILD_WEATHER_XOAP)
|
||||
|
||||
if(BUILD_NVIDIA)
|
||||
find_path(XNVCtrl_INCLUDE_PATH NVCtrl/NVCtrl.h ${INCLUDE_SEARCH_PATH})
|
||||
find_library(XNVCtrl_LIB NAMES XNVCtrl)
|
||||
if(XNVCtrl_INCLUDE_PATH AND XNVCtrl_LIB)
|
||||
set(XNVCtrl_FOUND true)
|
||||
set(conky_libs ${conky_libs} ${XNVCtrl_LIB})
|
||||
set(conky_includes ${conky_includes} ${XNVCtrl_INCLUDE_PATH})
|
||||
else(XNVCtrl_INCLUDE_PATH AND XNVCtrl_LIB)
|
||||
message(FATAL_ERROR "Unable to find XNVCtrl library")
|
||||
endif(XNVCtrl_INCLUDE_PATH AND XNVCtrl_LIB)
|
||||
endif(BUILD_NVIDIA)
|
||||
|
||||
# Common libraries
|
||||
if(WANT_GLIB)
|
||||
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||
set(conky_libs ${conky_libs} ${GLIB_LIBRARIES})
|
||||
set(conky_includes ${conky_includes} ${GLIB_INCLUDE_DIRS})
|
||||
endif(WANT_GLIB)
|
||||
|
||||
if(WANT_CURL)
|
||||
pkg_check_modules(CURL REQUIRED libcurl)
|
||||
set(conky_libs ${conky_libs} ${CURL_LIBRARIES})
|
||||
set(conky_includes ${conky_includes} ${CURL_INCLUDE_DIRS})
|
||||
endif(WANT_CURL)
|
||||
|
||||
if(WANT_LIBXML2)
|
||||
pkg_check_modules(LIBXML2 REQUIRED libxml-2.0)
|
||||
set(conky_libs ${conky_libs} ${LIBXML2_LIBRARIES})
|
||||
set(conky_includes ${conky_includes} ${LIBXML2_INCLUDE_DIRS})
|
||||
endif(WANT_LIBXML2)
|
||||
|
||||
|
48
config.h.in
48
config.h.in
@ -24,6 +24,8 @@
|
||||
#cmakedefine HAVE_SYS_PARAM_H 1
|
||||
#cmakedefine HAVE_SYS_INOTIFY_H 1
|
||||
|
||||
#cmakedefine HAVE_STRNDUP 1
|
||||
|
||||
#cmakedefine BUILD_X11 1
|
||||
#ifdef BUILD_X11
|
||||
#define X11
|
||||
@ -66,4 +68,50 @@
|
||||
#define AUDACIOUS_LEGACY
|
||||
#endif /* BUILD_AUDACIOUS_LEGACY */
|
||||
|
||||
#cmakedefine BUILD_MPD 1
|
||||
#ifdef BUILD_MPD
|
||||
#define MPD
|
||||
#endif /* BUILD_MPD */
|
||||
|
||||
#cmakedefine BUILD_MOC 1
|
||||
#ifdef BUILD_MOC
|
||||
#define MOC
|
||||
#endif /* BUILD_MOC */
|
||||
|
||||
#cmakedefine BUILD_XMMS2 1
|
||||
#ifdef BUILD_XMMS2
|
||||
#define XMMS2
|
||||
#endif /* BUILD_XMMS2 */
|
||||
|
||||
#cmakedefine BUILD_HDDTEMP 1
|
||||
#ifdef BUILD_HDDTEMP
|
||||
#define HDDTEMP
|
||||
#endif /* BUILD_HDDTEMP */
|
||||
|
||||
#cmakedefine BUILD_EVE 1
|
||||
#ifdef BUILD_EVE
|
||||
#define EVE
|
||||
#define EVEURL_TRAINING "http://api.eve-online.com/char/SkillInTraining.xml.aspx"
|
||||
#define EVEURL_SKILLTREE "http://api.eve-online.com/eve/Skilltree.xml.aspx"
|
||||
#define EVE_OUTPUT_FORMAT "%s %d in %s"
|
||||
#endif /* BUILD_EVE */
|
||||
|
||||
#cmakedefine BUILD_LIBXML2 1
|
||||
|
||||
#cmakedefine BUILD_CURL 1
|
||||
#ifdef BUILD_CURL
|
||||
#define HAVE_CURL
|
||||
#endif /* BUILD_CURL */
|
||||
|
||||
#cmakedefine BUILD_WEATHER_XOAP 1
|
||||
#ifdef BUILD_WEATHER_XOAP
|
||||
#define XOAP
|
||||
#define XOAP_FILE "$HOME/.xoaprc"
|
||||
#endif /* BUILD_WEATHER_XOAP */
|
||||
|
||||
#cmakedefine BUILD_WEATHER_METAR 1
|
||||
#ifdef BUILD_WEATHER_METAR
|
||||
#define BUILD_WEATHER
|
||||
#endif /* BUILD_WEATHER_METAR */
|
||||
|
||||
#endif /* _conky_config_h_ */
|
||||
|
@ -27,9 +27,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include "config.h"
|
||||
#include "conky.h"
|
||||
#define _GNU_SOURCE
|
||||
#include "algebra.h"
|
||||
#include "logging.h"
|
||||
#include <ctype.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user