Commit 8eed9a46 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-22613 Windows - reduce package size

Liposuction of about 20% package size is achieved by using
linker /OPT:REF,ICF and compile option /Gw
parent 21321fcb
...@@ -186,9 +186,8 @@ IF(MSVC) ...@@ -186,9 +186,8 @@ IF(MSVC)
STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}") STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF")
IF(NOT CLANG_CL) IF(NOT CLANG_CL)
SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /release") STRING(APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO " /release /OPT:REF,ICF")
ENDIF() ENDIF()
IF(DYNAMIC_UCRT_LINK AND (MSVC_CRT_TYPE STREQUAL "/MT")) IF(DYNAMIC_UCRT_LINK AND (MSVC_CRT_TYPE STREQUAL "/MT"))
FOREACH(config RELEASE RELWITHDEBINFO DEBUG MINSIZEREL) FOREACH(config RELEASE RELWITHDEBINFO DEBUG MINSIZEREL)
...@@ -208,6 +207,8 @@ IF(MSVC) ...@@ -208,6 +207,8 @@ IF(MSVC)
IF (NOT CLANG_CL) IF (NOT CLANG_CL)
STRING(APPEND CMAKE_C_FLAGS " /MP") STRING(APPEND CMAKE_C_FLAGS " /MP")
STRING(APPEND CMAKE_CXX_FLAGS " /MP") STRING(APPEND CMAKE_CXX_FLAGS " /MP")
STRING(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " /Gw")
STRING(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /Gw")
ENDIF() ENDIF()
#TODO: update the code and remove the disabled warnings #TODO: update the code and remove the disabled warnings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment