diff --git a/CMakeLists.txt b/CMakeLists.txt index f5e1d8f7ba..ca5a007113 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ set(LADYBIRD_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") list(APPEND CMAKE_MODULE_PATH "${LADYBIRD_SOURCE_DIR}/Meta/CMake") include(UI/cmake/EnableLagom.cmake) -include(lagom_options NO_POLICY_SCOPE) +include(cmake_options NO_POLICY_SCOPE) include(compile_options) # We need to find OpenSSL in order to link it explicitly with all targets. diff --git a/Meta/CMake/common_options.cmake b/Meta/CMake/cmake_options.cmake similarity index 66% rename from Meta/CMake/common_options.cmake rename to Meta/CMake/cmake_options.cmake index 1d4636c8ac..33ef18acb7 100644 --- a/Meta/CMake/common_options.cmake +++ b/Meta/CMake/cmake_options.cmake @@ -27,6 +27,26 @@ ladybird_option(LADYBIRD_ENABLE_CPPTRACE ON CACHE BOOL "Enable use of cpptrace a ladybird_option(LADYBIRD_GENERATE_DSYM OFF CACHE BOOL "Generate dSYM bundles for binaries and libraries (macOS only)") ladybird_option(ENABLE_CI_BASELINE_CPU OFF CACHE BOOL "Use a baseline CPU target for improved ccache sharing") +# 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() + +ladybird_option(ENABLE_ADDRESS_SANITIZER OFF CACHE BOOL "Enable address sanitizer testing in gcc/clang") +ladybird_option(ENABLE_MEMORY_SANITIZER OFF CACHE BOOL "Enable memory sanitizer testing in gcc/clang") +ladybird_option(ENABLE_FUZZERS OFF CACHE BOOL "Build fuzzing targets") +ladybird_option(ENABLE_FUZZERS_LIBFUZZER OFF CACHE BOOL "Build fuzzers using Clang's libFuzzer") +ladybird_option(ENABLE_FUZZERS_OSSFUZZ OFF CACHE BOOL "Build OSS-Fuzz compatible fuzzers") +ladybird_option(LAGOM_TOOLS_ONLY OFF CACHE BOOL "Don't build libraries, utilities and tests, only host build tools") +ladybird_option(ENABLE_LAGOM_CCACHE ON CACHE BOOL "Enable ccache for Lagom builds") +ladybird_option(LAGOM_USE_LINKER "" CACHE STRING "The linker to use (e.g. lld, mold) instead of the system default") +ladybird_option(LAGOM_LINK_POOL_SIZE "" CACHE STRING "The maximum number of parallel jobs to use for linking") +ladybird_option(ENABLE_LTO_FOR_RELEASE ${RELEASE_LTO_DEFAULT} CACHE BOOL "Enable link-time optimization for release builds") +ladybird_option(ENABLE_LAGOM_COVERAGE_COLLECTION OFF CACHE STRING "Enable code coverage instrumentation for lagom binaries in clang") + ladybird_option(ENABLE_RUST ON CACHE BOOL "Build Rust components") if (ENABLE_FUZZERS_LIBFUZZER) @@ -53,3 +73,5 @@ check_cxx_source_compiles([=[ ]=] CXX_COMPILER_SUPPORTS_OBJC_ARC) unset(CMAKE_REQUIRED_FLAGS) unset(CMAKE_REQUIRED_LIBRARIES) + +include(${CMAKE_CURRENT_LIST_DIR}/lagom_install_options.cmake) diff --git a/Meta/CMake/lagom_options.cmake b/Meta/CMake/lagom_options.cmake deleted file mode 100644 index 25112f62d4..0000000000 --- a/Meta/CMake/lagom_options.cmake +++ /dev/null @@ -1,26 +0,0 @@ -# -# Options specific to the Lagom (host) build -# - -include(${CMAKE_CURRENT_LIST_DIR}/common_options.cmake NO_POLICY_SCOPE) -include(${CMAKE_CURRENT_LIST_DIR}/lagom_install_options.cmake) - -# 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() - -ladybird_option(ENABLE_ADDRESS_SANITIZER OFF CACHE BOOL "Enable address sanitizer testing in gcc/clang") -ladybird_option(ENABLE_MEMORY_SANITIZER OFF CACHE BOOL "Enable memory sanitizer testing in gcc/clang") -ladybird_option(ENABLE_FUZZERS OFF CACHE BOOL "Build fuzzing targets") -ladybird_option(ENABLE_FUZZERS_LIBFUZZER OFF CACHE BOOL "Build fuzzers using Clang's libFuzzer") -ladybird_option(ENABLE_FUZZERS_OSSFUZZ OFF CACHE BOOL "Build OSS-Fuzz compatible fuzzers") -ladybird_option(LAGOM_TOOLS_ONLY OFF CACHE BOOL "Don't build libraries, utilities and tests, only host build tools") -ladybird_option(ENABLE_LAGOM_CCACHE ON CACHE BOOL "Enable ccache for Lagom builds") -ladybird_option(LAGOM_USE_LINKER "" CACHE STRING "The linker to use (e.g. lld, mold) instead of the system default") -ladybird_option(LAGOM_LINK_POOL_SIZE "" CACHE STRING "The maximum number of parallel jobs to use for linking") -ladybird_option(ENABLE_LTO_FOR_RELEASE ${RELEASE_LTO_DEFAULT} CACHE BOOL "Enable link-time optimization for release builds") -ladybird_option(ENABLE_LAGOM_COVERAGE_COLLECTION OFF CACHE STRING "Enable code coverage instrumentation for lagom binaries in clang") diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 411582632c..19ff4a8bc5 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -41,7 +41,7 @@ endif() include(check_for_dependencies) include(use_linker) include(gui_framework) -include(lagom_options NO_POLICY_SCOPE) +include(cmake_options NO_POLICY_SCOPE) if(ENABLE_ALL_THE_DEBUG_MACROS) include(all_the_debug_macros)