summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-12-01 15:57:03 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-12-01 15:57:03 -0500
commitfc01f04c93c0de2a0cdcee946ac0131b86e18342 (patch)
tree204ba2fbc20298af8f159cd648c710b3a346135a
parentRemove build badge (Travis is broken, not sway) (diff)
parentcmake: remove extra space (diff)
downloadsway-fc01f04c93c0de2a0cdcee946ac0131b86e18342.tar.gz
sway-fc01f04c93c0de2a0cdcee946ac0131b86e18342.tar.zst
sway-fc01f04c93c0de2a0cdcee946ac0131b86e18342.zip
Merge pull request #287 from christophgysin/cmake
cmake: extract config from toplevel CMakeLists.txt
-rw-r--r--CMake/Manpage.cmake31
-rw-r--r--CMakeLists.txt84
-rw-r--r--sway/CMakeLists.txt48
-rw-r--r--swaybar/CMakeLists.txt12
-rw-r--r--swaybg/CMakeLists.txt12
-rw-r--r--swaygrab/CMakeLists.txt6
-rw-r--r--swaymsg/CMakeLists.txt6
7 files changed, 96 insertions, 103 deletions
diff --git a/CMake/Manpage.cmake b/CMake/Manpage.cmake
new file mode 100644
index 00000000..4842387e
--- /dev/null
+++ b/CMake/Manpage.cmake
@@ -0,0 +1,31 @@
1find_package(A2X REQUIRED)
2
3add_custom_target(man ALL)
4
5function(add_manpage name section)
6 add_custom_command(
7 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}
8 COMMAND ${A2X_COMMAND}
9 --no-xmllint
10 --doctype manpage
11 --format manpage
12 -D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
13 ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
14 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt
15 COMMENT Generating manpage for ${name}.${section}
16 )
17
18 add_custom_target(man-${name}.${section}
19 DEPENDS
20 ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section}
21 )
22 add_dependencies(man
23 man-${name}.${section}
24 )
25
26 install(
27 FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section}
28 DESTINATION share/man/man${section}
29 COMPONENT documentation
30 )
31endfunction()
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)
diff --git a/sway/CMakeLists.txt b/sway/CMakeLists.txt
new file mode 100644
index 00000000..1e2f3fd3
--- /dev/null
+++ b/sway/CMakeLists.txt
@@ -0,0 +1,48 @@
1find_package(XKBCommon REQUIRED)
2find_package(WLC REQUIRED)
3find_package(PCRE REQUIRED)
4find_package(Wayland REQUIRED)
5find_package(JsonC REQUIRED)
6
7include(Wayland)
8WAYLAND_ADD_PROTOCOL_SERVER(proto-desktop-shell
9 ${PROJECT_SOURCE_DIR}/protocols/desktop-shell.xml
10 desktop-shell
11)
12
13file(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c)
14file(GLOB common ${PROJECT_SOURCE_DIR}/common/*.c)
15
16include_directories(
17 ${WLC_INCLUDE_DIRS}
18 ${PCRE_INCLUDE_DIRS}
19 ${JSONC_INCLUDE_DIRS}
20 ${XKBCOMMON_INCLUDE_DIRS}
21 ${CMAKE_CURRENT_BINARY_DIR}
22)
23
24add_executable(sway
25 ${sources}
26 ${common}
27 ${proto-desktop-shell}
28)
29
30target_link_libraries(sway
31 ${WLC_LIBRARIES}
32 ${XKBCOMMON_LIBRARIES}
33 ${PCRE_LIBRARIES}
34 ${JSONC_LIBRARIES}
35 ${WAYLAND_SERVER_LIBRARIES}
36)
37
38install(
39 TARGETS sway
40 RUNTIME
41 DESTINATION bin
42 COMPONENT runtime
43)
44install(
45 FILES ${CMAKE_CURRENT_SOURCE_DIR}/config
46 DESTINATION ${FALLBACK_CONFIG_DIR}
47 COMPONENT configuration
48)
diff --git a/swaybar/CMakeLists.txt b/swaybar/CMakeLists.txt
index ea35134f..c14b5f75 100644
--- a/swaybar/CMakeLists.txt
+++ b/swaybar/CMakeLists.txt
@@ -1,16 +1,14 @@
1project(swaybar)
2
3find_package(Wayland REQUIRED) 1find_package(Wayland REQUIRED)
4find_package(Cairo REQUIRED) 2find_package(Cairo REQUIRED)
5find_package(Pango REQUIRED) 3find_package(Pango REQUIRED)
6 4
7include(Wayland) 5include(Wayland)
8WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell 6WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell
9 ${PROJECT_SOURCE_DIR}/../protocols/xdg-shell.xml 7 ../protocols/xdg-shell.xml
10 xdg-shell 8 xdg-shell
11) 9)
12WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell 10WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell
13 ${PROJECT_SOURCE_DIR}/../protocols/desktop-shell.xml 11 ../protocols/desktop-shell.xml
14 desktop-shell 12 desktop-shell
15) 13)
16 14
@@ -21,9 +19,9 @@ include_directories(
21 ${CMAKE_CURRENT_BINARY_DIR} 19 ${CMAKE_CURRENT_BINARY_DIR}
22) 20)
23 21
24file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) 22file(GLOB sources *.c)
25file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) 23file(GLOB common ../common/*.c)
26file(GLOB wl_sources ${PROJECT_SOURCE_DIR}/../wayland/*.c) 24file(GLOB wl_sources ../wayland/*.c)
27 25
28add_executable(swaybar 26add_executable(swaybar
29 ${sources} 27 ${sources}
diff --git a/swaybg/CMakeLists.txt b/swaybg/CMakeLists.txt
index 8016d959..9d3cc547 100644
--- a/swaybg/CMakeLists.txt
+++ b/swaybg/CMakeLists.txt
@@ -1,16 +1,14 @@
1project(swaybg)
2
3find_package(Wayland REQUIRED) 1find_package(Wayland REQUIRED)
4find_package(Cairo REQUIRED) 2find_package(Cairo REQUIRED)
5find_package(Pango REQUIRED) 3find_package(Pango REQUIRED)
6 4
7include(Wayland) 5include(Wayland)
8WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell 6WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell
9 ${PROJECT_SOURCE_DIR}/../protocols/xdg-shell.xml 7 ../protocols/xdg-shell.xml
10 xdg-shell 8 xdg-shell
11) 9)
12WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell 10WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell
13 ${PROJECT_SOURCE_DIR}/../protocols/desktop-shell.xml 11 ../protocols/desktop-shell.xml
14 desktop-shell 12 desktop-shell
15) 13)
16 14
@@ -21,9 +19,9 @@ include_directories(
21 ${CMAKE_CURRENT_BINARY_DIR} 19 ${CMAKE_CURRENT_BINARY_DIR}
22) 20)
23 21
24file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) 22file(GLOB sources *.c)
25file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) 23file(GLOB common ../common/*.c)
26file(GLOB wl_sources ${PROJECT_SOURCE_DIR}/../wayland/*.c) 24file(GLOB wl_sources ../wayland/*.c)
27 25
28add_executable(swaybg 26add_executable(swaybg
29 ${sources} 27 ${sources}
diff --git a/swaygrab/CMakeLists.txt b/swaygrab/CMakeLists.txt
index efe8986b..77d96412 100644
--- a/swaygrab/CMakeLists.txt
+++ b/swaygrab/CMakeLists.txt
@@ -1,7 +1,5 @@
1project(swaygrab) 1file(GLOB sources *.c)
2 2file(GLOB common ../common/*.c)
3file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c)
4file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c)
5 3
6add_executable(swaygrab 4add_executable(swaygrab
7 ${sources} 5 ${sources}
diff --git a/swaymsg/CMakeLists.txt b/swaymsg/CMakeLists.txt
index 2671dc2c..7616d942 100644
--- a/swaymsg/CMakeLists.txt
+++ b/swaymsg/CMakeLists.txt
@@ -1,7 +1,5 @@
1project(swaymsg) 1file(GLOB sources *.c)
2 2file(GLOB common ../common/*.c)
3file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c)
4file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c)
5 3
6add_executable(swaymsg 4add_executable(swaymsg
7 ${sources} 5 ${sources}