Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using custom mir libraries directory #198

Merged
merged 5 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

option(SNAP_BUILD "Building as a snap?" OFF)

set(MIR_LIBRARIES_PKGCONFIG_DIRECTORY "" CACHE STRING "Search for Mir libraries pc files in this directory")
mattkae marked this conversation as resolved.
Show resolved Hide resolved
if(MIR_LIBRARIES_PKGCONFIG_DIRECTORY)
mattkae marked this conversation as resolved.
Show resolved Hide resolved
set(ENV{PKG_CONFIG_PATH} "${MIR_LIBRARIES_PKGCONFIG_DIRECTORY}:/usr/local/lib/pkgconfig/")
endif()

find_package(PkgConfig)
pkg_check_modules(MIRAL miral REQUIRED)
pkg_check_modules(MIROIL miroil REQUIRED)
Expand All @@ -24,6 +29,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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would Mirwayland be required here? I don't remember using it in the project anywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only required at link time, otherwise building fails with

/usr/bin/ld: warning: libmirwayland.so.5, needed by <mir_install_directory>/lib/libmirplatform.so, not found (try using -rpath or -rpath-link)

and a bunch of undefined symbols.

Maybe mirplatform should require mirwayland in its pc file ? Currently it's just:

prefix=<mir_install_directory>
libdir=${prefix}/lib
includedir=${prefix}/include

Name: mirplatform
Description: Mir platform library
Version: 2.18.0
Requires: mircommon, mircore
Libs: -L${libdir} -lmirplatform
Cflags: -I${includedir}/mirplatform

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay that's probably an issue on their end, but I am happy to patch it on our end in the meantime.

Filed the bug: canonical/mir#3536

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)
Expand Down Expand Up @@ -91,6 +97,7 @@ target_link_libraries(miracle-wm-implementation
${MIRPLATFORM_LDFLAGS}
${MIRSERVER_LDFLAGS}
${MIRSERVER_INTERNAL_LDFLAGS}
${MIRWAYLAND_LDFLAGS}
PkgConfig::YAML
PkgConfig::GLIB
PkgConfig::LIBEVDEV
Expand Down
5 changes: 5 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading