cmake: build common code only once
This creates (static) libraries for protocols/, common/, and wayland/.
This commit is contained in:
parent
f76b7f5385
commit
cce9c338c0
|
@ -41,7 +41,19 @@ add_definitions(-DSWAY_GIT_BRANCH=\"${GIT_BRANCH}\")
|
||||||
string(TIMESTAMP CURRENT_DATE "%Y-%m-%d" UTC)
|
string(TIMESTAMP CURRENT_DATE "%Y-%m-%d" UTC)
|
||||||
add_definitions(-DSWAY_VERSION_DATE=\"${CURRENT_DATE}\")
|
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(sway)
|
||||||
add_subdirectory(swaybg)
|
add_subdirectory(swaybg)
|
||||||
|
|
7
common/CMakeLists.txt
Normal file
7
common/CMakeLists.txt
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
add_library(sway-common
|
||||||
|
ipc-client.c
|
||||||
|
list.c
|
||||||
|
log.c
|
||||||
|
readline.c
|
||||||
|
stringop.c
|
||||||
|
)
|
22
protocols/CMakeLists.txt
Normal file
22
protocols/CMakeLists.txt
Normal file
|
@ -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)
|
|
@ -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(
|
include_directories(
|
||||||
|
${PROTOCOLS_INCLUDE_DIRS}
|
||||||
${WLC_INCLUDE_DIRS}
|
${WLC_INCLUDE_DIRS}
|
||||||
${PCRE_INCLUDE_DIRS}
|
${PCRE_INCLUDE_DIRS}
|
||||||
${JSONC_INCLUDE_DIRS}
|
${JSONC_INCLUDE_DIRS}
|
||||||
${XKBCOMMON_INCLUDE_DIRS}
|
${XKBCOMMON_INCLUDE_DIRS}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(sway
|
add_executable(sway
|
||||||
${sources}
|
commands.c
|
||||||
${common}
|
config.c
|
||||||
${proto-desktop-shell}
|
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
|
target_link_libraries(sway
|
||||||
|
sway-common
|
||||||
|
sway-protocols
|
||||||
${WLC_LIBRARIES}
|
${WLC_LIBRARIES}
|
||||||
${XKBCOMMON_LIBRARIES}
|
${XKBCOMMON_LIBRARIES}
|
||||||
${PCRE_LIBRARIES}
|
${PCRE_LIBRARIES}
|
||||||
|
|
|
@ -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(
|
include_directories(
|
||||||
|
${PROTOCOLS_INCLUDE_DIRS}
|
||||||
${WAYLAND_CLIENT_INCLUDE_DIR}
|
${WAYLAND_CLIENT_INCLUDE_DIR}
|
||||||
${CAIRO_INCLUDE_DIRS}
|
${CAIRO_INCLUDE_DIRS}
|
||||||
${PANGO_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
|
add_executable(swaybar
|
||||||
${sources}
|
main.c
|
||||||
${wl_sources}
|
|
||||||
${common}
|
|
||||||
${proto-xdg-shell}
|
|
||||||
${proto-desktop-shell}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(swaybar
|
target_link_libraries(swaybar
|
||||||
|
sway-common
|
||||||
|
sway-wayland
|
||||||
${WAYLAND_CLIENT_LIBRARIES}
|
${WAYLAND_CLIENT_LIBRARIES}
|
||||||
${WAYLAND_CURSOR_LIBRARIES}
|
${WAYLAND_CURSOR_LIBRARIES}
|
||||||
${CAIRO_LIBRARIES}
|
${CAIRO_LIBRARIES}
|
||||||
|
|
|
@ -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(
|
include_directories(
|
||||||
|
${PROTOCOLS_INCLUDE_DIRS}
|
||||||
${WAYLAND_CLIENT_INCLUDE_DIR}
|
${WAYLAND_CLIENT_INCLUDE_DIR}
|
||||||
${CAIRO_INCLUDE_DIRS}
|
${CAIRO_INCLUDE_DIRS}
|
||||||
${PANGO_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
|
add_executable(swaybg
|
||||||
${sources}
|
main.c
|
||||||
${wl_sources}
|
|
||||||
${common}
|
|
||||||
${proto-xdg-shell}
|
|
||||||
${proto-desktop-shell}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(swaybg
|
target_link_libraries(swaybg
|
||||||
|
sway-common
|
||||||
|
sway-wayland
|
||||||
${WAYLAND_CLIENT_LIBRARIES}
|
${WAYLAND_CLIENT_LIBRARIES}
|
||||||
${WAYLAND_CURSOR_LIBRARIES}
|
${WAYLAND_CURSOR_LIBRARIES}
|
||||||
${CAIRO_LIBRARIES}
|
${CAIRO_LIBRARIES}
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
file(GLOB sources *.c)
|
|
||||||
file(GLOB common ../common/*.c)
|
|
||||||
|
|
||||||
add_executable(swaygrab
|
add_executable(swaygrab
|
||||||
${sources}
|
main.c
|
||||||
${common}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(swaygrab
|
target_link_libraries(swaygrab
|
||||||
|
sway-common
|
||||||
rt
|
rt
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
file(GLOB sources *.c)
|
|
||||||
file(GLOB common ../common/*.c)
|
|
||||||
|
|
||||||
add_executable(swaymsg
|
add_executable(swaymsg
|
||||||
${sources}
|
main.c
|
||||||
${common}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_libraries(swaymsg
|
||||||
|
sway-common
|
||||||
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS swaymsg
|
TARGETS swaymsg
|
||||||
RUNTIME
|
RUNTIME
|
||||||
|
|
17
wayland/CMakeLists.txt
Normal file
17
wayland/CMakeLists.txt
Normal file
|
@ -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}
|
||||||
|
)
|
Loading…
Reference in a new issue