aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt84
1 files changed, 3 insertions, 81 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 48f03e2e..b9a2e37d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
28 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 28 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
29 ) 29 )
30 execute_process( 30 execute_process(
31 COMMAND git rev-parse --abbrev-ref HEAD 31 COMMAND git rev-parse --abbrev-ref HEAD
32 OUTPUT_VARIABLE GIT_BRANCH 32 OUTPUT_VARIABLE GIT_BRANCH
33 OUTPUT_STRIP_TRAILING_WHITESPACE 33 OUTPUT_STRIP_TRAILING_WHITESPACE
34 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 34 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -43,91 +43,13 @@ add_definitions(-DSWAY_VERSION_DATE=\"${CURRENT_DATE}\")
43 43
44include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) 44include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
45 45
46add_subdirectory(sway)
46add_subdirectory(swaybg) 47add_subdirectory(swaybg)
47add_subdirectory(swaymsg) 48add_subdirectory(swaymsg)
48add_subdirectory(swaygrab) 49add_subdirectory(swaygrab)
49add_subdirectory(swaybar) 50add_subdirectory(swaybar)
50 51
51find_package(XKBCommon REQUIRED) 52include(Manpage)
52find_package(WLC REQUIRED)
53find_package(A2X REQUIRED)
54find_package(PCRE REQUIRED)
55find_package(Wayland REQUIRED)
56find_package(JsonC REQUIRED)
57
58file(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c)
59file(GLOB common ${PROJECT_SOURCE_DIR}/common/*.c)
60
61include(Wayland)
62WAYLAND_ADD_PROTOCOL_SERVER(proto-desktop-shell
63 ${PROJECT_SOURCE_DIR}/protocols/desktop-shell.xml
64 desktop-shell
65)
66
67include_directories(
68 ${WLC_INCLUDE_DIRS}
69 ${PCRE_INCLUDE_DIRS}
70 ${JSONC_INCLUDE_DIRS}
71 ${XKBCOMMON_INCLUDE_DIRS}
72 ${CMAKE_CURRENT_BINARY_DIR}
73)
74
75add_executable(sway
76 ${sources}
77 ${common}
78 ${proto-desktop-shell}
79)
80
81target_link_libraries(sway
82 ${WLC_LIBRARIES}
83 ${XKBCOMMON_LIBRARIES}
84 ${PCRE_LIBRARIES}
85 ${JSONC_LIBRARIES}
86 ${WAYLAND_SERVER_LIBRARIES}
87)
88
89install(
90 TARGETS sway
91 RUNTIME
92 DESTINATION bin
93 COMPONENT runtime
94)
95install(
96 FILES ${CMAKE_CURRENT_SOURCE_DIR}/config
97 DESTINATION ${FALLBACK_CONFIG_DIR}
98 COMPONENT configuration
99)
100
101add_custom_target(man ALL)
102
103function(add_manpage name section)
104 add_custom_command(
105 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}
106 COMMAND ${A2X_COMMAND}
107 --no-xmllint
108 --doctype manpage
109 --format manpage
110 -D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
111 ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
112 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
113 COMMENT Generating manpage for ${name}.${section}
114 )
115
116 add_custom_target(man-${name}.${section}
117 DEPENDS
118 ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}
119 )
120 add_dependencies(man
121 man-${name}.${section}
122 )
123
124 install(
125 FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
126 DESTINATION share/man/man${section}
127 COMPONENT documentation
128 )
129endfunction()
130
131add_manpage(sway 1) 53add_manpage(sway 1)
132add_manpage(sway 5) 54add_manpage(sway 5)
133add_manpage(swaymsg 1) 55add_manpage(swaymsg 1)