mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
Meta: Move compiler flags into standalone CMake files
This way we can have all of them in a single place, similar to how we structure options added via the serenity_option() macro.
This commit is contained in:
parent
4472cab81a
commit
ee721978f6
Notes:
sideshowbarker
2024-07-17 16:42:19 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/ee721978f6 Pull-request: https://github.com/SerenityOS/serenity/pull/14037
@ -129,10 +129,6 @@ if (NOT HACKSTUDIO_BUILD)
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
if (ENABLE_ALL_DEBUG_FACILITIES)
|
if (ENABLE_ALL_DEBUG_FACILITIES)
|
||||||
set(ENABLE_ALL_THE_DEBUG_MACROS ON)
|
set(ENABLE_ALL_THE_DEBUG_MACROS ON)
|
||||||
set(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS ON)
|
set(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS ON)
|
||||||
@ -165,61 +161,7 @@ set(CMAKE_INSTALL_DATAROOTDIR ${CMAKE_BINARY_DIR}/Root/res)
|
|||||||
# This will need to be revisited when the Loader supports RPATH/RUN_PATH.
|
# This will need to be revisited when the Loader supports RPATH/RUN_PATH.
|
||||||
set(CMAKE_SKIP_RPATH TRUE)
|
set(CMAKE_SKIP_RPATH TRUE)
|
||||||
|
|
||||||
add_compile_options(-Wall)
|
include(serenity_compile_options)
|
||||||
add_compile_options(-Wextra)
|
|
||||||
|
|
||||||
if (NOT CMAKE_HOST_SYSTEM_NAME MATCHES SerenityOS)
|
|
||||||
# FIXME: Something makes this go crazy and flag unused variables that aren't flagged as such when building with the toolchain.
|
|
||||||
# Disable -Werror for now.
|
|
||||||
add_compile_options(-Werror)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# The following warnings are sorted by the "base" name (the part excluding the initial Wno or W).
|
|
||||||
add_compile_options(-Wno-address-of-packed-member)
|
|
||||||
add_compile_options(-Wcast-qual)
|
|
||||||
add_compile_options(-Wdeprecated-copy)
|
|
||||||
add_compile_options(-Wduplicated-cond)
|
|
||||||
add_compile_options(-Wformat=2)
|
|
||||||
add_compile_options(-Wimplicit-fallthrough)
|
|
||||||
add_compile_options(-Wlogical-op)
|
|
||||||
add_compile_options(-Wmisleading-indentation)
|
|
||||||
add_compile_options(-Wmissing-declarations)
|
|
||||||
add_compile_options(-Wnon-virtual-dtor)
|
|
||||||
add_compile_options(-Wsuggest-override)
|
|
||||||
add_compile_options(-Wno-unknown-warning-option)
|
|
||||||
add_compile_options(-Wundef)
|
|
||||||
add_compile_options(-Wunused)
|
|
||||||
add_compile_options(-Wno-unused-command-line-argument)
|
|
||||||
add_compile_options(-Wwrite-strings)
|
|
||||||
|
|
||||||
add_compile_options(-fdiagnostics-color=always)
|
|
||||||
add_compile_options(-fno-delete-null-pointer-checks)
|
|
||||||
add_compile_options(-ffile-prefix-map=${SerenityOS_SOURCE_DIR}=.)
|
|
||||||
add_compile_options(-fno-exceptions)
|
|
||||||
add_compile_options(-fno-semantic-interposition)
|
|
||||||
add_compile_options(-fsized-deallocation)
|
|
||||||
add_compile_options(-fstack-clash-protection)
|
|
||||||
add_compile_options(-fstack-protector-strong)
|
|
||||||
add_compile_options(-g1)
|
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
add_compile_options(-Wno-literal-suffix)
|
|
||||||
add_compile_options(-Wno-maybe-uninitialized)
|
|
||||||
# Only ignore expansion-to-defined for g++, clang's implementation doesn't complain about function-like macros
|
|
||||||
add_compile_options(-Wno-expansion-to-defined)
|
|
||||||
add_compile_options(-Wcast-align)
|
|
||||||
add_compile_options(-Wdouble-promotion)
|
|
||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|
||||||
add_compile_options(-Wno-user-defined-literals)
|
|
||||||
add_compile_options(-Wno-atomic-alignment)
|
|
||||||
add_compile_options(-Wno-implicit-const-int-float-conversion)
|
|
||||||
add_compile_options(-Wno-unused-const-variable)
|
|
||||||
add_compile_options(-Wno-unused-private-field)
|
|
||||||
add_compile_options(-fconstexpr-steps=16777216)
|
|
||||||
|
|
||||||
# Clang doesn't add compiler_rt to the search path when compiling with -nostdlib.
|
|
||||||
link_directories(${TOOLCHAIN_ROOT}/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/${SERENITY_ARCH}-pc-serenity/)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_link_options(LINKER:-z,text)
|
add_link_options(LINKER:-z,text)
|
||||||
add_link_options(LINKER:--no-allow-shlib-undefined)
|
add_link_options(LINKER:--no-allow-shlib-undefined)
|
||||||
|
12
Meta/CMake/common_compile_options.cmake
Normal file
12
Meta/CMake/common_compile_options.cmake
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
|
add_compile_options(-Wall)
|
||||||
|
add_compile_options(-Wextra)
|
||||||
|
|
||||||
|
if (NOT CMAKE_HOST_SYSTEM_NAME MATCHES SerenityOS)
|
||||||
|
# FIXME: Something makes this go crazy and flag unused variables that aren't flagged as such when building with the toolchain.
|
||||||
|
# Disable -Werror for now.
|
||||||
|
add_compile_options(-Werror)
|
||||||
|
endif()
|
14
Meta/CMake/lagom_compile_options.cmake
Normal file
14
Meta/CMake/lagom_compile_options.cmake
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/common_compile_options.cmake)
|
||||||
|
|
||||||
|
add_compile_options(-Wno-implicit-const-int-float-conversion)
|
||||||
|
add_compile_options(-Wno-literal-suffix)
|
||||||
|
add_compile_options(-Wno-maybe-uninitialized)
|
||||||
|
add_compile_options(-Wno-unknown-warning-option)
|
||||||
|
add_compile_options(-fsigned-char)
|
||||||
|
add_compile_options(-fno-exceptions)
|
||||||
|
add_compile_options(-fdiagnostics-color=always)
|
||||||
|
add_compile_options(-fPIC -g)
|
||||||
|
add_compile_options(-O2)
|
||||||
|
if (NOT ENABLE_FUZZERS)
|
||||||
|
add_compile_options(-fno-semantic-interposition)
|
||||||
|
endif()
|
48
Meta/CMake/serenity_compile_options.cmake
Normal file
48
Meta/CMake/serenity_compile_options.cmake
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/common_compile_options.cmake)
|
||||||
|
|
||||||
|
# The following warnings are sorted by the "base" name (the part excluding the initial Wno or W).
|
||||||
|
add_compile_options(-Wno-address-of-packed-member)
|
||||||
|
add_compile_options(-Wcast-qual)
|
||||||
|
add_compile_options(-Wdeprecated-copy)
|
||||||
|
add_compile_options(-Wduplicated-cond)
|
||||||
|
add_compile_options(-Wformat=2)
|
||||||
|
add_compile_options(-Wimplicit-fallthrough)
|
||||||
|
add_compile_options(-Wlogical-op)
|
||||||
|
add_compile_options(-Wmisleading-indentation)
|
||||||
|
add_compile_options(-Wmissing-declarations)
|
||||||
|
add_compile_options(-Wnon-virtual-dtor)
|
||||||
|
add_compile_options(-Wsuggest-override)
|
||||||
|
add_compile_options(-Wno-unknown-warning-option)
|
||||||
|
add_compile_options(-Wundef)
|
||||||
|
add_compile_options(-Wunused)
|
||||||
|
add_compile_options(-Wno-unused-command-line-argument)
|
||||||
|
add_compile_options(-Wwrite-strings)
|
||||||
|
|
||||||
|
add_compile_options(-fdiagnostics-color=always)
|
||||||
|
add_compile_options(-fno-delete-null-pointer-checks)
|
||||||
|
add_compile_options(-ffile-prefix-map=${SerenityOS_SOURCE_DIR}=.)
|
||||||
|
add_compile_options(-fno-exceptions)
|
||||||
|
add_compile_options(-fno-semantic-interposition)
|
||||||
|
add_compile_options(-fsized-deallocation)
|
||||||
|
add_compile_options(-fstack-clash-protection)
|
||||||
|
add_compile_options(-fstack-protector-strong)
|
||||||
|
add_compile_options(-g1)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
add_compile_options(-Wno-literal-suffix)
|
||||||
|
add_compile_options(-Wno-maybe-uninitialized)
|
||||||
|
# Only ignore expansion-to-defined for g++, clang's implementation doesn't complain about function-like macros
|
||||||
|
add_compile_options(-Wno-expansion-to-defined)
|
||||||
|
add_compile_options(-Wcast-align)
|
||||||
|
add_compile_options(-Wdouble-promotion)
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
||||||
|
add_compile_options(-Wno-user-defined-literals)
|
||||||
|
add_compile_options(-Wno-atomic-alignment)
|
||||||
|
add_compile_options(-Wno-implicit-const-int-float-conversion)
|
||||||
|
add_compile_options(-Wno-unused-const-variable)
|
||||||
|
add_compile_options(-Wno-unused-private-field)
|
||||||
|
add_compile_options(-fconstexpr-steps=16777216)
|
||||||
|
|
||||||
|
# Clang doesn't add compiler_rt to the search path when compiling with -nostdlib.
|
||||||
|
link_directories(${TOOLCHAIN_ROOT}/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/${SERENITY_ARCH}-pc-serenity/)
|
||||||
|
endif()
|
@ -60,22 +60,7 @@ if (ENABLE_FUZZERS_LIBFUZZER OR ENABLE_FUZZERS_OSSFUZZ)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(wasm_spec_tests)
|
include(wasm_spec_tests)
|
||||||
|
include(lagom_compile_options)
|
||||||
add_compile_options(-fsigned-char)
|
|
||||||
add_compile_options(-Wno-unknown-warning-option -Wno-literal-suffix -Wno-implicit-const-int-float-conversion)
|
|
||||||
add_compile_options(-O2)
|
|
||||||
add_compile_options(-Wall -Wextra -Werror)
|
|
||||||
add_compile_options(-fPIC -g)
|
|
||||||
add_compile_options(-Wno-maybe-uninitialized)
|
|
||||||
add_compile_options(-fno-exceptions)
|
|
||||||
add_compile_options(-fdiagnostics-color=always)
|
|
||||||
if (NOT ENABLE_FUZZERS)
|
|
||||||
add_compile_options(-fno-semantic-interposition)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
include(GNUInstallDirs) # make sure to include before we mess w/RPATH
|
include(GNUInstallDirs) # make sure to include before we mess w/RPATH
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user