Truly independent web browser
Meta: Rename ENABLE_LTO_FOR_RELEASE to LADYBIRD_ENABLE_LTO
Jelle Raaijmakersa9734d6672d3
diff --git a/Documentation/AdvancedBuildInstructions.md b/Documentation/AdvancedBuildInstructions.mdindex 9222139396b..2528600d2cc 100644--- a/Documentation/AdvancedBuildInstructions.md+++ b/Documentation/AdvancedBuildInstructions.md@@ -45,7 +45,7 @@ There are some optional features that can be enabled during compilation that are- `ENABLE_LAGOM_CCACHE`: compiles through ccache when it is installed. Enabled by default.- `LAGOM_USE_LINKER`: sets the linker to use, such as `lld` or `mold`, instead of the compiler's default. On Linux and the BSDs, LLD or mold is picked automatically when one of them is installed.- `LAGOM_LINK_POOL_SIZE`: sets the maximum number of link jobs that run at once.-- `ENABLE_LTO_FOR_RELEASE`: enables link-time optimization in Release builds. Enabled by default, except for static builds with GCC.+- `LADYBIRD_ENABLE_LTO`: enables link-time optimization. Disabled by default and enabled by the `Distribution` preset. Static builds with GCC need a lot of memory with it.- `LADYBIRD_ENABLE_CPPTRACE`: uses cpptrace for stack traces when it is available, and `backtrace.h` otherwise. Enabled by default.- `LADYBIRD_GENERATE_SYMBOL_FILES`: builds with debug information and writes the symbols of the installed executables to separate files. Enabled by the `Distribution` preset. Not supported with MSVC-style toolchains.- `LADYBIRD_GENERATE_DSYM`: generates dSYM bundles for executables and libraries on macOS.diff --git a/Meta/CMake/cmake_options.cmake b/Meta/CMake/cmake_options.cmakeindex f174cf4525f..8b270e0efa3 100644--- a/Meta/CMake/cmake_options.cmake+++ b/Meta/CMake/cmake_options.cmake@@ -58,14 +58,6 @@ set(LADYBIRD_RELEASE_STAGE "Alpha")# Like other browsers, our Linux packages keep Ladybird in a directory of its own.set(LADYBIRD_PACKAGE_INSTALL_PREFIX "/opt/ladybird")-# lto1 uses a crazy amount of RAM in static builds.-# Disable LTO for static gcc builds unless explicitly asked for.-if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT BUILD_SHARED_LIBS)- set(RELEASE_LTO_DEFAULT OFF)-else()- set(RELEASE_LTO_DEFAULT ON)-endif()-option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer testing in gcc/clang" OFF)option(ENABLE_MEMORY_SANITIZER "Enable memory sanitizer testing in gcc/clang" OFF)option(ENABLE_THREAD_SANITIZER "Enable thread sanitizer testing in gcc/clang" OFF)@@ -75,7 +67,7 @@ option(ENABLE_FUZZERS_OSSFUZZ "Build OSS-Fuzz compatible fuzzers" OFF)option(ENABLE_LAGOM_CCACHE "Enable ccache for Lagom builds" ON)set(LAGOM_USE_LINKER "" CACHE STRING "The linker to use (e.g. lld, mold) instead of the system default")set(LAGOM_LINK_POOL_SIZE "" CACHE STRING "The maximum number of parallel jobs to use for linking")-option(ENABLE_LTO_FOR_RELEASE "Enable link-time optimization for release builds" ${RELEASE_LTO_DEFAULT})+option(LADYBIRD_ENABLE_LTO "Enable link-time optimization" OFF)option(ENABLE_LAGOM_COVERAGE_COLLECTION "Enable code coverage instrumentation for lagom binaries in clang" OFF)if (ENABLE_FUZZERS_LIBFUZZER)diff --git a/Meta/CMake/compile_options.cmake b/Meta/CMake/compile_options.cmakeindex 5641fcd3d00..bfaff30ec8f 100644--- a/Meta/CMake/compile_options.cmake+++ b/Meta/CMake/compile_options.cmake@@ -321,15 +321,15 @@ elseif (CMAKE_BUILD_TYPE STREQUAL "Release")else()add_cxx_compile_options(/O2)endif()+endif()- if (ENABLE_LTO_FOR_RELEASE)- include(CheckIPOSupported)- check_ipo_supported(RESULT IPO_AVAILABLE OUTPUT output)- if(IPO_AVAILABLE)- set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)- else()- message(WARNING "Not enabling IPO as it is not supported: ${output}")- endif()+if (LADYBIRD_ENABLE_LTO)+ include(CheckIPOSupported)+ check_ipo_supported(RESULT IPO_AVAILABLE OUTPUT output)+ if(IPO_AVAILABLE)+ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)+ else()+ message(WARNING "Not enabling IPO as it is not supported: ${output}")endif()endif()diff --git a/Meta/CMake/flatpak/org.ladybird.Ladybird.json b/Meta/CMake/flatpak/org.ladybird.Ladybird.jsonindex 2044c94594a..8c37d0b94af 100644--- a/Meta/CMake/flatpak/org.ladybird.Ladybird.json+++ b/Meta/CMake/flatpak/org.ladybird.Ladybird.json@@ -795,6 +795,7 @@"-DCMAKE_C_COMPILER=clang","-DCMAKE_CXX_COMPILER=clang++","-DLADYBIRD_BASELINE_CPU_TARGET=ON",+ "-DLADYBIRD_ENABLE_LTO=ON","-DLADYBIRD_GENERATE_SYMBOL_FILES=ON","-DENABLE_INSTALL_HEADERS=OFF","-DBUILD_TESTING=OFF",diff --git a/Meta/CMake/presets/CMakeBasePresets.json b/Meta/CMake/presets/CMakeBasePresets.jsonindex c0a82329a14..71108d15ece 100644--- a/Meta/CMake/presets/CMakeBasePresets.json+++ b/Meta/CMake/presets/CMakeBasePresets.json@@ -59,7 +59,6 @@"cacheVariables": {"CMAKE_BUILD_TYPE": "RelWithDebInfo","LADYBIRD_VCPKG_TYPE": "release",- "ENABLE_LTO_FOR_RELEASE": "OFF","ENABLE_THREAD_SANITIZER": "ON"}},@@ -86,6 +85,7 @@"BUILD_SHARED_LIBS": "OFF","CMAKE_BUILD_TYPE": "Release","LADYBIRD_BASELINE_CPU_TARGET": "ON",+ "LADYBIRD_ENABLE_LTO": "ON","LADYBIRD_GENERATE_SYMBOL_FILES": "ON","LADYBIRD_VCPKG_TYPE": "distribution"}