You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.3 KiB

9 years ago
cmake_minimum_required(VERSION 2.8.5)
project(sway C)
set(CMAKE_C_FLAGS "-g")
set(CMAKE_C_STANDARD 99)
9 years ago
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "bin/")
add_definitions("-Wall -Wextra -Wno-unused-parameter")
9 years ago
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMake)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
execute_process(
9 years ago
COMMAND git describe --always
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
SET(GIT_VERSION_FLAG "-DSWAY_GIT_VERSION=\"${GIT_COMMIT_HASH}\"")
add_definitions("${GIT_VERSION_FLAG}")
9 years ago
find_package(XKBCommon REQUIRED)
find_package(WLC REQUIRED)
find_package(A2X REQUIRED)
find_package(PCRE REQUIRED)
find_package(JsonC REQUIRED)
9 years ago
FILE(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c)
include_directories(
${WLC_INCLUDE_DIRS}
${PCRE_INCLUDE_DIRS}
${JSONC_INCLUDE_DIRS}
include/
9 years ago
)
add_executable(sway
${sources}
)
target_link_libraries(sway
${WLC_LIBRARIES}
${XKBCOMMON_LIBRARIES}
${PCRE_LIBRARIES}
${JSONC_LIBRARIES}
9 years ago
)
INSTALL(
TARGETS sway
RUNTIME DESTINATION bin
)
INSTALL(
FILES ${PROJECT_SOURCE_DIR}/config
DESTINATION /etc/sway/
)
9 years ago
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1
COMMAND ${A2X_COMMAND} --no-xmllint --doctype manpage --format manpage
9 years ago
-D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR}/sway.1.txt
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sway.1.txt
)
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5
COMMAND ${A2X_COMMAND} --no-xmllint --doctype manpage --format manpage
9 years ago
-D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR}/sway.5.txt
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sway.5.txt
)
ADD_CUSTOM_TARGET(man ALL
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1
DEPENDS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5)
INSTALL(
FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.1
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
9 years ago
)
INSTALL(
FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/sway.5
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man5
9 years ago
)
INSTALL(
FILES ${PROJECT_SOURCE_DIR}/sway.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/wayland-sessions/)
INSTALL(
FILES ${PROJECT_SOURCE_DIR}/sway-xorg.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/xsessions/)