mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-30 14:20:21 +00:00
Meta: Increase compilation speed with clang-cl
This commit increases compilation speed when using clang-cl. It also decreases object size as well as adds -fstrict-aliasing to match the default on linux. The linker option added is not recognized by link.exe so we enable lld-link by default, which will also increase compilation speed by itself, and allow for LTO.
This commit is contained in:
parent
af056581f6
commit
cdc851141d
Notes:
github-actions[bot]
2025-06-16 17:49:52 +00:00
Author: https://github.com/R-Goc
Commit: cdc851141d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4758
Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 17 additions and 0 deletions
|
@ -72,6 +72,17 @@ if (MSVC)
|
|||
add_link_options(/STACK:0x800000)
|
||||
# disable floating-point expression contraction
|
||||
add_cxx_compile_options(/fp:precise)
|
||||
# reduces object size
|
||||
add_cxx_compile_options(/Zc:inline)
|
||||
# equivalent of -fvisibility-inlines-hidden
|
||||
add_cxx_compile_options(/Zc:dllexportInlines-)
|
||||
# clang-cl has this off by default unlike other clang versions
|
||||
add_cxx_compile_options(-fstrict-aliasing)
|
||||
add_cxx_compile_options(/Gw)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR "Debug")
|
||||
add_cxx_compile_options(-gcodeview-ghash)
|
||||
add_cxx_link_options(/DEBUG:GHASH)
|
||||
endif()
|
||||
else()
|
||||
add_cxx_compile_options(-Wall -Wextra)
|
||||
add_cxx_compile_options(-fno-exceptions)
|
||||
|
|
|
@ -18,6 +18,12 @@ if (NOT APPLE AND NOT ANDROID AND NOT WIN32 AND NOT LAGOM_USE_LINKER)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT LAGOM_USE_LINKER)
|
||||
# We do not need to check for its presence.
|
||||
# We know it is there with the installation of clang-cl which we require.
|
||||
set(LAGOM_USE_LINKER "lld" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
if (LAGOM_USE_LINKER)
|
||||
# FIXME: Move to only setting CMAKE_LINKER_TYPE once we drop support for CMake < 3.29
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.29)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue