From ea8c9db1ac213c18e75bdf50f7385d4eadeefa64 Mon Sep 17 00:00:00 2001 From: TibboddiT Date: Fri, 9 Aug 2024 15:54:39 +0200 Subject: [PATCH] Allow using custom mir libraries directory (#198) * allow using custom mir libraries directory * update cmake options ordering to improve readability * CI: install libmirwayland-dev * CI: install libmirwayland-dev --- .github/workflows/cmake.yml | 2 +- CMakeLists.txt | 6 +++++- snap/snapcraft.yaml | 1 + tests/CMakeLists.txt | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 5d6a6e7..303d0fe 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -32,7 +32,7 @@ jobs: sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 --slave /usr/bin/g++ g++ /usr/bin/g++-13 sudo apt install libmiral-dev libmircommon-internal-dev libmircommon-dev libmirserver-internal-dev \ libgtest-dev libyaml-cpp-dev libglib2.0-dev libevdev-dev nlohmann-json3-dev libnotify-dev pcre2-utils \ - libmiroil-dev libmirrenderer-dev libgles2-mesa-dev + libmiroil-dev libmirrenderer-dev libgles2-mesa-dev libmirwayland-dev - name: Configure CMake diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d2f097..9e63431 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,13 +8,15 @@ set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(ENV{PKG_CONFIG_PATH} "/usr/local/lib/pkgconfig/") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(MIR_LIBRARIES_PKGCONFIG_DIRECTORY "" CACHE STRING "Search for Mir libraries pc files in this directory") option(SNAP_BUILD "Building as a snap?" OFF) +set(ENV{PKG_CONFIG_PATH} "${MIR_LIBRARIES_PKGCONFIG_DIRECTORY}:/usr/local/lib/pkgconfig/") + find_package(PkgConfig) pkg_check_modules(MIRAL miral REQUIRED) pkg_check_modules(MIROIL miroil REQUIRED) @@ -24,6 +26,7 @@ pkg_check_modules(MIRCOMMON mircommon REQUIRED) pkg_check_modules(MIRCOMMON_INTERNAL mircommon-internal REQUIRED) pkg_check_modules(MIRSERVER mirserver REQUIRED) pkg_check_modules(MIRSERVER_INTERNAL mirserver-internal REQUIRED) +pkg_check_modules(MIRWAYLAND mirwayland REQUIRED) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(YAML REQUIRED IMPORTED_TARGET yaml-cpp) pkg_check_modules(LIBEVDEV REQUIRED IMPORTED_TARGET libevdev) @@ -91,6 +94,7 @@ target_link_libraries(miracle-wm-implementation ${MIRPLATFORM_LDFLAGS} ${MIRSERVER_LDFLAGS} ${MIRSERVER_INTERNAL_LDFLAGS} + ${MIRWAYLAND_LDFLAGS} PkgConfig::YAML PkgConfig::GLIB PkgConfig::LIBEVDEV diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 8d439e5..1d6d85f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -75,6 +75,7 @@ parts: - libnotify-dev - libgles2-mesa-dev - libmirrenderer-dev + - libmirwayland-dev stage-packages: - libmiral7 - libmiroil5 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c2851a7..e2e0593 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,6 +14,11 @@ pkg_check_modules(MIRSERVER mirserver REQUIRED) find_package(GTest REQUIRED) pkg_check_modules(YAML REQUIRED IMPORTED_TARGET yaml-cpp) +if(MIR_LIBRARIES_PKGCONFIG_DIRECTORY) + list( PREPEND CMAKE_INSTALL_RPATH ${MIRAL_LIBRARY_DIRS} ) + set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) +endif() + add_executable(miracle-wm-tests filesystem_configuration_test.cpp tiling_window_tree_test.cpp