1
0
Fork 0

Build kwayland as external project

This commit is contained in:
Ilya Fedin 2021-12-11 20:49:04 +04:00 committed by John Preston
parent e4acb81f08
commit 3db3eeab03
3 changed files with 64 additions and 26 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "patches"]
path = patches
url = https://github.com/desktop-app/patches.git

View file

@ -4,38 +4,72 @@
# For license and copyright information please follow this link:
# https://github.com/desktop-app/legal/blob/master/LEGAL
if (DESKTOP_APP_USE_PACKAGED)
add_library(external_kwayland INTERFACE IMPORTED GLOBAL)
add_library(desktop-app::external_kwayland ALIAS external_kwayland)
find_package(KF5Wayland REQUIRED)
if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_QT6)
find_package(KF5Wayland)
if (KF5Wayland_FOUND)
target_link_libraries(external_kwayland INTERFACE KF5::WaylandClient)
else()
add_library(external_kwayland STATIC IMPORTED GLOBAL)
add_library(desktop-app::external_kwayland ALIAS external_kwayland)
find_library(KWAYLAND_LIBRARY libKF5WaylandClient.a)
set_target_properties(external_kwayland PROPERTIES
IMPORTED_LOCATION "${KWAYLAND_LIBRARY}"
)
target_include_directories(external_kwayland SYSTEM
INTERFACE
/usr/local/include/KF5
/usr/local/include/KF5/KWayland/Client
)
if (DESKTOP_APP_QT6)
set(qtconcurrent_loc ${qt_loc}/lib/libQt6Concurrent.a)
else()
set(qtconcurrent_loc ${qt_loc}/lib/libQt5Concurrent.a)
return()
endif()
endif()
target_link_libraries(external_kwayland
add_library(external_kwayland_bundled STATIC IMPORTED)
set(kwayland_loc ${third_party_loc}/kwayland)
set(kwayland_patch_command :)
if (DESKTOP_APP_QT6)
set(kwayland_patch_command patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/../../patches/kwayland-qt6.patch)
endif()
include(ExternalProject)
ExternalProject_Add(kwayland
SOURCE_DIR ${kwayland_loc}
CMAKE_GENERATOR Ninja
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF
PATCH_COMMAND ${kwayland_patch_command}
BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target KF5WaylandClient
STEP_TARGETS build
EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS <BINARY_DIR>/lib/libKF5WaylandClient.a
)
ExternalProject_Get_property(kwayland BINARY_DIR)
set_target_properties(external_kwayland_bundled PROPERTIES
IMPORTED_LOCATION "${BINARY_DIR}/lib/libKF5WaylandClient.a"
)
target_include_directories(external_kwayland_bundled SYSTEM
INTERFACE
${kwayland_loc}/src/client
${BINARY_DIR}/src/client
)
target_link_libraries(external_kwayland_bundled
INTERFACE
desktop-app::external_qt
)
if (DESKTOP_APP_USE_PACKAGED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(WAYLAND_CLIENT REQUIRED IMPORTED_TARGET wayland-client)
target_link_libraries(external_kwayland_bundled INTERFACE PkgConfig::WAYLAND_CLIENT)
else()
target_link_libraries(external_kwayland_bundled
INTERFACE
desktop-app::linux_wayland_helper
$<TARGET_FILE:desktop-app::linux_wayland_helper>
${qtconcurrent_loc}
desktop-app::external_qt
)
endif()
add_dependencies(external_kwayland_bundled kwayland-build)
target_link_libraries(external_kwayland
INTERFACE
external_kwayland_bundled
)

1
patches Submodule

@ -0,0 +1 @@
Subproject commit 83a901f499c638efa54eb88aa0a2645746acda27