diff --git a/Meta/CMake/common_compile_options.cmake b/Meta/CMake/common_compile_options.cmake index c6956797e3f..0dd4a727bf3 100644 --- a/Meta/CMake/common_compile_options.cmake +++ b/Meta/CMake/common_compile_options.cmake @@ -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) diff --git a/Meta/CMake/use_linker.cmake b/Meta/CMake/use_linker.cmake index 904fbe169c7..3f0619e957a 100644 --- a/Meta/CMake/use_linker.cmake +++ b/Meta/CMake/use_linker.cmake @@ -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)