mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Ladybird/CMake: Install resources and Lagom libraries alongside ladybird
This setup should allow the package maintainers who are looking to distribute ladybird on their distributions to use CMake to install ladybird using cmake install rules rather than having to write their own
This commit is contained in:
parent
3403b1fd77
commit
488da351c0
Notes:
sideshowbarker
2024-07-17 05:18:58 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/488da351c0 Pull-request: https://github.com/SerenityOS/serenity/pull/16583 Reviewed-by: https://github.com/awesomekling ✅ Reviewed-by: https://github.com/linusg
3 changed files with 82 additions and 6 deletions
|
@ -6,6 +6,8 @@ project(ladybird
|
|||
DESCRIPTION "Ladybird Web Browser"
|
||||
)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if (ANDROID)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
endif()
|
||||
|
@ -19,7 +21,7 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
|||
# See slide 100 of the following ppt :^)
|
||||
# https://crascit.com/wp-content/uploads/2019/09/Deep-CMake-For-Library-Authors-Craig-Scott-CppCon-2019.pdf
|
||||
if (NOT APPLE)
|
||||
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
||||
set(CMAKE_INSTALL_RPATH $ORIGIN;$ORIGIN/../${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
|
@ -92,8 +94,6 @@ add_custom_target(debug
|
|||
|
||||
qt_finalize_executable(ladybird)
|
||||
|
||||
install(TARGETS ladybird
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE DESTINATION bundle
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
if(NOT CMAKE_SKIP_INSTALL_RULES)
|
||||
include(cmake/InstallRules.cmake)
|
||||
endif()
|
||||
|
|
75
Ladybird/cmake/InstallRules.cmake
Normal file
75
Ladybird/cmake/InstallRules.cmake
Normal file
|
@ -0,0 +1,75 @@
|
|||
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(package ladybird)
|
||||
|
||||
install(TARGETS ladybird
|
||||
EXPORT ladybirdTargets
|
||||
RUNTIME
|
||||
COMPONENT ladybird_Runtime
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
BUNDLE
|
||||
COMPONENT ladybird_Runtime
|
||||
DESTINATION bundle
|
||||
LIBRARY
|
||||
COMPONENT ladybird_Runtime
|
||||
NAMELINK_COMPONENT ladybird_Development
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
include("${Lagom_SOURCE_DIR}/get_linked_lagom_libraries.cmake")
|
||||
get_linked_lagom_libraries(ladybird ladybird_lagom_libraries)
|
||||
|
||||
install(TARGETS ${ladybird_lagom_libraries}
|
||||
EXPORT ladybirdTargets
|
||||
COMPONENT ladybird_Runtime
|
||||
LIBRARY
|
||||
COMPONENT ladybird_Runtime
|
||||
NAMELINK_COMPONENT ladybird_Development
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${package}ConfigVersion.cmake"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
# Allow package maintainers to freely override the path for the configs
|
||||
set(
|
||||
ladybird_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}"
|
||||
CACHE PATH "CMake package config location relative to the install prefix"
|
||||
)
|
||||
mark_as_advanced(ladybird_INSTALL_CMAKEDIR)
|
||||
|
||||
install(
|
||||
FILES cmake/LadybirdInstallConfig.cmake
|
||||
DESTINATION "${ladybird_INSTALL_CMAKEDIR}"
|
||||
RENAME "${package}Config.cmake"
|
||||
COMPONENT ladybird_Development
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake"
|
||||
DESTINATION "${ladybird_INSTALL_CMAKEDIR}"
|
||||
COMPONENT ladybird_Development
|
||||
)
|
||||
|
||||
install(
|
||||
EXPORT ladybirdTargets
|
||||
NAMESPACE ladybird::
|
||||
DESTINATION "${ladybird_INSTALL_CMAKEDIR}"
|
||||
COMPONENT ladybird_Development
|
||||
)
|
||||
|
||||
install(DIRECTORY
|
||||
"${SERENITY_SOURCE_DIR}/Base/res/html"
|
||||
"${SERENITY_SOURCE_DIR}/Base/res/fonts"
|
||||
"${SERENITY_SOURCE_DIR}/Base/res/icons"
|
||||
"${SERENITY_SOURCE_DIR}/Base/res/themes"
|
||||
"${SERENITY_SOURCE_DIR}/Base/res/color-palettes"
|
||||
"${SERENITY_SOURCE_DIR}/Base/res/cursor-themes"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/res"
|
||||
USE_SOURCE_PERMISSIONS MESSAGE_NEVER
|
||||
COMPONENT ladybird_Runtime
|
||||
)
|
1
Ladybird/cmake/LadybirdInstallConfig.cmake
Normal file
1
Ladybird/cmake/LadybirdInstallConfig.cmake
Normal file
|
@ -0,0 +1 @@
|
|||
include("${CMAKE_CURRENT_LIST_DIR}/ladybirdTargets.cmake")
|
Loading…
Reference in a new issue