2016-06-15 03:32:35 +00:00
|
|
|
#
|
|
|
|
# Create library and executable
|
|
|
|
#
|
2016-05-19 14:41:06 +00:00
|
|
|
|
2016-10-24 23:46:26 +00:00
|
|
|
set(BINARY_NAME ${PROJECT_NAME})
|
|
|
|
set(LIBRARY_NAME lib${PROJECT_NAME})
|
2016-05-19 14:41:06 +00:00
|
|
|
|
2016-10-24 23:46:26 +00:00
|
|
|
file(GLOB_RECURSE HEADERS RELATIVE ${PROJECT_SOURCE_DIR}/include *.h[p]*)
|
|
|
|
file(GLOB_RECURSE SOURCES RELATIVE ${PROJECT_SOURCE_DIR}/src *.c[p]*)
|
|
|
|
list(REMOVE_ITEM SOURCES main.cpp)
|
2016-05-24 02:36:55 +00:00
|
|
|
|
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)
|
|
|
|
|
|
|
|
# Target: main library {{{
|
|
|
|
|
|
|
|
make_library(${LIBRARY_NAME} STATIC
|
2016-06-15 03:32:35 +00:00
|
|
|
HEADER_INSTALL_DIR
|
2016-10-24 23:46:26 +00:00
|
|
|
${PROJECT_NAME}
|
2016-06-15 03:32:35 +00:00
|
|
|
HEADERS
|
2016-10-24 23:46:26 +00:00
|
|
|
${HEADERS}
|
2016-06-15 03:32:35 +00:00
|
|
|
SOURCES
|
2016-10-24 23:46:26 +00:00
|
|
|
${SOURCES})
|
|
|
|
|
|
|
|
target_include_directories(${LIBRARY_NAME}_static PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
# Target: main executable {{{
|
2016-05-19 14:41:06 +00:00
|
|
|
|
2016-10-24 23:46:26 +00:00
|
|
|
make_executable(${BINARY_NAME}
|
2016-06-15 03:32:35 +00:00
|
|
|
SOURCES main.cpp
|
2016-10-24 23:46:26 +00:00
|
|
|
TARGET_DEPENDS ${LIBRARY_NAME}_static)
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-10-24 23:46:26 +00:00
|
|
|
# }}}
|
|
|
|
|
|
|
|
# Link dependencies {{{
|
|
|
|
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
|
|
|
|
|
|
find_package(Boost REQUIRED)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
find_package(Freetype REQUIRED Freetype2)
|
|
|
|
find_package(X11 REQUIRED COMPONENTS Xft Xutil)
|
|
|
|
find_package(X11_XCB REQUIRED)
|
|
|
|
|
|
|
|
find_package(PkgConfig)
|
|
|
|
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
|
|
|
|
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${BOOST_LIBRARIES})
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC Threads::Threads)
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${X11_LIBRARIES})
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${X11_X11_LIB})
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${X11_XCB_LIB})
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${X11_Xft_LIB})
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${FREETYPE_LIBRARIES})
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${FONTCONFIG_LIBRARIES})
|
|
|
|
|
|
|
|
target_include_directories(${LIBRARY_NAME}_static PUBLIC ${BOOST_INCLUDE_DIR})
|
|
|
|
target_include_directories(${LIBRARY_NAME}_static PUBLIC ${FONTCONFIG_INCLUDE_DIRS})
|
|
|
|
target_include_directories(${LIBRARY_NAME}_static PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
|
|
|
target_include_directories(${LIBRARY_NAME}_static PUBLIC ${PROJECT_SOURCE_DIR}/lib/boost/include)
|
2016-10-29 04:48:51 +00:00
|
|
|
target_include_directories(${LIBRARY_NAME}_static PUBLIC ${PROJECT_SOURCE_DIR}/lib/concurrentqueue/include)
|
2016-10-24 23:46:26 +00:00
|
|
|
|
|
|
|
target_compile_definitions(${BINARY_NAME} PUBLIC
|
2016-06-15 03:32:35 +00:00
|
|
|
${X11_XCB_DEFINITIONS}
|
|
|
|
${XCB_DEFINITIONS})
|
|
|
|
|
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)
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${XPP_LIBRARIES})
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
# Optional dependency: alsalib {{{
|
|
|
|
|
|
|
|
if(ENABLE_ALSA)
|
|
|
|
find_package(ALSA REQUIRED)
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${ALSA_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
# Optional dependency: libmpdclient {{{
|
|
|
|
|
|
|
|
if(ENABLE_MPD)
|
|
|
|
find_package(LibMPDClient REQUIRED)
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${LIBMPDCLIENT_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
# Optional dependency: libiw {{{
|
|
|
|
|
|
|
|
if(ENABLE_NETWORK)
|
|
|
|
find_package(Libiw REQUIRED)
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${LIBIW_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
# Optional dependency: i3ipcpp {{{
|
|
|
|
|
|
|
|
if(ENABLE_I3)
|
|
|
|
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/i3ipcpp ${PROJECT_BINARY_DIR}/lib/i3ipcpp)
|
|
|
|
target_include_directories(${LIBRARY_NAME}_static PUBLIC ${I3IPCPP_INCLUDE_DIRS})
|
|
|
|
target_link_libraries(${LIBRARY_NAME}_static PUBLIC ${I3IPCPP_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
# Export target details {{{
|
|
|
|
|
|
|
|
set(APP_BINARY ${PROJECT_SOURCE_DIR}/bin/${BINARY_NAME} PARENT_SCOPE)
|
|
|
|
set(APP_LIBRARIES ${LIBRARY_NAME}_static ${XPP_LIBRARY} PARENT_SCOPE)
|
|
|
|
set(APP_INCLUDE_DIRS
|
|
|
|
${PROJECT_SOURCE_DIR}/include
|
|
|
|
${PROJECT_SOURCE_DIR}/lib/boost/include
|
2016-10-29 04:48:51 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/lib/concurrentqueue/include
|
2016-10-24 23:46:26 +00:00
|
|
|
${XPP_INCLUDE_DIRS}
|
|
|
|
PARENT_SCOPE)
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-10-24 23:46:26 +00:00
|
|
|
# }}}
|