mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:57:35 +00:00
Kernel: Add a CMake flag to enable LTO for the kernel
This commit is contained in:
parent
55ae52fdf8
commit
6288ae2c37
2 changed files with 8 additions and 2 deletions
|
@ -27,6 +27,7 @@ option(ENABLE_COMPILETIME_FORMAT_CHECK "Enable compiletime format string checks"
|
||||||
option(ENABLE_PCI_IDS_DOWNLOAD "Enable download of the pci.ids database at build time" ON)
|
option(ENABLE_PCI_IDS_DOWNLOAD "Enable download of the pci.ids database at build time" ON)
|
||||||
option(BUILD_LAGOM "Build parts of the system targeting the host OS for fuzzing/testing" OFF)
|
option(BUILD_LAGOM "Build parts of the system targeting the host OS for fuzzing/testing" OFF)
|
||||||
option(PRECOMPILE_COMMON_HEADERS "Precompile some common headers to speedup compilation" OFF)
|
option(PRECOMPILE_COMMON_HEADERS "Precompile some common headers to speedup compilation" OFF)
|
||||||
|
option(ENABLE_KERNEL_LTO "Build the kernel with link-time optimization" OFF)
|
||||||
|
|
||||||
add_custom_target(run
|
add_custom_target(run
|
||||||
COMMAND ${CMAKE_SOURCE_DIR}/Meta/run.sh
|
COMMAND ${CMAKE_SOURCE_DIR}/Meta/run.sh
|
||||||
|
@ -124,9 +125,9 @@ else()
|
||||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
|
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
|
||||||
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}gcc)
|
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}gcc)
|
||||||
set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}ld)
|
set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}ld)
|
||||||
set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}ranlib)
|
set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}gcc-ranlib)
|
||||||
set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}strip)
|
set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}strip)
|
||||||
set(CMAKE_AR ${TOOLCHAIN_PREFIX}ar)
|
set(CMAKE_AR ${TOOLCHAIN_PREFIX}gcc-ar)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(lang ASM C CXX OBJC OBJCXX)
|
foreach(lang ASM C CXX OBJC OBJCXX)
|
||||||
|
|
|
@ -361,6 +361,11 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(Kernel ${SOURCES})
|
add_executable(Kernel ${SOURCES})
|
||||||
|
if (ENABLE_KERNEL_LTO)
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
check_ipo_supported()
|
||||||
|
set_property(TARGET Kernel PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
|
endif()
|
||||||
target_link_libraries(Kernel kernel_heap gcc stdc++)
|
target_link_libraries(Kernel kernel_heap gcc stdc++)
|
||||||
add_dependencies(Kernel boot kernel_heap)
|
add_dependencies(Kernel boot kernel_heap)
|
||||||
install(TARGETS Kernel RUNTIME DESTINATION boot)
|
install(TARGETS Kernel RUNTIME DESTINATION boot)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue