mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-22 18:25:38 +02:00
make: let pkg_check_module() create targets
This commit is contained in:
parent
578c76326d
commit
f3b225adf7
2 changed files with 33 additions and 89 deletions
|
@ -23,31 +23,23 @@ set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}")
|
|||
find_package(Threads REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_check_modules(XCB REQUIRED xcb xcb-aux xcb-cursor xcb-event xcb-ewmh
|
||||
xcb-randr xcb-render)
|
||||
pkg_check_modules(XCB_ERRORS xcb-errors)
|
||||
pkg_check_modules(WAYLAND REQUIRED wayland-client wayland-cursor wlroots)
|
||||
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
|
||||
pkg_check_modules(CAIRO REQUIRED cairo cairo-xcb cairo-ft)
|
||||
pkg_check_modules(YAML REQUIRED yaml-0.1)
|
||||
pkg_check_modules(xcb REQUIRED IMPORTED_TARGET
|
||||
xcb xcb-aux xcb-cursor xcb-event xcb-ewmh xcb-randr xcb-render)
|
||||
pkg_check_modules(xcb-errors IMPORTED_TARGET xcb-errors)
|
||||
pkg_check_modules(wayland REQUIRED IMPORTED_TARGET
|
||||
wayland-client wayland-cursor wlroots)
|
||||
pkg_check_modules(fontconfig REQUIRED IMPORTED_TARGET fontconfig)
|
||||
pkg_check_modules(cairo REQUIRED IMPORTED_TARGET cairo cairo-xcb cairo-ft)
|
||||
pkg_check_modules(yaml REQUIRED IMPORTED_TARGET yaml-0.1)
|
||||
|
||||
add_library(xcb-stuff STATIC EXCLUDE_FROM_ALL xcb.c xcb.h)
|
||||
if (XCB_ERRORS_FOUND)
|
||||
target_compile_definitions(xcb-stuff PRIVATE HAVE_XCB_ERRORS)
|
||||
endif ()
|
||||
|
||||
add_library(bar-xcb STATIC EXCLUDE_FROM_ALL bar/xcb.c bar/xcb.h)
|
||||
|
||||
target_compile_options(bar-xcb PRIVATE
|
||||
${XCB_CFLAGS_OTHER}
|
||||
${XCB_ERRORS_CFLAGS_OTHER}
|
||||
${CAIRO_CFLAGS_OTHER}
|
||||
)
|
||||
|
||||
target_include_directories(bar-xcb PRIVATE
|
||||
${XCB_INCLUDE_DIRS}
|
||||
${XCB_ERRORS_INCLUDE_DIRS}
|
||||
${CAIRO_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(bar-xcb xcb-stuff ${XCB_LIBRARIES} ${XCB_ERRORS_LIBRARIES})
|
||||
target_link_libraries(bar-xcb
|
||||
xcb-stuff PkgConfig::xcb PkgConfig::xcb-errors PkgConfig::cairo)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT wlr-layer-shell-unstable-v1.c
|
||||
|
@ -91,19 +83,8 @@ target_include_directories(wayland-protocols PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
|||
|
||||
add_library(bar-wayland STATIC EXCLUDE_FROM_ALL bar/wayland.c bar/wayland.h)
|
||||
target_compile_definitions(bar-wayland PRIVATE _GNU_SOURCE)
|
||||
target_compile_options(bar-wayland PRIVATE
|
||||
${WAYLAND_CFLAGS_OTHER}
|
||||
${CAIRO_CFLAGS_OTHER}
|
||||
)
|
||||
|
||||
target_include_directories(bar-wayland PRIVATE
|
||||
${CURRENT_BINARY_DIR}
|
||||
${WAYLAND_INCLUDE_DIRS}
|
||||
${CAIRO_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(bar-wayland wayland-protocols ${WAYLAND_LIBRARIES})
|
||||
|
||||
target_link_libraries(
|
||||
bar-wayland wayland-protocols PkgConfig::wayland PkgConfig::cairo)
|
||||
|
||||
add_executable(f00bar
|
||||
config.c config.h
|
||||
|
@ -122,36 +103,14 @@ add_executable(f00bar
|
|||
bar/bar.c bar/private.h bar/backend.h
|
||||
)
|
||||
|
||||
target_link_libraries(f00bar xcb-stuff bar-xcb bar-wayland)
|
||||
target_link_libraries(f00bar
|
||||
bar-xcb bar-wayland
|
||||
PkgConfig::cairo PkgConfig::fontconfig PkgConfig::yaml
|
||||
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
|
||||
|
||||
# Make global symbols in f00bar visible to dlopen:ed plugins
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
|
||||
|
||||
if (XCB_ERRORS_FOUND)
|
||||
target_compile_definitions(f00bar PRIVATE HAVE_XCB_ERRORS)
|
||||
endif ()
|
||||
|
||||
target_compile_options(f00bar PRIVATE
|
||||
${FONTCONFIG_CFLAGS_OTHER}
|
||||
${CAIRO_CFLAGS_OTHER}
|
||||
${YAML_CFLAGS_OTHER}
|
||||
)
|
||||
|
||||
target_include_directories(f00bar PRIVATE
|
||||
${FONTCONFIG_INCLUDE_DIRS}
|
||||
${CAIRO_INCLUDE_DIRS}
|
||||
${YAML_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(f00bar
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${CMAKE_DL_LIBS}
|
||||
|
||||
${FONTCONFIG_LIBRARIES}
|
||||
${CAIRO_LIBRARIES}
|
||||
${YAML_LIBRARIES}
|
||||
)
|
||||
|
||||
set_property(TARGET f00bar PROPERTY INSTALL_RPATH \$ORIGIN/../lib/f00bar)
|
||||
set_property(TARGET f00bar PROPERTY
|
||||
BUILD_RPATH "\$ORIGIN/modules;\$ORIGIN/particles;\$ORIGIN/decorations")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue