diff options
author | Mihai Fufezan <[email protected]> | 2024-09-22 18:01:44 +0300 |
---|---|---|
committer | Mihai Fufezan <[email protected]> | 2024-09-27 00:07:52 +0300 |
commit | be96787ed086f751455cf713739296b5c6e3a235 (patch) | |
tree | 7c674a4b242058f880986c7d4094a7f93ecc8b20 | |
parent | 89d945aabe632387f113ac500bfee573d51cc4f7 (diff) | |
download | Hyprland-be96787ed086f751455cf713739296b5c6e3a235.tar.gz Hyprland-be96787ed086f751455cf713739296b5c6e3a235.zip |
CMake: use udis86 from pkg-config, fallback to subproject
Only canihavesomecoffee's fork (the one the subproject uses) provides
a .pc file, so we either find the correct version or we use the
subproject.
-rw-r--r-- | CMakeLists.txt | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 08eb93cf..8115d01c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,18 @@ message(STATUS "Gathering git info") execute_process(COMMAND ./scripts/generateVersion.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -# udis -add_subdirectory("subprojects/udis86") +find_package(PkgConfig REQUIRED) + +# Try to find canihavesomecoffee's udis86 using pkgconfig vmd/udis86 does not +# provide a .pc file and won't be detected this way +pkg_check_modules(udis_dep IMPORTED_TARGET udis86>=1.7.2) + +# Fallback to subproject +if(NOT udis_dep_FOUND) + add_subdirectory("subprojects/udis86") + include_directories("subprojects/udis86") + message(STATUS "udis86 dependency not found, falling back to subproject") +endif() if(CMAKE_BUILD_TYPE) string(TOLOWER ${CMAKE_BUILD_TYPE} BUILDTYPE_LOWER) @@ -47,8 +57,6 @@ else() set(BUILDTYPE_LOWER "release") endif() -find_package(PkgConfig REQUIRED) - pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir) message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}") pkg_get_variable(WAYLAND_SCANNER_PKGDATA_DIR wayland-scanner pkgdatadir) @@ -63,7 +71,8 @@ else() message(STATUS "Configuring Hyprland in Release with CMake") endif() -include_directories(. "src/" "subprojects/udis86/" "protocols/") +include_directories(. "src/" "protocols/") + set(CMAKE_CXX_STANDARD 26) add_compile_options( -Wall @@ -224,6 +233,11 @@ target_precompile_headers(Hyprland PRIVATE message(STATUS "Setting link libraries") target_link_libraries(Hyprland rt PkgConfig::aquamarine_dep PkgConfig::deps) +if(udis_dep_FOUND) + target_link_libraries(Hyprland PkgConfig::udis_dep) +else() + target_link_libraries(Hyprland libudis86) +endif() # used by `make installheaders`, to ensure the headers are generated add_custom_target(generate-protocol-headers) @@ -258,8 +272,7 @@ function(protocolWayland) PRIVATE ${CMAKE_SOURCE_DIR}/protocols/wayland.hpp) endfunction() -target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads - libudis86) +target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads) pkg_check_modules(hyprland_protocols_dep hyprland-protocols>=0.2.0) if(hyprland_protocols_dep_FOUND) |