Add cmake files for configuring individual targets
This makes the code a bit less messy. We barely need if(BUILD_...) guards inside the cmake files, just the root CMakeLists.txt.
This commit is contained in:
parent
20c88ca977
commit
923d9ae061
@ -30,24 +30,25 @@ set(CMAKE_MODULE_PATH
|
||||
|
||||
include(GNUInstallDirs)
|
||||
include(utils)
|
||||
include(00-components)
|
||||
include(02-opts)
|
||||
if (HAS_CXX_COMPILATION)
|
||||
include(01-core)
|
||||
endif()
|
||||
include(03-libs)
|
||||
include(02-opts)
|
||||
include(04-targets)
|
||||
|
||||
if(BUILD_DOC)
|
||||
add_subdirectory(doc)
|
||||
endif()
|
||||
|
||||
add_subdirectory(contrib/bash)
|
||||
add_subdirectory(contrib/zsh)
|
||||
|
||||
# Setup everything that uses a C++ compile (polybar, polybar-msg, tests)
|
||||
if(HAS_CXX_COMPILATION)
|
||||
include(cxx)
|
||||
if(BUILD_LIBPOLY)
|
||||
add_subdirectory(include)
|
||||
include(libpoly)
|
||||
add_subdirectory(lib)
|
||||
endif()
|
||||
if (HAS_CXX_COMPILATION)
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(src bin)
|
||||
endif()
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
option(DISABLE_ALL "Set this to ON disable all targets. Individual targets can be enabled explicitly." OFF)
|
||||
|
||||
# If all targets are disabled, we set the default value for options that are on
|
||||
# by default to OFF
|
||||
if (DISABLE_ALL)
|
||||
set(DEFAULT_ON OFF)
|
||||
else()
|
||||
set(DEFAULT_ON ON)
|
||||
endif()
|
||||
|
||||
option(BUILD_POLYBAR "Build the main polybar executable" ${DEFAULT_ON})
|
||||
option(BUILD_POLYBAR_MSG "Build polybar-msg" ${DEFAULT_ON})
|
||||
option(BUILD_TESTS "Build testsuite" OFF)
|
||||
option(BUILD_DOC "Build documentation" ${DEFAULT_ON})
|
||||
|
||||
if (BUILD_POLYBAR OR BUILD_TESTS)
|
||||
set(BUILD_LIBPOLY ON)
|
||||
else()
|
||||
set(BUILD_LIBPOLY OFF)
|
||||
endif()
|
||||
|
||||
if (BUILD_LIBPOLY OR BUILD_POLYBAR_MSG)
|
||||
set(HAS_CXX_COMPILATION ON)
|
||||
else()
|
||||
set(HAS_CXX_COMPILATION OFF)
|
||||
endif()
|
@ -1,12 +1,32 @@
|
||||
#
|
||||
# Core setup
|
||||
#
|
||||
option(DISABLE_ALL "Set this to ON disable all targets. Individual targets can be enabled explicitly." OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
# If all targets are disabled, we set the default value for options that are on
|
||||
# by default to OFF
|
||||
if (DISABLE_ALL)
|
||||
set(DEFAULT_ON OFF)
|
||||
else()
|
||||
set(DEFAULT_ON ON)
|
||||
endif()
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
option(BUILD_POLYBAR "Build the main polybar executable" ${DEFAULT_ON})
|
||||
option(BUILD_POLYBAR_MSG "Build polybar-msg" ${DEFAULT_ON})
|
||||
option(BUILD_TESTS "Build testsuite" OFF)
|
||||
option(BUILD_DOC "Build documentation" ${DEFAULT_ON})
|
||||
|
||||
if (BUILD_POLYBAR OR BUILD_TESTS)
|
||||
set(BUILD_LIBPOLY ON)
|
||||
else()
|
||||
set(BUILD_LIBPOLY OFF)
|
||||
endif()
|
||||
|
||||
if (BUILD_LIBPOLY OR BUILD_POLYBAR_MSG)
|
||||
set(HAS_CXX_COMPILATION ON)
|
||||
else()
|
||||
set(HAS_CXX_COMPILATION OFF)
|
||||
endif()
|
||||
|
||||
# Export compile commands used for custom targets
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
@ -17,77 +37,3 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
message_colored(STATUS "No build type specified; using ${CMAKE_BUILD_TYPE}" 33)
|
||||
endif()
|
||||
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
|
||||
|
||||
# Compiler flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
# Need dprintf() for FreeBSD 11.1 and older
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WITH_DPRINTF")
|
||||
# libinotify uses c99 extension, so suppress this error
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c99-extensions")
|
||||
# Ensures that libraries from dependencies in LOCALBASE are used
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
|
||||
endif()
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=parentheses-equality")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-zero-length-array")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g2")
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -fdata-sections -ffunction-sections")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -Wl,--gc-sections,--icf=safe")
|
||||
endif()
|
||||
|
||||
# Check compiler
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4.0")
|
||||
message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31)
|
||||
else()
|
||||
message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32)
|
||||
endif()
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1.0")
|
||||
message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31)
|
||||
else()
|
||||
message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32)
|
||||
endif()
|
||||
else()
|
||||
message_colored(WARNING "Using unsupported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION} !" 31)
|
||||
endif()
|
||||
|
||||
# Set compiler and linker flags for preferred C++ library
|
||||
if(CXXLIB_CLANG)
|
||||
message_colored(STATUS "Linking against libc++" 32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++ -lc++abi")
|
||||
elseif(CXXLIB_GCC)
|
||||
message_colored(STATUS "Linking against libstdc++" 32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++")
|
||||
endif()
|
||||
|
||||
# Custom build type ; SANITIZE
|
||||
SET(CMAKE_CXX_FLAGS_SANITIZE "-O0 -g -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||
CACHE STRING "Flags used by the C++ compiler during sanitize builds." FORCE)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_SANITIZE ""
|
||||
CACHE STRING "Flags used for linking binaries during sanitize builds." FORCE)
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_SANITIZE ""
|
||||
CACHE STRING "Flags used by the shared libraries linker during sanitize builds." FORCE)
|
||||
MARK_AS_ADVANCED(
|
||||
CMAKE_CXX_FLAGS_SANITIZE
|
||||
CMAKE_EXE_LINKER_FLAGS_SANITIZE
|
||||
CMAKE_SHARED_LINKER_FLAGS_SANITIZE)
|
||||
|
||||
# Custom build type ; Coverage
|
||||
SET(CMAKE_CXX_FLAGS_COVERAGE
|
||||
"${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_COVERAGE} --coverage")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${CMAKE_EXE_LINKER_FLAGS_COVERAGE}")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
|
||||
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${CMAKE_SHARED_LINKER_FLAGS_COVERAGE}")
|
||||
|
@ -1,68 +1,3 @@
|
||||
set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build")
|
||||
set(SPHINX_BUILD "sphinx-build" CACHE STRING "Name/Path of the sphinx-build executable to use.")
|
||||
|
||||
if (HAS_CXX_COMPILATION)
|
||||
option(ENABLE_CCACHE "Enable ccache support" ON)
|
||||
if(ENABLE_CCACHE)
|
||||
find_program(BIN_CCACHE ccache)
|
||||
mark_as_advanced(BIN_CCACHE)
|
||||
|
||||
if(NOT BIN_CCACHE)
|
||||
message_colored(STATUS "Couldn't locate ccache, disabling ccache..." "33")
|
||||
else()
|
||||
# Enable only if the binary is found
|
||||
message_colored(STATUS "Using compiler cache ${BIN_CCACHE}" "32")
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${BIN_CCACHE} CACHE STRING "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(CXXLIB_CLANG "Link against libc++" OFF)
|
||||
option(CXXLIB_GCC "Link against stdlibc++" OFF)
|
||||
endif()
|
||||
|
||||
if (BUILD_LIBPOLY)
|
||||
checklib(ENABLE_ALSA "pkg-config" alsa)
|
||||
checklib(ENABLE_CURL "pkg-config" libcurl)
|
||||
checklib(ENABLE_I3 "binary" i3)
|
||||
checklib(ENABLE_MPD "pkg-config" libmpdclient)
|
||||
checklib(WITH_LIBNL "pkg-config" libnl-genl-3.0)
|
||||
if(WITH_LIBNL)
|
||||
checklib(ENABLE_NETWORK "pkg-config" libnl-genl-3.0)
|
||||
set(WIRELESS_LIB "libnl")
|
||||
else()
|
||||
checklib(ENABLE_NETWORK "cmake" Libiw)
|
||||
set(WIRELESS_LIB "wireless-tools")
|
||||
endif()
|
||||
checklib(ENABLE_PULSEAUDIO "pkg-config" libpulse)
|
||||
checklib(WITH_XKB "pkg-config" xcb-xkb)
|
||||
checklib(WITH_XRM "pkg-config" xcb-xrm)
|
||||
checklib(WITH_XRANDR_MONITORS "pkg-config" "xcb-randr>=1.12")
|
||||
checklib(WITH_XCURSOR "pkg-config" "xcb-cursor")
|
||||
|
||||
option(ENABLE_ALSA "Enable alsa support" ON)
|
||||
option(ENABLE_CURL "Enable curl support" ON)
|
||||
option(ENABLE_I3 "Enable i3 support" ON)
|
||||
option(ENABLE_MPD "Enable mpd support" ON)
|
||||
option(WITH_LIBNL "Use netlink interface for wireless" ON)
|
||||
option(ENABLE_NETWORK "Enable network support" ON)
|
||||
option(ENABLE_XKEYBOARD "Enable xkeyboard support" ON)
|
||||
option(ENABLE_PULSEAUDIO "Enable PulseAudio support" ON)
|
||||
|
||||
option(WITH_XRANDR_MONITORS "xcb-randr monitor support" ON)
|
||||
option(WITH_XKB "xcb-xkb support" ON)
|
||||
option(WITH_XRM "xcb-xrm support" ON)
|
||||
option(WITH_XCURSOR "xcb-cursor support" ON)
|
||||
|
||||
option(DEBUG_LOGGER "Trace logging" ON)
|
||||
|
||||
if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG)
|
||||
option(DEBUG_LOGGER_VERBOSE "Trace logging (verbose)" OFF)
|
||||
option(DEBUG_HINTS "Debug clickable areas" OFF)
|
||||
option(DEBUG_WHITESPACE "Debug whitespace" OFF)
|
||||
option(DEBUG_FONTCONFIG "Debug fontconfig" OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(SETTING_ALSA_SOUNDCARD "default"
|
||||
CACHE STRING "Name of the ALSA soundcard driver")
|
||||
set(SETTING_BSPWM_SOCKET_PATH "/tmp/bspwm_0_0-socket"
|
||||
|
@ -1,73 +1,3 @@
|
||||
#
|
||||
# Check libraries
|
||||
#
|
||||
|
||||
if (BUILD_DOC)
|
||||
find_program(BIN_SPHINX "${SPHINX_BUILD}")
|
||||
|
||||
if (NOT BIN_SPHINX)
|
||||
message(FATAL_ERROR "sphinx-build executable '${SPHINX_BUILD}' not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (BUILD_LIBPOLY)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(CairoFC REQUIRED)
|
||||
|
||||
if (ENABLE_ALSA)
|
||||
find_package(ALSA REQUIRED)
|
||||
set(ALSA_VERSION ${ALSA_VERSION_STRING})
|
||||
endif()
|
||||
|
||||
if (ENABLE_CURL)
|
||||
find_package(CURL REQUIRED)
|
||||
set(CURL_VERSION ${CURL_VERSION_STRING})
|
||||
endif()
|
||||
|
||||
if (ENABLE_MPD)
|
||||
find_package(LibMPDClient REQUIRED)
|
||||
set(MPD_VERSION ${LibMPDClient_VERSION})
|
||||
endif()
|
||||
|
||||
if (ENABLE_NETWORK)
|
||||
if(WITH_LIBNL)
|
||||
find_package(LibNlGenl3 REQUIRED)
|
||||
set(NETWORK_LIBRARY_VERSION ${LibNlGenl3_VERSION})
|
||||
else()
|
||||
find_package(Libiw REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ENABLE_PULSEAUDIO)
|
||||
find_package(LibPulse REQUIRED)
|
||||
set(PULSEAUDIO_VERSION ${LibPulse_VERSION})
|
||||
endif()
|
||||
|
||||
# xcomposite is required
|
||||
list(APPEND XORG_EXTENSIONS COMPOSITE)
|
||||
if (WITH_XKB)
|
||||
list(APPEND XORG_EXTENSIONS XKB)
|
||||
endif()
|
||||
if (WITH_XCURSOR)
|
||||
list(APPEND XORG_EXTENSIONS CURSOR)
|
||||
endif()
|
||||
if (WITH_XRM)
|
||||
list(APPEND XORG_EXTENSIONS XRM)
|
||||
endif()
|
||||
|
||||
# Set min xrandr version required
|
||||
if (WITH_XRANDR_MONITORS)
|
||||
set(XRANDR_VERSION "1.12")
|
||||
else ()
|
||||
set(XRANDR_VERSION "")
|
||||
endif()
|
||||
|
||||
# Randr is required
|
||||
find_package(Xcb ${XRANDR_VERSION} REQUIRED COMPONENTS RANDR)
|
||||
find_package(Xcb REQUIRED COMPONENTS ${XORG_EXTENSIONS})
|
||||
|
||||
# FreeBSD Support
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
find_package(LibInotify REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
96
cmake/cxx.cmake
Normal file
96
cmake/cxx.cmake
Normal file
@ -0,0 +1,96 @@
|
||||
option(ENABLE_CCACHE "Enable ccache support" ON)
|
||||
if(ENABLE_CCACHE)
|
||||
find_program(BIN_CCACHE ccache)
|
||||
mark_as_advanced(BIN_CCACHE)
|
||||
|
||||
if(NOT BIN_CCACHE)
|
||||
message_colored(STATUS "Couldn't locate ccache, disabling ccache..." "33")
|
||||
else()
|
||||
# Enable only if the binary is found
|
||||
message_colored(STATUS "Using compiler cache ${BIN_CCACHE}" "32")
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${BIN_CCACHE} CACHE STRING "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(CXXLIB_CLANG "Link against libc++" OFF)
|
||||
option(CXXLIB_GCC "Link against stdlibc++" OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
|
||||
# Compiler flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic")
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
# Need dprintf() for FreeBSD 11.1 and older
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WITH_DPRINTF")
|
||||
# libinotify uses c99 extension, so suppress this error
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c99-extensions")
|
||||
# Ensures that libraries from dependencies in LOCALBASE are used
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
|
||||
endif()
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=parentheses-equality")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-zero-length-array")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g2")
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -fdata-sections -ffunction-sections")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -Wl,--gc-sections,--icf=safe")
|
||||
endif()
|
||||
|
||||
# Check compiler
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4.0")
|
||||
message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31)
|
||||
else()
|
||||
message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32)
|
||||
endif()
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1.0")
|
||||
message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31)
|
||||
else()
|
||||
message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32)
|
||||
endif()
|
||||
else()
|
||||
message_colored(WARNING "Using unsupported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION} !" 31)
|
||||
endif()
|
||||
|
||||
# Set compiler and linker flags for preferred C++ library
|
||||
if(CXXLIB_CLANG)
|
||||
message_colored(STATUS "Linking against libc++" 32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++ -lc++abi")
|
||||
elseif(CXXLIB_GCC)
|
||||
message_colored(STATUS "Linking against libstdc++" 32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++")
|
||||
endif()
|
||||
|
||||
# Custom build type ; SANITIZE
|
||||
SET(CMAKE_CXX_FLAGS_SANITIZE "-O0 -g -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||
CACHE STRING "Flags used by the C++ compiler during sanitize builds." FORCE)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_SANITIZE ""
|
||||
CACHE STRING "Flags used for linking binaries during sanitize builds." FORCE)
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_SANITIZE ""
|
||||
CACHE STRING "Flags used by the shared libraries linker during sanitize builds." FORCE)
|
||||
MARK_AS_ADVANCED(
|
||||
CMAKE_CXX_FLAGS_SANITIZE
|
||||
CMAKE_EXE_LINKER_FLAGS_SANITIZE
|
||||
CMAKE_SHARED_LINKER_FLAGS_SANITIZE)
|
||||
|
||||
# Custom build type ; Coverage
|
||||
SET(CMAKE_CXX_FLAGS_COVERAGE
|
||||
"${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_COVERAGE} --coverage")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE
|
||||
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${CMAKE_EXE_LINKER_FLAGS_COVERAGE}")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
|
||||
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${CMAKE_SHARED_LINKER_FLAGS_COVERAGE}")
|
106
cmake/libpoly.cmake
Normal file
106
cmake/libpoly.cmake
Normal file
@ -0,0 +1,106 @@
|
||||
# Sets up options and dependencies for libpoly
|
||||
|
||||
|
||||
# Automatically enable all optional dependencies that are available on the machine
|
||||
checklib(ENABLE_ALSA "pkg-config" alsa)
|
||||
checklib(ENABLE_CURL "pkg-config" libcurl)
|
||||
checklib(ENABLE_I3 "binary" i3)
|
||||
checklib(ENABLE_MPD "pkg-config" libmpdclient)
|
||||
checklib(WITH_LIBNL "pkg-config" libnl-genl-3.0)
|
||||
if(WITH_LIBNL)
|
||||
checklib(ENABLE_NETWORK "pkg-config" libnl-genl-3.0)
|
||||
set(WIRELESS_LIB "libnl")
|
||||
else()
|
||||
checklib(ENABLE_NETWORK "cmake" Libiw)
|
||||
set(WIRELESS_LIB "wireless-tools")
|
||||
endif()
|
||||
checklib(ENABLE_PULSEAUDIO "pkg-config" libpulse)
|
||||
checklib(WITH_XKB "pkg-config" xcb-xkb)
|
||||
checklib(WITH_XRM "pkg-config" xcb-xrm)
|
||||
checklib(WITH_XRANDR_MONITORS "pkg-config" "xcb-randr>=1.12")
|
||||
checklib(WITH_XCURSOR "pkg-config" "xcb-cursor")
|
||||
|
||||
option(ENABLE_ALSA "Enable alsa support" ON)
|
||||
option(ENABLE_CURL "Enable curl support" ON)
|
||||
option(ENABLE_I3 "Enable i3 support" ON)
|
||||
option(ENABLE_MPD "Enable mpd support" ON)
|
||||
option(WITH_LIBNL "Use netlink interface for wireless" ON)
|
||||
option(ENABLE_NETWORK "Enable network support" ON)
|
||||
option(ENABLE_XKEYBOARD "Enable xkeyboard support" ON)
|
||||
option(ENABLE_PULSEAUDIO "Enable PulseAudio support" ON)
|
||||
|
||||
option(WITH_XRANDR_MONITORS "xcb-randr monitor support" ON)
|
||||
option(WITH_XKB "xcb-xkb support" ON)
|
||||
option(WITH_XRM "xcb-xrm support" ON)
|
||||
option(WITH_XCURSOR "xcb-cursor support" ON)
|
||||
|
||||
option(DEBUG_LOGGER "Trace logging" ON)
|
||||
|
||||
if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG)
|
||||
option(DEBUG_LOGGER_VERBOSE "Trace logging (verbose)" OFF)
|
||||
option(DEBUG_HINTS "Debug clickable areas" OFF)
|
||||
option(DEBUG_WHITESPACE "Debug whitespace" OFF)
|
||||
option(DEBUG_FONTCONFIG "Debug fontconfig" OFF)
|
||||
endif()
|
||||
|
||||
# Load all packages for enabled components
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(CairoFC REQUIRED)
|
||||
|
||||
if (ENABLE_ALSA)
|
||||
find_package(ALSA REQUIRED)
|
||||
set(ALSA_VERSION ${ALSA_VERSION_STRING})
|
||||
endif()
|
||||
|
||||
if (ENABLE_CURL)
|
||||
find_package(CURL REQUIRED)
|
||||
set(CURL_VERSION ${CURL_VERSION_STRING})
|
||||
endif()
|
||||
|
||||
if (ENABLE_MPD)
|
||||
find_package(LibMPDClient REQUIRED)
|
||||
set(MPD_VERSION ${LibMPDClient_VERSION})
|
||||
endif()
|
||||
|
||||
if (ENABLE_NETWORK)
|
||||
if(WITH_LIBNL)
|
||||
find_package(LibNlGenl3 REQUIRED)
|
||||
set(NETWORK_LIBRARY_VERSION ${LibNlGenl3_VERSION})
|
||||
else()
|
||||
find_package(Libiw REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (ENABLE_PULSEAUDIO)
|
||||
find_package(LibPulse REQUIRED)
|
||||
set(PULSEAUDIO_VERSION ${LibPulse_VERSION})
|
||||
endif()
|
||||
|
||||
# xcomposite is required
|
||||
list(APPEND XORG_EXTENSIONS COMPOSITE)
|
||||
if (WITH_XKB)
|
||||
list(APPEND XORG_EXTENSIONS XKB)
|
||||
endif()
|
||||
if (WITH_XCURSOR)
|
||||
list(APPEND XORG_EXTENSIONS CURSOR)
|
||||
endif()
|
||||
if (WITH_XRM)
|
||||
list(APPEND XORG_EXTENSIONS XRM)
|
||||
endif()
|
||||
|
||||
# Set min xrandr version required
|
||||
if (WITH_XRANDR_MONITORS)
|
||||
set(XRANDR_VERSION "1.12")
|
||||
else ()
|
||||
set(XRANDR_VERSION "")
|
||||
endif()
|
||||
|
||||
# Randr is required. Searches for randr only because we may do a version check
|
||||
find_package(Xcb ${XRANDR_VERSION} REQUIRED COMPONENTS RANDR)
|
||||
find_package(Xcb REQUIRED COMPONENTS ${XORG_EXTENSIONS})
|
||||
|
||||
# FreeBSD Support
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
find_package(LibInotify REQUIRED)
|
||||
endif()
|
@ -1,3 +1,12 @@
|
||||
set(SPHINX_BUILD "sphinx-build" CACHE STRING "Name/Path of the sphinx-build executable to use.")
|
||||
set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build")
|
||||
|
||||
find_program(BIN_SPHINX "${SPHINX_BUILD}")
|
||||
|
||||
if(NOT BIN_SPHINX)
|
||||
message(FATAL_ERROR "sphinx-build executable '${SPHINX_BUILD}' not found.")
|
||||
endif()
|
||||
|
||||
separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}")
|
||||
|
||||
set(doc_path "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
@ -194,7 +194,5 @@ if(BUILD_POLYBAR_MSG)
|
||||
install(TARGETS polybar-msg
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
COMPONENT runtime)
|
||||
|
||||
endif()
|
||||
|
||||
# }}}
|
||||
|
Loading…
Reference in New Issue
Block a user