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-26 14:30:08 +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)
|
|
|
|
|
2016-10-24 23:46:26 +00:00
|
|
|
configure_file(
|
|
|
|
${PROJECT_SOURCE_DIR}/include/config.hpp.cmake
|
|
|
|
${CMAKE_SOURCE_DIR}/include/config.hpp
|
|
|
|
ESCAPE_QUOTES @ONLY)
|
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
# Generate source tree {{{
|
|
|
|
|
|
|
|
file(GLOB_RECURSE SOURCES RELATIVE ${PROJECT_SOURCE_DIR}/src *.c[p]*)
|
2016-11-03 18:01:45 +00:00
|
|
|
|
|
|
|
if(NOT ENABLE_ALSA)
|
|
|
|
list(REMOVE_ITEM SOURCES adapters/alsa.cpp modules/volume.cpp)
|
|
|
|
endif()
|
|
|
|
if(NOT ENABLE_MPD)
|
|
|
|
list(REMOVE_ITEM SOURCES adapters/mpd.cpp modules/mpd.cpp)
|
|
|
|
endif()
|
|
|
|
if(NOT ENABLE_NETWORK)
|
|
|
|
list(REMOVE_ITEM SOURCES adapters/net.cpp modules/network.cpp)
|
|
|
|
endif()
|
|
|
|
if(NOT ENABLE_I3)
|
|
|
|
list(REMOVE_ITEM SOURCES modules/i3.cpp utils/i3.cpp)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
2016-11-20 22:04:31 +00:00
|
|
|
# Locate dependencies {{{
|
2016-10-24 23:46:26 +00:00
|
|
|
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
find_package(Boost REQUIRED)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
find_package(X11 REQUIRED COMPONENTS Xft Xutil)
|
|
|
|
find_package(X11_XCB REQUIRED)
|
|
|
|
find_package(PkgConfig)
|
|
|
|
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
|
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${BOOST_LIBRARIES})
|
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
set(APP_LIBRARIES ${APP_LIBRARIES} ${X11_Xft_LIB})
|
|
|
|
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${BOOST_INCLUDE_DIR})
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${FONTCONFIG_INCLUDE_DIRS})
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/include)
|
|
|
|
set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/lib/boost/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})
|
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)
|
|
|
|
if(ENABLE_RANDR_EXT)
|
|
|
|
set(XCB_PROTOS "${XCB_PROTOS}" randr)
|
|
|
|
endif()
|
|
|
|
if(ENABLE_RENDER_EXT)
|
|
|
|
set(XCB_PROTOS "${XCB_PROTOS}" render)
|
|
|
|
endif()
|
|
|
|
if(ENABLE_DAMAGE_EXT)
|
|
|
|
set(XCB_PROTOS "${XCB_PROTOS}" damage)
|
|
|
|
endif()
|
2016-10-24 23:46:26 +00:00
|
|
|
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/xpp ${PROJECT_BINARY_DIR}/lib/xpp)
|
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-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-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-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-10-24 23:46:26 +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
|
|
|
|
2016-11-20 22:04:31 +00:00
|
|
|
target_compile_definitions(${PROJECT_NAME} PUBLIC
|
|
|
|
${X11_XCB_DEFINITIONS}
|
|
|
|
${XCB_DEFINITIONS})
|
|
|
|
|
|
|
|
# }}}
|
2016-10-24 23:46:26 +00:00
|
|
|
# Export target details {{{
|
|
|
|
|
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-10-24 23:46:26 +00:00
|
|
|
# }}}
|