diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-12-01 15:57:03 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-12-01 15:57:03 -0500 |
commit | fc01f04c93c0de2a0cdcee946ac0131b86e18342 (patch) | |
tree | 204ba2fbc20298af8f159cd648c710b3a346135a | |
parent | Remove build badge (Travis is broken, not sway) (diff) | |
parent | cmake: remove extra space (diff) | |
download | sway-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.cmake | 31 | ||||
-rw-r--r-- | CMakeLists.txt | 84 | ||||
-rw-r--r-- | sway/CMakeLists.txt | 48 | ||||
-rw-r--r-- | swaybar/CMakeLists.txt | 12 | ||||
-rw-r--r-- | swaybg/CMakeLists.txt | 12 | ||||
-rw-r--r-- | swaygrab/CMakeLists.txt | 6 | ||||
-rw-r--r-- | swaymsg/CMakeLists.txt | 6 |
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 @@ | |||
1 | find_package(A2X REQUIRED) | ||
2 | |||
3 | add_custom_target(man ALL) | ||
4 | |||
5 | function(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 | ) | ||
31 | endfunction() | ||
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 | ||
44 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) | 44 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) |
45 | 45 | ||
46 | add_subdirectory(sway) | ||
46 | add_subdirectory(swaybg) | 47 | add_subdirectory(swaybg) |
47 | add_subdirectory(swaymsg) | 48 | add_subdirectory(swaymsg) |
48 | add_subdirectory(swaygrab) | 49 | add_subdirectory(swaygrab) |
49 | add_subdirectory(swaybar) | 50 | add_subdirectory(swaybar) |
50 | 51 | ||
51 | find_package(XKBCommon REQUIRED) | 52 | include(Manpage) |
52 | find_package(WLC REQUIRED) | ||
53 | find_package(A2X REQUIRED) | ||
54 | find_package(PCRE REQUIRED) | ||
55 | find_package(Wayland REQUIRED) | ||
56 | find_package(JsonC REQUIRED) | ||
57 | |||
58 | file(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c) | ||
59 | file(GLOB common ${PROJECT_SOURCE_DIR}/common/*.c) | ||
60 | |||
61 | include(Wayland) | ||
62 | WAYLAND_ADD_PROTOCOL_SERVER(proto-desktop-shell | ||
63 | ${PROJECT_SOURCE_DIR}/protocols/desktop-shell.xml | ||
64 | desktop-shell | ||
65 | ) | ||
66 | |||
67 | include_directories( | ||
68 | ${WLC_INCLUDE_DIRS} | ||
69 | ${PCRE_INCLUDE_DIRS} | ||
70 | ${JSONC_INCLUDE_DIRS} | ||
71 | ${XKBCOMMON_INCLUDE_DIRS} | ||
72 | ${CMAKE_CURRENT_BINARY_DIR} | ||
73 | ) | ||
74 | |||
75 | add_executable(sway | ||
76 | ${sources} | ||
77 | ${common} | ||
78 | ${proto-desktop-shell} | ||
79 | ) | ||
80 | |||
81 | target_link_libraries(sway | ||
82 | ${WLC_LIBRARIES} | ||
83 | ${XKBCOMMON_LIBRARIES} | ||
84 | ${PCRE_LIBRARIES} | ||
85 | ${JSONC_LIBRARIES} | ||
86 | ${WAYLAND_SERVER_LIBRARIES} | ||
87 | ) | ||
88 | |||
89 | install( | ||
90 | TARGETS sway | ||
91 | RUNTIME | ||
92 | DESTINATION bin | ||
93 | COMPONENT runtime | ||
94 | ) | ||
95 | install( | ||
96 | FILES ${CMAKE_CURRENT_SOURCE_DIR}/config | ||
97 | DESTINATION ${FALLBACK_CONFIG_DIR} | ||
98 | COMPONENT configuration | ||
99 | ) | ||
100 | |||
101 | add_custom_target(man ALL) | ||
102 | |||
103 | function(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 | ) | ||
129 | endfunction() | ||
130 | |||
131 | add_manpage(sway 1) | 53 | add_manpage(sway 1) |
132 | add_manpage(sway 5) | 54 | add_manpage(sway 5) |
133 | add_manpage(swaymsg 1) | 55 | add_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 @@ | |||
1 | find_package(XKBCommon REQUIRED) | ||
2 | find_package(WLC REQUIRED) | ||
3 | find_package(PCRE REQUIRED) | ||
4 | find_package(Wayland REQUIRED) | ||
5 | find_package(JsonC REQUIRED) | ||
6 | |||
7 | include(Wayland) | ||
8 | WAYLAND_ADD_PROTOCOL_SERVER(proto-desktop-shell | ||
9 | ${PROJECT_SOURCE_DIR}/protocols/desktop-shell.xml | ||
10 | desktop-shell | ||
11 | ) | ||
12 | |||
13 | file(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c) | ||
14 | file(GLOB common ${PROJECT_SOURCE_DIR}/common/*.c) | ||
15 | |||
16 | include_directories( | ||
17 | ${WLC_INCLUDE_DIRS} | ||
18 | ${PCRE_INCLUDE_DIRS} | ||
19 | ${JSONC_INCLUDE_DIRS} | ||
20 | ${XKBCOMMON_INCLUDE_DIRS} | ||
21 | ${CMAKE_CURRENT_BINARY_DIR} | ||
22 | ) | ||
23 | |||
24 | add_executable(sway | ||
25 | ${sources} | ||
26 | ${common} | ||
27 | ${proto-desktop-shell} | ||
28 | ) | ||
29 | |||
30 | target_link_libraries(sway | ||
31 | ${WLC_LIBRARIES} | ||
32 | ${XKBCOMMON_LIBRARIES} | ||
33 | ${PCRE_LIBRARIES} | ||
34 | ${JSONC_LIBRARIES} | ||
35 | ${WAYLAND_SERVER_LIBRARIES} | ||
36 | ) | ||
37 | |||
38 | install( | ||
39 | TARGETS sway | ||
40 | RUNTIME | ||
41 | DESTINATION bin | ||
42 | COMPONENT runtime | ||
43 | ) | ||
44 | install( | ||
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 @@ | |||
1 | project(swaybar) | ||
2 | |||
3 | find_package(Wayland REQUIRED) | 1 | find_package(Wayland REQUIRED) |
4 | find_package(Cairo REQUIRED) | 2 | find_package(Cairo REQUIRED) |
5 | find_package(Pango REQUIRED) | 3 | find_package(Pango REQUIRED) |
6 | 4 | ||
7 | include(Wayland) | 5 | include(Wayland) |
8 | WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell | 6 | WAYLAND_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 | ) |
12 | WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell | 10 | WAYLAND_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 | ||
24 | file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) | 22 | file(GLOB sources *.c) |
25 | file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) | 23 | file(GLOB common ../common/*.c) |
26 | file(GLOB wl_sources ${PROJECT_SOURCE_DIR}/../wayland/*.c) | 24 | file(GLOB wl_sources ../wayland/*.c) |
27 | 25 | ||
28 | add_executable(swaybar | 26 | add_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 @@ | |||
1 | project(swaybg) | ||
2 | |||
3 | find_package(Wayland REQUIRED) | 1 | find_package(Wayland REQUIRED) |
4 | find_package(Cairo REQUIRED) | 2 | find_package(Cairo REQUIRED) |
5 | find_package(Pango REQUIRED) | 3 | find_package(Pango REQUIRED) |
6 | 4 | ||
7 | include(Wayland) | 5 | include(Wayland) |
8 | WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell | 6 | WAYLAND_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 | ) |
12 | WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell | 10 | WAYLAND_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 | ||
24 | file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) | 22 | file(GLOB sources *.c) |
25 | file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) | 23 | file(GLOB common ../common/*.c) |
26 | file(GLOB wl_sources ${PROJECT_SOURCE_DIR}/../wayland/*.c) | 24 | file(GLOB wl_sources ../wayland/*.c) |
27 | 25 | ||
28 | add_executable(swaybg | 26 | add_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 @@ | |||
1 | project(swaygrab) | 1 | file(GLOB sources *.c) |
2 | 2 | file(GLOB common ../common/*.c) | |
3 | file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) | ||
4 | file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) | ||
5 | 3 | ||
6 | add_executable(swaygrab | 4 | add_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 @@ | |||
1 | project(swaymsg) | 1 | file(GLOB sources *.c) |
2 | 2 | file(GLOB common ../common/*.c) | |
3 | file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) | ||
4 | file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) | ||
5 | 3 | ||
6 | add_executable(swaymsg | 4 | add_executable(swaymsg |
7 | ${sources} | 5 | ${sources} |