aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt14
-rw-r--r--common/CMakeLists.txt7
-rw-r--r--protocols/CMakeLists.txt22
-rw-r--r--sway/CMakeLists.txt38
-rw-r--r--swaybar/CMakeLists.txt28
-rw-r--r--swaybg/CMakeLists.txt28
-rw-r--r--swaygrab/CMakeLists.txt7
-rw-r--r--swaymsg/CMakeLists.txt10
-rw-r--r--wayland/CMakeLists.txt17
9 files changed, 93 insertions, 78 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9a2e37d..75c61c2a 100644
--- 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
new file mode 100644
index 00000000..f7d44ec5
--- /dev/null
+++ 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
new file mode 100644
index 00000000..07becc36
--- /dev/null
+++ 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
index 92392354..49ed24e7 100644
--- 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
index c14b5f75..a2ff9f5a 100644
--- 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
index 9d3cc547..71363d79 100644
--- 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
index 77d96412..d5468cda 100644
--- 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
index 7616d942..2481b280 100644
--- 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
new file mode 100644
index 00000000..5633dd6e
--- /dev/null
+++ 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}
+ )