1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00
conky/cmake/ConkyBuildOptions.cmake

289 lines
10 KiB
CMake
Raw Normal View History

2010-01-01 23:49:41 +00:00
#
# Conky, a system monitor, based on torsmo
#
# Please see COPYING for details
#
2021-02-27 15:14:19 +00:00
# Copyright (c) 2005-2021 Brenden Matthews, et. al. (see AUTHORS) All rights
# reserved.
2010-01-01 23:49:41 +00:00
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
2010-01-01 23:49:41 +00:00
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details. You should have received a copy of the GNU General Public License
2010-01-01 23:49:41 +00:00
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
2009-12-08 04:46:49 +00:00
if(NOT CMAKE_BUILD_TYPE)
if(MAINTAINER_MODE)
set(
CMAKE_BUILD_TYPE Debug
CACHE
STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
else(MAINTAINER_MODE)
set(
CMAKE_BUILD_TYPE RelWithDebInfo
CACHE
STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(MAINTAINER_MODE)
2009-12-08 04:46:49 +00:00
endif(NOT CMAKE_BUILD_TYPE)
# -std options for all build types
set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}"
CACHE STRING "Flags used by the C compiler during all build types."
FORCE)
set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_CXX_FLAGS}"
CACHE STRING "Flags used by the C++ compiler during all build types."
FORCE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(MAINTAINER_MODE)
set(BUILD_TESTS true)
# some extra debug flags when in 'maintainer mode'
if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
# Some flags are only supported on GCC >= 7.0, such as -Wimplicit-
# fallthrough=2
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 -pedantic -Werror -Wno-unknown-pragmas -Wno-error=pragmas -Wimplicit-fallthrough=2"
CACHE STRING "Flags used by the compiler during debug builds."
FORCE)
set(
CMAKE_CXX_FLAGS_DEBUG
"-ggdb -Wall -W -Wextra -Wunused -pedantic -Werror -Wno-format -Wno-unknown-pragmas -Wno-error=pragmas -Wimplicit-fallthrough=2"
CACHE STRING "Flags used by the compiler during debug builds."
FORCE)
else()
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 -pedantic -Werror -Wno-unknown-pragmas -Wno-error=pragmas"
CACHE STRING "Flags used by the compiler during debug builds."
FORCE)
set(
CMAKE_CXX_FLAGS_DEBUG
"-ggdb -Wall -W -Wextra -Wunused -pedantic -Werror -Wno-format -Wno-unknown-pragmas -Wno-error=pragmas"
CACHE STRING "Flags used by the compiler during debug builds."
FORCE)
endif()
2009-12-08 04:46:49 +00:00
2021-02-28 20:46:17 +00:00
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(USING_CLANG true)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif(MAINTAINER_MODE)
option(CHECK_CODE_QUALITY "Check code formatting/quality with clang" false)
2009-12-08 04:46:49 +00:00
option(RELEASE "Build release package" false)
mark_as_advanced(RELEASE)
option(MAINTAINER_MODE "Enable maintainer mode" false)
option(BUILD_DOCS "Build documentation" false)
option(BUILD_I18N "Enable if you want internationalization support" true)
2010-11-13 18:45:04 +00:00
if(BUILD_I18N)
set(LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale"
CACHE STRING "Directory containing the locales")
2010-11-13 18:45:04 +00:00
endif(BUILD_I18N)
# 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
if(NOT LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
endif(NOT LIB_INSTALL_DIR)
set(PACKAGE_LIBRARY_DIR "${LIB_INSTALL_DIR}/conky"
CACHE STRING "Package library path (where Lua bindings are installed"
FORCE)
2019-02-25 16:51:43 +00:00
set(DEFAULTNETDEV "eno1" CACHE STRING "Default networkdevice")
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
# Mac only override
if(OS_DARWIN)
set(DEFAULTNETDEV "en0" CACHE STRING "Default networkdevice" FORCE)
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
endif(OS_DARWIN)
set(XDG_CONFIG_FILE "$HOME/.config/conky/conky.conf"
CACHE STRING "Configfile of the user (XDG)")
set(CONFIG_FILE "$HOME/.conkyrc" CACHE STRING "Configfile of the user")
set(MAX_USER_TEXT_DEFAULT "16384"
CACHE STRING
"Default maximum size of config TEXT buffer, i.e. below TEXT line.")
set(DEFAULT_TEXT_BUFFER_SIZE "256"
CACHE STRING "Default size used for temporary, static text buffers")
set(MAX_NET_INTERFACES "256" CACHE STRING "Maximum number of network devices")
# Platform specific options Linux only
2009-12-08 04:46:49 +00:00
if(OS_LINUX)
option(BUILD_PORT_MONITORS "Build TCP portmon support" true)
option(BUILD_IBM "Support for IBM/Lenovo notebooks" true)
option(BUILD_HDDTEMP "Support for hddtemp" true)
option(BUILD_IPV6 "Enable if you want IPv6 support" true)
2021-03-01 18:03:35 +00:00
if(BUILD_X11)
# nvidia may also work on FreeBSD, not sure
option(BUILD_NVIDIA "Enable nvidia support" false)
endif(BUILD_X11)
2009-12-08 04:46:49 +00:00
else(OS_LINUX)
set(BUILD_PORT_MONITORS false)
set(BUILD_IBM false)
set(BUILD_HDDTEMP false)
set(BUILD_NVIDIA false)
set(BUILD_IPV6 false)
2009-12-08 04:46:49 +00:00
endif(OS_LINUX)
2009-12-06 19:43:12 +00:00
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
# macOS Only
if(OS_DARWIN)
option(
BUILD_IPGFREQ
"Enable cpu freq calculation based on Intel® Power Gadget; otherwise use constant factory value"
false)
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
endif(OS_DARWIN)
# Optional features etc
2009-12-11 04:37:56 +00:00
#
Conky for mac os master (#579) * Try to amend #31 * BUILD_WLAN should be available for all OS. Keep BUILD_WLAN OFF by default for compatibility reasons. * WLAN-related variables should be available for every OS. There are some problems (probably null-dereference) * Fix $wireless_essid crashing conky if no argument provided. Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable. Also fix some documentation stuff. * Improve `get_freq` #20 Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one. Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless. * Oops, this accidently slipped in * Introduce BUILD_IPGFREQ build option This build option has been introduced for one particular reason: On macOS getting current core-frequency is not supported by the APIs. A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension. Though, this may trouble some alot, thus introduce BUILD_IPGFREQ. * Forgot static here. * Some improvements for get_freq again. Fix frequency not printing correctly (I wasn't using the divisor) Add more guards. * Setup cmake files and project code for Objective-C code #17 We want to use CoreWLAN framework. * update_cpu_usage() now supports multiple cores Also, some cleanup. * Updated default conky config to monitor Mac Networking * Made Mac Friendly BuildOptions and generic default conky configs * Undid Xdamage config and cleaned up previous IF statements * Re-Added XDamage fix * Finish up the algorithm. I think its now correct. Closes: #33 * Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables free_cpu() must be implemented for every OS and on all except macOS its a no-op function. * Reformat, add empty comment.
2018-08-07 15:54:01 +00:00
option(BUILD_WLAN "Enable wireless support" false)
option(BUILD_BUILTIN_CONFIG "Enable builtin default configuration" true)
2009-12-11 04:37:56 +00:00
option(BUILD_IOSTATS "Enable disk I/O stats" true)
option(BUILD_OLD_CONFIG "Enable support for the old syntax of configurations"
true)
2009-12-11 04:37:56 +00:00
option(BUILD_MATH "Enable math support" true)
option(BUILD_NCURSES "Enable ncurses support" true)
if(BUILD_NCURSES)
option(
LEAKFREE_NCURSES
"Enable to hide false ncurses-memleaks in valgrind (works only when ncurses is compiled with --disable-leaks)"
false)
else(BUILD_NCURSES)
set(
LEAKFREE_NCURSES false
CACHE
BOOL
"Enable to hide false ncurses-memleaks in valgrind (works only when ncurses is compiled with --disable-leaks)"
FORCE)
endif(BUILD_NCURSES)
2009-12-11 04:37:56 +00:00
option(BUILD_X11 "Build X11 support" true)
if(BUILD_X11)
option(OWN_WINDOW "Enable own_window support" true)
# Mac Fix
if(OS_DARWIN)
option(BUILD_XDAMAGE "Build Xdamage support" false)
else(OS_DARWIN)
option(BUILD_XDAMAGE "Build Xdamage support" true)
endif(OS_DARWIN)
option(BUILD_XINERAMA "Build Xinerama support" true)
option(BUILD_XDBE "Build Xdbe (double-buffer) support" true)
option(BUILD_XFT "Build Xft (freetype fonts) support" true)
option(BUILD_IMLIB2 "Enable Imlib2 support" true)
option(BUILD_XSHAPE "Enable Xshape support" true)
else(BUILD_X11)
set(OWN_WINDOW false CACHE BOOL "Enable own_window support" FORCE)
set(BUILD_XDAMAGE false CACHE BOOL "Build Xdamage support" FORCE)
set(BUILD_XINERAMA false CACHE BOOL "Build Xinerama support" FORCE)
set(BUILD_XDBE false CACHE BOOL "Build Xdbe (double-buffer) support" FORCE)
set(BUILD_XFT false CACHE BOOL "Build Xft (freetype fonts) support" FORCE)
set(BUILD_IMLIB2 false CACHE BOOL "Enable Imlib2 support" FORCE)
set(BUILD_XSHAPE false CACHE BOOL "Enable Xshape support" FORCE)
2021-03-01 18:03:35 +00:00
set(BUILD_NVIDIA false)
endif(BUILD_X11)
# if we build with any GUI support
if(BUILD_X11)
set(BUILD_GUI true)
endif(BUILD_X11)
if(OWN_WINDOW)
option(BUILD_ARGB "Build ARGB (real transparency) support" true)
else(OWN_WINDOW)
set(BUILD_ARGB false
CACHE BOOL "Build ARGB (real transparency) support"
FORCE)
endif(OWN_WINDOW)
2010-11-14 00:41:07 +00:00
option(BUILD_LUA_CAIRO "Build cairo bindings for Lua" false)
option(BUILD_LUA_IMLIB2 "Build Imlib2 bindings for Lua" false)
option(BUILD_LUA_RSVG "Build rsvg bindings for Lua" false)
2009-12-06 19:30:06 +00:00
2009-12-08 04:46:49 +00:00
option(BUILD_AUDACIOUS "Build audacious (music player) support" false)
2009-12-06 19:30:06 +00:00
2009-12-08 04:46:49 +00:00
option(BUILD_MPD "Enable if you want MPD (music player) support" true)
option(BUILD_MYSQL "Enable if you want MySQL support" false)
2009-12-08 04:46:49 +00:00
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_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" true)
if(BUILD_WEATHER_METAR OR BUILD_RSS)
set(BUILD_CURL true)
endif(BUILD_WEATHER_METAR OR BUILD_RSS)
2009-12-08 04:46:49 +00:00
2009-12-11 04:37:56 +00:00
option(BUILD_APCUPSD "Enable APCUPSD support" true)
2010-01-20 17:17:30 +00:00
option(BUILD_ICAL "Enable if you want iCalendar (RFC 5545) support" false)
2010-04-27 14:42:21 +00:00
2010-04-30 17:32:42 +00:00
option(BUILD_IRC "Enable if you want IRC support" false)
2010-06-04 12:41:12 +00:00
option(BUILD_HTTP "Enable if you want HTTP support" false)
if(BUILD_HTTP)
set(HTTPPORT "10080" CACHE STRING "Port to use for out_to_http")
endif(BUILD_HTTP)
2010-06-04 12:41:12 +00:00
2010-01-20 17:17:30 +00:00
option(BUILD_ICONV "Enable iconv support" false)
2011-05-10 20:40:53 +00:00
option(BUILD_CMUS "Enable support for cmus music player" true)
option(BUILD_JOURNAL "Enable support for reading from the systemd journal"
false)
option(BUILD_PULSEAUDIO
"Enable support for Pulseaudio's default sink and source" false)
2018-12-22 21:16:28 +00:00
2021-04-20 22:10:00 +00:00
option(BUILD_INTEL_BACKLIGHT
"Enable support for Intel backlight" false)
2020-11-09 12:56:18 +00:00
option(BUILD_HSV_GRADIENT "Enable gradient in HSV colour space" true)
message(STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS})
message(STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS})
2018-12-22 21:16:28 +00:00
message(STATUS "CMAKE_C_FLAGS_DEBUG: " ${CMAKE_C_FLAGS_DEBUG})
message(STATUS "CMAKE_CXX_FLAGS_DEBUG: " ${CMAKE_CXX_FLAGS_DEBUG})
2018-12-22 21:16:28 +00:00
message(STATUS "CMAKE_C_FLAGS_MINSIZEREL: " ${CMAKE_C_FLAGS_MINSIZEREL})
message(STATUS "CMAKE_CXX_FLAGS_MINSIZEREL: " ${CMAKE_CXX_FLAGS_MINSIZEREL})
2018-12-22 21:16:28 +00:00
message(STATUS "CMAKE_C_FLAGS_RELEASE: " ${CMAKE_C_FLAGS_RELEASE})
message(STATUS "CMAKE_CXX_FLAGS_RELEASE: " ${CMAKE_CXX_FLAGS_RELEASE})
2018-12-22 21:16:28 +00:00
message(STATUS "CMAKE_C_FLAGS_RELWITHDEBINFO: " ${CMAKE_C_FLAGS_RELWITHDEBINFO})
message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO: "
${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
2018-12-22 21:16:28 +00:00
message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})