Skip to content

Commit

Permalink
build: export library correctly
Browse files Browse the repository at this point in the history
To enable consumers making use of it we must ensure:
* config file is installed with transitive dependencies
* custom find module files are provided
* all required headers are installed
* the base directory is included
  • Loading branch information
romangg committed Feb 14, 2024
1 parent 8b3c466 commit 2eb9dd4
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 7 deletions.
47 changes: 46 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ include(ECMOptionalAddSubdirectory)
include(ECMConfiguredInstall)
include(ECMQmlModule)
include(ECMGenerateQmlTypes)
include(ECMSetupVersion)

ecm_setup_version(PROJECT
VARIABLE_PREFIX COMO
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/como_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/como-config-version.cmake"
SOVERSION 0
)

# required frameworks by Core
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
Expand Down Expand Up @@ -198,7 +206,9 @@ set_package_properties(Pixman PROPERTIES
TYPE REQUIRED
PURPOSE "Required for building wlroots backend."
)
find_package(wlroots 0.17.0)

set(WLROOTS_MIN_VERSION "0.17.0")
find_package(wlroots ${WLROOTS_MIN_VERSION})
set_package_properties(wlroots PROPERTIES
TYPE REQUIRED
PURPOSE "Required for building wlroots backend."
Expand Down Expand Up @@ -332,4 +342,39 @@ if (KF6DocTools_FOUND)
add_subdirectory(docs)
endif()

# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/como")

configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/como-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/como-config.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)

install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/como-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/como-config-version.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)

install(
EXPORT como-export
FILE como-targets.cmake
NAMESPACE como::
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/como_version.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT Devel
)

install(
FILES
como/cmake/modules/FindPixman.cmake
como/cmake/modules/Findwlroots.cmake
DESTINATION ${CMAKECONFIG_INSTALL_DIR}/modules
)

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
30 changes: 30 additions & 0 deletions como-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/modules/")

find_dependency(Wrapland)
find_dependency(Pixman)
find_dependency(wlroots @WLROOTS_MIN_VERSION@)
find_dependency(Qt6Gui @QT_MIN_VERSION@)
find_dependency(KF6 @KF6_MIN_VERSION@ COMPONENTS
Auth
Config
ConfigWidgets
CoreAddons
Declarative
GlobalAccel
I18n
IdleTime
KCMUtils
NewStuff
Notifications
Package
Service
Svg
WidgetsAddons
WindowSystem
XmlGui
)

include("${CMAKE_CURRENT_LIST_DIR}/como-targets.cmake")
13 changes: 8 additions & 5 deletions como/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ target_sources(wayland
base/backend/wlroots/helpers.h
base/backend/wlroots/non_desktop_output.h
base/backend/wlroots/output.h
base/seat/backend/wlroots/session.h
input/backend/wlroots/backend.h
input/backend/wlroots/control/control.h
input/backend/wlroots/control/headless/keyboard.h
input/backend/wlroots/control/keyboard.h
input/backend/wlroots/control/pointer.h
input/backend/wlroots/control/switch.h
input/backend/wlroots/control/touch.h
input/backend/wlroots/device_helpers.h
input/backend/wlroots/keyboard.h
input/backend/wlroots/pointer.h
Expand Down Expand Up @@ -102,9 +109,5 @@ install(TARGETS x11 wayland
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como
)

install(EXPORT como-export
NAMESPACE como::
DESTINATION ${KDE_INSTALL_CMAKEPACKAGEDIR}/como
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)
19 changes: 18 additions & 1 deletion como/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ target_sources(base-x11-backend
backend/x11/wm_selection.h
backend/x11/wm_selection_owner.h
x11/app_singleton.h
x11/output.h
x11/output_helpers.h
x11/platform.h
x11/platform_helpers.h
x11/randr_filter.h
PRIVATE
backend/x11/wm_selection_owner.cpp
)
Expand All @@ -140,16 +143,17 @@ target_link_libraries(base-wl
target_sources(base-wl
PUBLIC
FILE_SET HEADERS
BASE_DIRS wayland
FILES
wayland/app_singleton.h
wayland/filtered_display.h
wayland/output.h
wayland/output_helpers.h
wayland/output_transform.h
wayland/platform.h
wayland/platform_helpers.h
wayland/screen_lock.h
wayland/server.h
wayland/xwl_platform.h
PRIVATE
wayland/filtered_display.cpp
)
Expand All @@ -164,4 +168,17 @@ install(TARGETS base base-x11 base-x11-backend base-wl
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como/base
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/como_export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/como/base
COMPONENT Devel
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/config-como.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/como/base
COMPONENT Devel
)
8 changes: 8 additions & 0 deletions como/debug/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ target_sources(debug-common
console/console.h
console/model_helpers.h
console/window.h
console/x11/x11_console.h
perf/ftrace.h
support_info.h
PRIVATE
Expand Down Expand Up @@ -74,4 +75,11 @@ install(TARGETS debug-common debug-wl
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como/debug
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ui_debug_console.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/como/debug
COMPONENT Devel
)
2 changes: 2 additions & 0 deletions como/desktop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ target_sources(desktop-kde
PUBLIC
FILE_SET HEADERS
FILES
kde/dbus/kwin.h
kde/platform.h
kde/service_utils.h
PRIVATE
Expand Down Expand Up @@ -104,4 +105,5 @@ install(TARGETS desktop desktop-kde
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como/desktop
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)
5 changes: 5 additions & 0 deletions como/input/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ target_sources(input-wl
wayland/cursor.h
wayland/cursor_image.h
wayland/device_redirect.h
wayland/fake/devices.h
wayland/fake/keyboard.h
wayland/fake/pointer.h
wayland/fake/touch.h
wayland/global_shortcuts_manager.h
wayland/idle.h
wayland/input_method.h
Expand Down Expand Up @@ -206,4 +210,5 @@ install(TARGETS input input-x11-backend input-wl
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como/input
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)
29 changes: 29 additions & 0 deletions como/render/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ target_sources(render
effect/interface/effect_screen.h
effect/interface/effect_togglable_state.h
effect/interface/effect_window.h
effect/interface/effect_window_visible_ref.h
effect/interface/effects_handler.h
effect/interface/offscreen_quick_view.h
effect/interface/paint_clipper.h
Expand Down Expand Up @@ -70,6 +71,7 @@ target_sources(render
gl/interface/shader.h
gl/interface/shader_manager.h
gl/interface/texture.h
gl/interface/texture_p.h
gl/interface/utils.h
gl/interface/utils_funcs.h
gl/interface/vertex_buffer.h
Expand Down Expand Up @@ -184,8 +186,17 @@ target_sources(render-x11
FILE_SET HEADERS
FILES
x11/compositor_selection_owner.h
x11/effect/blur_integration.h
x11/effect/blur_update.h
x11/effect/contrast_integration.h
x11/effect/contrast_update.h
x11/effect/kscreen_integration.h
x11/effect/kscreen_update.h
x11/effect/setup_handler.h
x11/effect/setup_window.h
x11/effect/slide_integration.h
x11/effect/slide_update.h
x11/effect/update.h
x11/keyboard_intercept_filter.h
x11/mouse_intercept_filter.h
x11/property_notify_filter.h
Expand All @@ -210,7 +221,17 @@ target_sources(render-x11-backend
PUBLIC
FILE_SET HEADERS
FILES
backend/x11/deco_renderer.h
backend/x11/glx_backend.h
backend/x11/glx_context_attribute_builder.h
backend/x11/glx_data.h
backend/x11/glx_fb_config.h
backend/x11/glx_texture.h
backend/x11/glx.h
backend/x11/non_composited_outline.h
backend/x11/output.h
backend/x11/platform.h
backend/x11/swap_event_filter.h
x11/buffer.h
x11/compositor_start.h
x11/effect.h
Expand Down Expand Up @@ -281,6 +302,7 @@ install(
FILES
dbus/org.kde.kwin.ColorCorrect.xml
dbus/org.kde.kwin.Compositing.xml
effect/interface/org.kde.kwin.Effects.xml
DESTINATION
${KDE_INSTALL_DBUSINTERFACEDIR}
)
Expand All @@ -292,4 +314,11 @@ install(TARGETS render render-x11 render-x11-backend render-wl
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como/render
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/color_correct_settings.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/como/render/post
COMPONENT Devel
)
2 changes: 2 additions & 0 deletions como/script/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ target_sources(script
PUBLIC
FILE_SET HEADERS
FILES
dbus_call.h
desktop_background_item.h
effect.h
effect_loader.h
Expand Down Expand Up @@ -79,4 +80,5 @@ install(TARGETS script
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como/script
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)
1 change: 1 addition & 0 deletions como/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ install(TARGETS utils
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como/utils
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)
20 changes: 20 additions & 0 deletions como/win/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ target_sources(win-x11
x11/control.h
x11/control_create.h
x11/damage.h
x11/debug.h
x11/deco.h
x11/desktop_space.h
x11/event.h
Expand All @@ -257,6 +258,7 @@ target_sources(win-x11
x11/root_info_filter.h
x11/scene.h
x11/screen_edge.h
x11/screen_edges.h
x11/screen_edges_filter.h
x11/session.h
x11/session_manager.h
Expand All @@ -280,6 +282,7 @@ target_sources(win-x11
x11/window_release.h
x11/win_info.h
x11/xcb.h
x11/xcb_cursor.h
x11/xcb_event_filter.h
x11/xcb_windows.h
PRIVATE
Expand Down Expand Up @@ -342,6 +345,8 @@ target_sources(win-wl
wayland/setup.h
wayland/space.h
wayland/space_areas.h
wayland/space_setup.h
wayland/space_windows.h
wayland/subspace_manager.h
wayland/subsurface.h
wayland/surface.h
Expand All @@ -362,6 +367,12 @@ set_target_properties(win win-x11 win-x11-backend win-wl PROPERTIES
PREFIX libcomo-
)

install(
FILES
rules/kconfig/rules_settings.kcfg
rules/kconfig/rules_book_settings_base.kcfg
DESTINATION ${KDE_INSTALL_KCFGDIR}
)
install(
FILES dbus/org.kde.KWin.VirtualDesktopManager.xml
DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}
Expand All @@ -375,6 +386,15 @@ install(TARGETS win win-x11 win-x11-backend win-wl
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como/win
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)

install(TARGETS como_killer_helper DESTINATION ${KDE_INSTALL_LIBEXECDIR})

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/rules_book_settings_base.h
${CMAKE_CURRENT_BINARY_DIR}/rules_settings.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/como/win/rules
COMPONENT Devel
)
1 change: 1 addition & 0 deletions como/xwl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ install(TARGETS xwayland
EXPORT como-export
LIBRARY NAMELINK_SKIP
FILE_SET HEADERS DESTINATION ${KDE_INSTALL_INCLUDEDIR}/como/xwl
INCLUDES DESTINATION ${KDE_INSTALL_INCLUDEDIR}
)

0 comments on commit 2eb9dd4

Please sign in to comment.