2016-06-15 03:32:35 +00:00
|
|
|
#
|
2016-11-20 22:04:31 +00:00
|
|
|
# Create executable
|
2016-06-15 03:32:35 +00:00
|
|
|
#
|
2016-05-19 14:41:06 +00:00
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
file(GLOB_RECURSE SOURCES RELATIVE ${PROJECT_SOURCE_DIR}/src *.c[p]*)
|
2017-01-10 01:09:27 +00:00
|
|
|
list(REMOVE_ITEM SOURCES ipc.cpp)
|
2016-11-03 18:01:45 +00:00
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
# Locate dependencies {{{
|
2016-10-24 23:46:26 +00:00
|
|
|
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
2017-01-19 04:38:42 +00:00
|
|
|
find_package(PkgConfig)
|
2016-10-24 23:46:26 +00:00
|
|
|
find_package(Threads REQUIRED)
|
2017-01-19 04:38:42 +00:00
|
|
|
pkg_check_modules(CAIRO REQUIRED cairo-fc)
|
2016-10-24 23:46:26 +00:00
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
2017-01-19 04:38:42 +00:00
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${CAIRO_LIBRARIES})
|
2016-11-20 22:04:31 +00:00
|
|
|
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/include)
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/lib/concurrentqueue/include)
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
|
2017-01-19 04:38:42 +00:00
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${CAIRO_INCLUDE_DIRS})
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-10-24 23:46:26 +00:00
|
|
|
# xpp library
|
2016-11-02 19:22:45 +00:00
|
|
|
set(XCB_PROTOS xproto)
|
2016-11-30 11:46:26 +00:00
|
|
|
if(WITH_XRANDR)
|
2017-01-13 03:13:44 +00:00
|
|
|
if(ENABLE_XRANDR_MONITORS)
|
2017-01-25 19:16:02 +00:00
|
|
|
pkg_check_modules(XRANDR REQUIRED xrandr>=1.5.0 randrproto>=1.5.0 xcb-proto>=1.12)
|
2017-01-13 03:13:44 +00:00
|
|
|
endif()
|
2016-11-02 19:22:45 +00:00
|
|
|
set(XCB_PROTOS "${XCB_PROTOS}" randr)
|
2016-11-30 09:06:16 +00:00
|
|
|
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::randr::extension)
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
2016-12-21 13:55:19 +00:00
|
|
|
list(REMOVE_ITEM SOURCES x11/extensions/randr.cpp)
|
2016-11-02 19:22:45 +00:00
|
|
|
endif()
|
2016-11-30 11:46:26 +00:00
|
|
|
if(WITH_XRENDER)
|
2016-11-02 19:22:45 +00:00
|
|
|
set(XCB_PROTOS "${XCB_PROTOS}" render)
|
2016-11-30 09:06:16 +00:00
|
|
|
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::render::extension)
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
2016-12-21 13:55:19 +00:00
|
|
|
list(REMOVE_ITEM SOURCES x11/extensions/render.cpp)
|
2016-11-02 19:22:45 +00:00
|
|
|
endif()
|
2016-11-30 11:46:26 +00:00
|
|
|
if(WITH_XDAMAGE)
|
2016-11-02 19:22:45 +00:00
|
|
|
set(XCB_PROTOS "${XCB_PROTOS}" damage)
|
2016-11-30 09:06:16 +00:00
|
|
|
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::damage::extension)
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
2016-12-21 13:55:19 +00:00
|
|
|
list(REMOVE_ITEM SOURCES x11/extensions/damage.cpp)
|
2016-11-02 19:22:45 +00:00
|
|
|
endif()
|
2016-11-30 11:46:26 +00:00
|
|
|
if(WITH_XSYNC)
|
2016-11-26 14:42:48 +00:00
|
|
|
set(XCB_PROTOS "${XCB_PROTOS}" sync)
|
2016-11-30 09:06:16 +00:00
|
|
|
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::sync::extension)
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
2016-12-21 13:55:19 +00:00
|
|
|
list(REMOVE_ITEM SOURCES x11/extensions/sync.cpp)
|
2016-11-26 14:42:48 +00:00
|
|
|
endif()
|
2016-11-30 11:46:26 +00:00
|
|
|
if(WITH_XCOMPOSITE)
|
2016-11-26 14:42:48 +00:00
|
|
|
set(XCB_PROTOS "${XCB_PROTOS}" composite)
|
2016-11-30 09:06:16 +00:00
|
|
|
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::composite::extension)
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
2016-12-21 13:55:19 +00:00
|
|
|
list(REMOVE_ITEM SOURCES x11/extensions/composite.cpp)
|
2016-11-30 09:06:16 +00:00
|
|
|
endif()
|
2016-11-30 11:46:26 +00:00
|
|
|
if(WITH_XKB)
|
2016-11-30 09:06:16 +00:00
|
|
|
set(XCB_PROTOS "${XCB_PROTOS}" xkb)
|
|
|
|
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::xkb::extension)
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
2016-12-21 13:55:19 +00:00
|
|
|
list(REMOVE_ITEM SOURCES x11/extensions/xkb.cpp modules/xkeyboard.cpp)
|
2016-11-26 14:42:48 +00:00
|
|
|
endif()
|
2017-01-20 01:25:54 +00:00
|
|
|
if(WITH_XRM)
|
|
|
|
pkg_check_modules(XCB_UTIL_XRM REQUIRED xcb-xrm)
|
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${XCB_UTIL_XRM_LIBRARIES})
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${XCB_UTIL_XRM_INCLUDE_DIRS})
|
|
|
|
endif()
|
2016-11-30 09:06:16 +00:00
|
|
|
|
|
|
|
string(REPLACE ";" ", " XPP_EXTENSION_LIST "${XPP_EXTENSION_LIST}")
|
|
|
|
|
2016-10-24 23:46:26 +00:00
|
|
|
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/xpp ${PROJECT_BINARY_DIR}/lib/xpp)
|
2016-11-30 09:06:16 +00:00
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${XPP_LIBRARIES})
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${XPP_INCLUDE_DIRS})
|
2016-10-24 23:46:26 +00:00
|
|
|
|
|
|
|
# }}}
|
|
|
|
# Optional dependency: alsalib {{{
|
|
|
|
|
|
|
|
if(ENABLE_ALSA)
|
|
|
|
find_package(ALSA REQUIRED)
|
2016-11-20 22:04:31 +00:00
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${ALSA_LIBRARY})
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${ALSA_INCLUDE_DIR})
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
|
|
|
list(REMOVE_ITEM SOURCES adapters/alsa/mixer.cpp adapters/alsa/control.cpp modules/volume.cpp)
|
2016-10-24 23:46:26 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
# Optional dependency: libmpdclient {{{
|
|
|
|
|
|
|
|
if(ENABLE_MPD)
|
|
|
|
find_package(LibMPDClient REQUIRED)
|
2016-11-20 22:04:31 +00:00
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${LIBMPDCLIENT_LIBRARY})
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${LIBMPDCLIENT_INCLUDE_DIR})
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
|
|
|
list(REMOVE_ITEM SOURCES adapters/mpd.cpp modules/mpd.cpp)
|
2016-10-24 23:46:26 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
# Optional dependency: libiw {{{
|
|
|
|
|
|
|
|
if(ENABLE_NETWORK)
|
|
|
|
find_package(Libiw REQUIRED)
|
2016-11-20 22:04:31 +00:00
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${LIBIW_LIBRARY})
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${LIBIW_INCLUDE_DIR})
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
|
|
|
list(REMOVE_ITEM SOURCES adapters/net.cpp modules/network.cpp)
|
2016-10-24 23:46:26 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
# Optional dependency: i3ipcpp {{{
|
|
|
|
|
|
|
|
if(ENABLE_I3)
|
|
|
|
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/i3ipcpp ${PROJECT_BINARY_DIR}/lib/i3ipcpp)
|
2016-11-20 22:04:31 +00:00
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${I3IPCPP_LIBRARIES})
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${I3IPCPP_INCLUDE_DIRS})
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
|
|
|
list(REMOVE_ITEM SOURCES modules/i3.cpp utils/i3.cpp)
|
2016-10-24 23:46:26 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
2016-12-20 04:05:43 +00:00
|
|
|
# Optional dependency: libcurl {{{
|
2016-12-19 21:01:37 +00:00
|
|
|
|
|
|
|
if(ENABLE_CURL)
|
|
|
|
find_package(CURL REQUIRED)
|
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${CURL_LIBRARY})
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${CURL_INCLUDE_DIR})
|
2016-12-20 04:05:43 +00:00
|
|
|
else()
|
|
|
|
list(REMOVE_ITEM SOURCES utils/http.cpp modules/github.cpp)
|
2016-12-19 21:01:37 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
# Create executable target {{{
|
|
|
|
|
|
|
|
make_executable(${PROJECT_NAME} SOURCES
|
|
|
|
${SOURCES}
|
|
|
|
INCLUDE_DIRS
|
|
|
|
${APP_INCLUDE_DIRS}
|
|
|
|
RAW_DEPENDS
|
|
|
|
${APP_LIBRARIES})
|
|
|
|
|
|
|
|
target_link_libraries(${PROJECT_NAME} Threads::Threads)
|
2016-10-24 23:46:26 +00:00
|
|
|
|
2017-01-13 00:05:09 +00:00
|
|
|
target_compile_options(${PROJECT_NAME} PUBLIC
|
2017-01-24 07:49:27 +00:00
|
|
|
$<$<CXX_COMPILER_ID:GNU>:$<$<CONFIG:MinSizeRel>:-flto>>)
|
2016-11-20 22:04:31 +00:00
|
|
|
|
|
|
|
# }}}
|
2017-01-10 01:09:27 +00:00
|
|
|
# Create executable target: ipc messager {{{
|
|
|
|
|
|
|
|
if(BUILD_IPC_MSG)
|
2017-01-25 16:07:55 +00:00
|
|
|
make_executable(${PROJECT_NAME}-msg SOURCES ipc.cpp utils/env.cpp utils/file.cpp)
|
2017-01-13 12:17:11 +00:00
|
|
|
target_compile_options(${PROJECT_NAME}-msg PUBLIC
|
|
|
|
$<$<CXX_COMPILER_ID:GNU>:$<$<CONFIG:MinSizeRel>:-flto>>)
|
2017-01-10 01:09:27 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
2016-10-24 23:46:26 +00:00
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
set(APP_BINARY ${PROJECT_SOURCE_DIR}/bin/${PROJECT_NAME} PARENT_SCOPE)
|
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} PARENT_SCOPE)
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} PARENT_SCOPE)
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-30 09:06:16 +00:00
|
|
|
execute_process(COMMAND git describe --tags --dirty=-git
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE APP_VERSION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
|
|
|
|
|
|
|
configure_file(
|
2017-01-11 02:07:28 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/include/settings.hpp.cmake
|
|
|
|
${CMAKE_SOURCE_DIR}/include/settings.hpp
|
2016-11-30 09:06:16 +00:00
|
|
|
ESCAPE_QUOTES @ONLY)
|