mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01: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
|
|
@ -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…
Reference in New Issue
Block a user