diff --git a/Ladybird/CMakeLists.txt b/Ladybird/CMakeLists.txt index cdbacedde96..49692399f5e 100644 --- a/Ladybird/CMakeLists.txt +++ b/Ladybird/CMakeLists.txt @@ -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() diff --git a/Ladybird/cmake/InstallRules.cmake b/Ladybird/cmake/InstallRules.cmake new file mode 100644 index 00000000000..04a222f5be6 --- /dev/null +++ b/Ladybird/cmake/InstallRules.cmake @@ -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 +) diff --git a/Ladybird/cmake/LadybirdInstallConfig.cmake b/Ladybird/cmake/LadybirdInstallConfig.cmake new file mode 100644 index 00000000000..b308ac1c0a7 --- /dev/null +++ b/Ladybird/cmake/LadybirdInstallConfig.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/ladybirdTargets.cmake")