sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit 7a1c8c2939c8581bb47323513b91a94aebf62b36
parent f76b7f5385f79f9e004a096ed4896725cac30f9c
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed,  2 Dec 2015 05:34:18 -0500

Merge pull request #291 from christophgysin/libs

cmake: build common code only once
Diffstat:
MCMakeLists.txt | 14+++++++++++++-
Acommon/CMakeLists.txt | 7+++++++
Aprotocols/CMakeLists.txt | 22++++++++++++++++++++++
Msway/CMakeLists.txt | 38+++++++++++++++++++-------------------
Mswaybar/CMakeLists.txt | 28++++------------------------
Mswaybg/CMakeLists.txt | 28++++------------------------
Mswaygrab/CMakeLists.txt | 7++-----
Mswaymsg/CMakeLists.txt | 10+++++-----
Awayland/CMakeLists.txt | 17+++++++++++++++++
9 files changed, 93 insertions(+), 78 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -41,7 +41,19 @@ add_definitions(-DSWAY_GIT_BRANCH=\"${GIT_BRANCH}\") string(TIMESTAMP CURRENT_DATE "%Y-%m-%d" UTC) add_definitions(-DSWAY_VERSION_DATE=\"${CURRENT_DATE}\") -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) +find_package(Cairo REQUIRED) +find_package(JsonC REQUIRED) +find_package(PCRE REQUIRED) +find_package(Pango REQUIRED) +find_package(WLC REQUIRED) +find_package(Wayland REQUIRED) +find_package(XKBCommon REQUIRED) + +include_directories(include) + +add_subdirectory(protocols) +add_subdirectory(common) +add_subdirectory(wayland) add_subdirectory(sway) add_subdirectory(swaybg) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(sway-common + ipc-client.c + list.c + log.c + readline.c + stringop.c + ) diff --git a/protocols/CMakeLists.txt b/protocols/CMakeLists.txt @@ -0,0 +1,22 @@ +include(Wayland) + +WAYLAND_ADD_PROTOCOL_CLIENT(proto-client-xdg-shell + xdg-shell.xml + xdg-shell +) +WAYLAND_ADD_PROTOCOL_CLIENT(proto-client-desktop-shell + desktop-shell.xml + desktop-shell +) +WAYLAND_ADD_PROTOCOL_SERVER(proto-server-desktop-shell + desktop-shell.xml + desktop-shell +) + +add_library(sway-protocols + ${proto-client-xdg-shell} + ${proto-client-desktop-shell} + ${proto-server-desktop-shell} + ) + +set(PROTOCOLS_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/protocols PARENT_SCOPE) diff --git a/sway/CMakeLists.txt b/sway/CMakeLists.txt @@ -1,33 +1,33 @@ -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( + ${PROTOCOLS_INCLUDE_DIRS} ${WLC_INCLUDE_DIRS} ${PCRE_INCLUDE_DIRS} ${JSONC_INCLUDE_DIRS} ${XKBCOMMON_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} ) add_executable(sway - ${sources} - ${common} - ${proto-desktop-shell} + commands.c + config.c + container.c + criteria.c + debug_log.c + extensions.c + focus.c + handlers.c + input_state.c + ipc-server.c + layout.c + main.c + output.c + resize.c + util.c + workspace.c ) target_link_libraries(sway + sway-common + sway-protocols ${WLC_LIBRARIES} ${XKBCOMMON_LIBRARIES} ${PCRE_LIBRARIES} diff --git a/swaybar/CMakeLists.txt b/swaybar/CMakeLists.txt @@ -1,37 +1,17 @@ -find_package(Wayland REQUIRED) -find_package(Cairo REQUIRED) -find_package(Pango REQUIRED) - -include(Wayland) -WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell - ../protocols/xdg-shell.xml - xdg-shell -) -WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell - ../protocols/desktop-shell.xml - desktop-shell -) - include_directories( + ${PROTOCOLS_INCLUDE_DIRS} ${WAYLAND_CLIENT_INCLUDE_DIR} ${CAIRO_INCLUDE_DIRS} ${PANGO_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} ) -file(GLOB sources *.c) -file(GLOB common ../common/*.c) -file(GLOB wl_sources ../wayland/*.c) - add_executable(swaybar - ${sources} - ${wl_sources} - ${common} - ${proto-xdg-shell} - ${proto-desktop-shell} + main.c ) target_link_libraries(swaybar + sway-common + sway-wayland ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES} ${CAIRO_LIBRARIES} diff --git a/swaybg/CMakeLists.txt b/swaybg/CMakeLists.txt @@ -1,37 +1,17 @@ -find_package(Wayland REQUIRED) -find_package(Cairo REQUIRED) -find_package(Pango REQUIRED) - -include(Wayland) -WAYLAND_ADD_PROTOCOL_CLIENT(proto-xdg-shell - ../protocols/xdg-shell.xml - xdg-shell -) -WAYLAND_ADD_PROTOCOL_CLIENT(proto-desktop-shell - ../protocols/desktop-shell.xml - desktop-shell -) - include_directories( + ${PROTOCOLS_INCLUDE_DIRS} ${WAYLAND_CLIENT_INCLUDE_DIR} ${CAIRO_INCLUDE_DIRS} ${PANGO_INCLUDE_DIRS} - ${CMAKE_CURRENT_BINARY_DIR} ) -file(GLOB sources *.c) -file(GLOB common ../common/*.c) -file(GLOB wl_sources ../wayland/*.c) - add_executable(swaybg - ${sources} - ${wl_sources} - ${common} - ${proto-xdg-shell} - ${proto-desktop-shell} + main.c ) target_link_libraries(swaybg + sway-common + sway-wayland ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_CURSOR_LIBRARIES} ${CAIRO_LIBRARIES} diff --git a/swaygrab/CMakeLists.txt b/swaygrab/CMakeLists.txt @@ -1,12 +1,9 @@ -file(GLOB sources *.c) -file(GLOB common ../common/*.c) - add_executable(swaygrab - ${sources} - ${common} + main.c ) target_link_libraries(swaygrab + sway-common rt ) diff --git a/swaymsg/CMakeLists.txt b/swaymsg/CMakeLists.txt @@ -1,11 +1,11 @@ -file(GLOB sources *.c) -file(GLOB common ../common/*.c) - add_executable(swaymsg - ${sources} - ${common} + main.c ) +target_link_libraries(swaymsg + sway-common + ) + install( TARGETS swaymsg RUNTIME diff --git a/wayland/CMakeLists.txt b/wayland/CMakeLists.txt @@ -0,0 +1,17 @@ +include_directories( + ${PROTOCOLS_INCLUDE_DIRS} + ${PANGO_INCLUDE_DIRS} +) + +add_library(sway-wayland + buffers.c + pango.c + registry.c + window.c + ) + +target_link_libraries(sway-wayland + sway-common + sway-protocols + ${PANGO_LIBRARIES} + )