From 4277070a7b92b5aad7c08beb876f7460fe268f60 Mon Sep 17 00:00:00 2001 From: Christoph Gysin Date: Tue, 1 Dec 2015 22:22:39 +0200 Subject: [PATCH 1/4] cmake: extract add_manpage() --- CMake/Manpage.cmake | 31 +++++++++++++++++++++++++++++++ CMakeLists.txt | 32 +------------------------------- 2 files changed, 32 insertions(+), 31 deletions(-) create mode 100644 CMake/Manpage.cmake 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 @@ +find_package(A2X REQUIRED) + +add_custom_target(man ALL) + +function(add_manpage name section) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section} + COMMAND ${A2X_COMMAND} + --no-xmllint + --doctype manpage + --format manpage + -D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt + COMMENT Generating manpage for ${name}.${section} + ) + + add_custom_target(man-${name}.${section} + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section} + ) + add_dependencies(man + man-${name}.${section} + ) + + install( + FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} + DESTINATION share/man/man${section} + COMPONENT documentation + ) +endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index 48f03e2e..4d828153 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,6 @@ add_subdirectory(swaybar) find_package(XKBCommon REQUIRED) find_package(WLC REQUIRED) -find_package(A2X REQUIRED) find_package(PCRE REQUIRED) find_package(Wayland REQUIRED) find_package(JsonC REQUIRED) @@ -98,36 +97,7 @@ install( COMPONENT configuration ) -add_custom_target(man ALL) - -function(add_manpage name section) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section} - COMMAND ${A2X_COMMAND} - --no-xmllint - --doctype manpage - --format manpage - -D ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.${section}.txt - COMMENT Generating manpage for ${name}.${section} - ) - - add_custom_target(man-${name}.${section} - DEPENDS - ${CMAKE_CURRENT_BINARY_DIR}/${name}.${section} - ) - add_dependencies(man - man-${name}.${section} - ) - - install( - FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name}.${section} - DESTINATION share/man/man${section} - COMPONENT documentation - ) -endfunction() - +include(Manpage) add_manpage(sway 1) add_manpage(sway 5) add_manpage(swaymsg 1) From 92a353838172c1a6d73a6ee092b346b2f14ca7cc Mon Sep 17 00:00:00 2001 From: Christoph Gysin Date: Tue, 1 Dec 2015 22:25:22 +0200 Subject: [PATCH 2/4] cmake: extract sway --- CMakeLists.txt | 50 +-------------------------------------------- sway/CMakeLists.txt | 48 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) create mode 100644 sway/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d828153..dcb52c0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,60 +43,12 @@ add_definitions(-DSWAY_VERSION_DATE=\"${CURRENT_DATE}\") include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +add_subdirectory(sway) add_subdirectory(swaybg) add_subdirectory(swaymsg) add_subdirectory(swaygrab) add_subdirectory(swaybar) -find_package(XKBCommon REQUIRED) -find_package(WLC REQUIRED) -find_package(PCRE REQUIRED) -find_package(Wayland REQUIRED) -find_package(JsonC REQUIRED) - -file(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c) -file(GLOB common ${PROJECT_SOURCE_DIR}/common/*.c) - -include(Wayland) -WAYLAND_ADD_PROTOCOL_SERVER(proto-desktop-shell - ${PROJECT_SOURCE_DIR}/protocols/desktop-shell.xml - desktop-shell -) - -include_directories( - ${WLC_INCLUDE_DIRS} - ${PCRE_INCLUDE_DIRS} - ${JSONC_INCLUDE_DIRS} - ${XKBCOMMON_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} -) - -add_executable(sway - ${sources} - ${common} - ${proto-desktop-shell} -) - -target_link_libraries(sway - ${WLC_LIBRARIES} - ${XKBCOMMON_LIBRARIES} - ${PCRE_LIBRARIES} - ${JSONC_LIBRARIES} - ${WAYLAND_SERVER_LIBRARIES} -) - -install( - TARGETS sway - RUNTIME - DESTINATION bin - COMPONENT runtime -) -install( - FILES ${CMAKE_CURRENT_SOURCE_DIR}/config - DESTINATION ${FALLBACK_CONFIG_DIR} - COMPONENT configuration -) - include(Manpage) add_manpage(sway 1) add_manpage(sway 5) 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 @@ +find_package(XKBCommon REQUIRED) +find_package(WLC REQUIRED) +find_package(PCRE REQUIRED) +find_package(Wayland REQUIRED) +find_package(JsonC REQUIRED) + +include(Wayland) +WAYLAND_ADD_PROTOCOL_SERVER(proto-desktop-shell + ${PROJECT_SOURCE_DIR}/protocols/desktop-shell.xml + desktop-shell +) + +file(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c) +file(GLOB common ${PROJECT_SOURCE_DIR}/common/*.c) + +include_directories( + ${WLC_INCLUDE_DIRS} + ${PCRE_INCLUDE_DIRS} + ${JSONC_INCLUDE_DIRS} + ${XKBCOMMON_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} +) + +add_executable(sway + ${sources} + ${common} + ${proto-desktop-shell} +) + +target_link_libraries(sway + ${WLC_LIBRARIES} + ${XKBCOMMON_LIBRARIES} + ${PCRE_LIBRARIES} + ${JSONC_LIBRARIES} + ${WAYLAND_SERVER_LIBRARIES} +) + +install( + TARGETS sway + RUNTIME + DESTINATION bin + COMPONENT runtime +) +install( + FILES ${CMAKE_CURRENT_SOURCE_DIR}/config + DESTINATION ${FALLBACK_CONFIG_DIR} + COMPONENT configuration +) From c9ce15aa1874f31ed21bc6890a26366c5fabc2d3 Mon Sep 17 00:00:00 2001 From: Christoph Gysin Date: Tue, 1 Dec 2015 22:37:08 +0200 Subject: [PATCH 3/4] cmake: remove subprojects --- swaybar/CMakeLists.txt | 12 +++++------- swaybg/CMakeLists.txt | 12 +++++------- swaygrab/CMakeLists.txt | 6 ++---- swaymsg/CMakeLists.txt | 6 ++---- 4 files changed, 14 insertions(+), 22 deletions(-) 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 @@ -project(swaybar) - find_package(Wayland REQUIRED) find_package(Cairo REQUIRED) find_package(Pango REQUIRED) include(Wayland) WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell - ${PROJECT_SOURCE_DIR}/../protocols/xdg-shell.xml + ../protocols/xdg-shell.xml xdg-shell ) WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell - ${PROJECT_SOURCE_DIR}/../protocols/desktop-shell.xml + ../protocols/desktop-shell.xml desktop-shell ) @@ -21,9 +19,9 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) -file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) -file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) -file(GLOB wl_sources ${PROJECT_SOURCE_DIR}/../wayland/*.c) +file(GLOB sources *.c) +file(GLOB common ../common/*.c) +file(GLOB wl_sources ../wayland/*.c) add_executable(swaybar ${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 @@ -project(swaybg) - find_package(Wayland REQUIRED) find_package(Cairo REQUIRED) find_package(Pango REQUIRED) include(Wayland) WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell - ${PROJECT_SOURCE_DIR}/../protocols/xdg-shell.xml + ../protocols/xdg-shell.xml xdg-shell ) WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell - ${PROJECT_SOURCE_DIR}/../protocols/desktop-shell.xml + ../protocols/desktop-shell.xml desktop-shell ) @@ -21,9 +19,9 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) -file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) -file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) -file(GLOB wl_sources ${PROJECT_SOURCE_DIR}/../wayland/*.c) +file(GLOB sources *.c) +file(GLOB common ../common/*.c) +file(GLOB wl_sources ../wayland/*.c) add_executable(swaybg ${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 @@ -project(swaygrab) - -file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) -file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) +file(GLOB sources *.c) +file(GLOB common ../common/*.c) add_executable(swaygrab ${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 @@ -project(swaymsg) - -file(GLOB sources ${PROJECT_SOURCE_DIR}/*.c) -file(GLOB common ${PROJECT_SOURCE_DIR}/../common/*.c) +file(GLOB sources *.c) +file(GLOB common ../common/*.c) add_executable(swaymsg ${sources} From 38d4ee9f5030ad8bf383c8c24b0b13b20dbc45de Mon Sep 17 00:00:00 2001 From: Christoph Gysin Date: Tue, 1 Dec 2015 22:45:20 +0200 Subject: [PATCH 4/4] cmake: remove extra space --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dcb52c0d..b9a2e37d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) execute_process( - COMMAND git rev-parse --abbrev-ref HEAD + COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}