mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Meta: Move all options to targetname_options.cmake files
This common strategy of having a serenity_option() macro defined in either the Lagom or top level CMakeLists.txt allows us to do two things: First, we can more clearly see which options are Serenity-specific, Lagom-specific, or common between the target and host builds. Second, it enables the upcoming SuperBuild changes to set() the options in the SuperBuild's CMake cache and forward each target's options to the corresponding ExternalProject.
This commit is contained in:
parent
6e7cc40b18
commit
904a268872
Notes:
sideshowbarker
2024-07-18 03:56:06 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/904a2688724 Pull-request: https://github.com/SerenityOS/serenity/pull/9297 Issue: https://github.com/SerenityOS/serenity/issues/9425 Reviewed-by: https://github.com/bgianfo
6 changed files with 50 additions and 19 deletions
|
@ -23,6 +23,13 @@ enable_testing()
|
|||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if(NOT COMMAND serenity_option)
|
||||
macro(serenity_option)
|
||||
set(${ARGV})
|
||||
endmacro()
|
||||
endif()
|
||||
include(serenity_options)
|
||||
|
||||
set(SERENITY_ARCH "i686" CACHE STRING "Target architecture for SerenityOS.")
|
||||
|
||||
if("${SERENITY_ARCH}" STREQUAL "i686")
|
||||
|
@ -31,22 +38,6 @@ else()
|
|||
set(SERENITY_CLANG_ARCH ${SERENITY_ARCH})
|
||||
endif()
|
||||
|
||||
# Central location for all custom options used in the Serenity build.
|
||||
option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer testing in gcc/clang" OFF)
|
||||
option(ENABLE_KERNEL_ADDRESS_SANITIZER "Enable kernel address sanitizer testing in gcc/clang" OFF)
|
||||
option(ENABLE_KERNEL_COVERAGE_COLLECTION "Enable KCOV and kernel coverage instrumentation in gcc/clang" OFF)
|
||||
option(ENABLE_MEMORY_SANITIZER "Enable memory sanitizer testing in gcc/clang" OFF)
|
||||
option(ENABLE_UNDEFINED_SANITIZER "Enable undefined behavior sanitizer testing in gcc/clang" OFF)
|
||||
option(ENABLE_FUZZER_SANITIZER "Enable fuzzer sanitizer testing in clang" OFF)
|
||||
option(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS "Enable -Og and -ggdb3 options for Kernel code for easier debugging" OFF)
|
||||
option(ENABLE_ALL_THE_DEBUG_MACROS "Enable all debug macros to validate they still compile" OFF)
|
||||
option(ENABLE_ALL_DEBUG_FACILITIES "Enable all noisy debug symbols and options. Not recommended for normal developer use" OFF)
|
||||
option(ENABLE_COMPILETIME_FORMAT_CHECK "Enable compiletime format string checks" ON)
|
||||
option(ENABLE_PCI_IDS_DOWNLOAD "Enable download of the pci.ids database at build time" ON)
|
||||
option(ENABLE_USB_IDS_DOWNLOAD "Enable download of the usb.ids database at build time" ON)
|
||||
option(BUILD_LAGOM "Build parts of the system targeting the host OS for fuzzing/testing" OFF)
|
||||
option(ENABLE_KERNEL_LTO "Build the kernel with link-time optimization" OFF)
|
||||
option(USE_CLANG_TOOLCHAIN "Build the kernel with the experimental Clang toolchain" OFF)
|
||||
|
||||
# Meta target to run all code-gen steps in the build.
|
||||
add_custom_target(all_generated)
|
||||
|
|
12
Meta/CMake/common_options.cmake
Normal file
12
Meta/CMake/common_options.cmake
Normal file
|
@ -0,0 +1,12 @@
|
|||
#
|
||||
# Options common for the Serenity (target) and Lagom (host) builds
|
||||
#
|
||||
|
||||
serenity_option(ENABLE_COMPILETIME_FORMAT_CHECK ON CACHE BOOL "Enable compiletime format string checks")
|
||||
serenity_option(ENABLE_UNDEFINED_SANITIZER OFF CACHE BOOL "Enable undefined behavior sanitizer testing in gcc/clang")
|
||||
|
||||
serenity_option(ENABLE_ALL_THE_DEBUG_MACROS OFF CACHE BOOL "Enable all debug macros to validate they still compile")
|
||||
serenity_option(ENABLE_ALL_DEBUG_FACILITIES OFF CACHE BOOL "Enable all noisy debug symbols and options. Not recommended for normal developer use")
|
||||
|
||||
serenity_option(ENABLE_UNICODE_DATABASE_DOWNLOAD ON CACHE BOOL "Enable download of Unicode UCD and CLDR files at build time")
|
||||
serenity_option(INCLUDE_WASM_SPEC_TESTS OFF CACHE BOOL "Download and include the WebAssembly spec testsuite")
|
11
Meta/CMake/lagom_options.cmake
Normal file
11
Meta/CMake/lagom_options.cmake
Normal file
|
@ -0,0 +1,11 @@
|
|||
#
|
||||
# Options specific to the Lagom (host) build
|
||||
#
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/common_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")
|
||||
serenity_option(ENABLE_FUZZER_SANITIZER OFF CACHE BOOL "Enable fuzzer sanitizer testing in clang")
|
||||
serenity_option(BUILD_LAGOM OFF CACHE BOOL "Build parts of the system targeting the host OS for fuzzing/testing")
|
||||
serenity_option(ENABLE_LAGOM_CCACHE OFF CACHE BOOL "Enable ccache for Lagom builds")
|
12
Meta/CMake/serenity_options.cmake
Normal file
12
Meta/CMake/serenity_options.cmake
Normal file
|
@ -0,0 +1,12 @@
|
|||
#
|
||||
# Options specific to the Serenity (target) build
|
||||
#
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/common_options.cmake)
|
||||
|
||||
serenity_option(ENABLE_PCI_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the pci.ids database at build time")
|
||||
serenity_option(ENABLE_USB_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the usb.ids database at build time")
|
||||
serenity_option(ENABLE_KERNEL_ADDRESS_SANITIZER OFF CACHE BOOL "Enable kernel address sanitizer testing in gcc/clang")
|
||||
serenity_option(ENABLE_KERNEL_COVERAGE_COLLECTION OFF CACHE BOOL "Enable KCOV and kernel coverage instrumentation in gcc/clang")
|
||||
serenity_option(ENABLE_KERNEL_LTO OFF CACHE BOOL "Build the kernel with link-time optimization")
|
||||
serenity_option(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS OFF CACHE BOOL "Enable -Og and -ggdb3 options for Kernel code for easier debugging")
|
|
@ -1,5 +1,3 @@
|
|||
option(INCLUDE_WASM_SPEC_TESTS "Download and include the WebAssembly spec testsuite" OFF)
|
||||
|
||||
if(INCLUDE_WASM_SPEC_TESTS)
|
||||
if (CMAKE_PROJECT_NAME STREQUAL "SerenityOS")
|
||||
set(SOURCE_DIR "${SerenityOS_SOURCE_DIR}")
|
||||
|
|
|
@ -8,7 +8,6 @@ project(
|
|||
LANGUAGES C CXX
|
||||
)
|
||||
|
||||
option(ENABLE_LAGOM_CCACHE "Enable ccache for Lagom builds" OFF)
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries instead of static libraries" ON)
|
||||
if (ENABLE_OSS_FUZZ)
|
||||
set(BUILD_SHARED_LIBS OFF) # Don't use shared libraries on oss-fuzz, for ease of integration with their infrastructure
|
||||
|
@ -26,6 +25,14 @@ get_filename_component(
|
|||
|
||||
list(APPEND CMAKE_MODULE_PATH "${SERENITY_PROJECT_ROOT}/Meta/CMake")
|
||||
|
||||
if(NOT COMMAND serenity_option)
|
||||
macro(serenity_option)
|
||||
set(${ARGV})
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
include(lagom_options)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if (ENABLE_LAGOM_CCACHE)
|
||||
|
|
Loading…
Reference in a new issue