mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
Meta: Include RPATH rules at top level to share them with Ladybird
When using Ladybird/ as CMake source directory, the RPATH rules were left at the default, which is almost never correct.
This commit is contained in:
parent
061061bd9c
commit
ea0e07ec8f
Notes:
sideshowbarker
2024-07-17 01:21:02 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/ea0e07ec8f Pull-request: https://github.com/SerenityOS/serenity/pull/20566
@ -63,7 +63,8 @@ if (LADYBIRD_IS_TOP_LEVEL)
|
||||
)
|
||||
list(APPEND CMAKE_MODULE_PATH "${SERENITY_SOURCE_DIR}/Meta/CMake")
|
||||
include(cmake/EnableLagom.cmake)
|
||||
include(lagom_compile_options NO_POLICY_SCOPE)
|
||||
include(lagom_compile_options)
|
||||
include(lagom_install_options)
|
||||
else()
|
||||
# FIXME: Use SERENITY_SOURCE_DIR in Lagom/CMakeLists.txt
|
||||
set(SERENITY_SOURCE_DIR "${SERENITY_PROJECT_ROOT}")
|
||||
|
24
Meta/CMake/lagom_install_options.cmake
Normal file
24
Meta/CMake/lagom_install_options.cmake
Normal file
@ -0,0 +1,24 @@
|
||||
include_guard()
|
||||
|
||||
include(GNUInstallDirs) # make sure to include before we mess w/RPATH
|
||||
|
||||
# Mirror the structure of the installed tree to ensure that rpaths
|
||||
# always remain valid.
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
# 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 (APPLE)
|
||||
set(CMAKE_MACOSX_RPATH TRUE)
|
||||
set(CMAKE_INSTALL_NAME_DIR "@rpath")
|
||||
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
|
||||
else()
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
set(CMAKE_INSTALL_MESSAGE NEVER)
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/common_options.cmake NO_POLICY_SCOPE)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/lagom_install_options.cmake)
|
||||
|
||||
serenity_option(ENABLE_ADDRESS_SANITIZER OFF CACHE BOOL "Enable address sanitizer testing in gcc/clang")
|
||||
serenity_option(ENABLE_MEMORY_SANITIZER OFF CACHE BOOL "Enable memory sanitizer testing in gcc/clang")
|
||||
|
@ -76,31 +76,8 @@ endif()
|
||||
include(flac_spec_tests)
|
||||
include(lagom_compile_options)
|
||||
|
||||
include(GNUInstallDirs) # make sure to include before we mess w/RPATH
|
||||
|
||||
# Mirror the structure of the installed tree to ensure that rpaths
|
||||
# always remain valid.
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
# 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 (APPLE)
|
||||
set(CMAKE_MACOSX_RPATH TRUE)
|
||||
set(CMAKE_INSTALL_NAME_DIR "@rpath")
|
||||
set(CMAKE_INSTALL_RPATH "@loader_path/../lib")
|
||||
else()
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN:$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
|
||||
endif()
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
set(CMAKE_INSTALL_MESSAGE NEVER)
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".js")
|
||||
add_compile_options(-gsource-map)
|
||||
|
Loading…
Reference in New Issue
Block a user