Skip to content

Commit 3d059c4

Browse files
authored
Merge pull request #1705 from compnerd/disable
build: add an option to control WMO
2 parents 239de6c + 010fde7 commit 3d059c4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/${SWIFT_HOST_LIBRARI
2323

2424
set(CMAKE_MACOSX_RPATH YES)
2525

26+
option(SWIFT_SYNTAX_ENABLE_WMO_PRE_3_26
27+
"Enable Whole Module Optimization (WMO) - requires swift-driver"
28+
$<IF:$<AND:$<NOT:$<CONFIG:Debug>>,$<PLATFORM_ID:Darwin>>,YES,NO>)
29+
2630
include(AddSwiftHostLibrary)
2731

2832
# Ensure that we do not link the _StringProcessing module. But we can

cmake/modules/AddSwiftHostLibrary.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ function(add_swift_host_library name)
5656
-emit-module-interface-path;${module_interface_file}
5757
>)
5858

59-
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
59+
if(CMAKE_VERSION VERSION_LESS 3.26.0 AND SWIFT_SYNTAX_ENABLE_WMO_PRE_3_26)
6060
target_compile_options(${name} PRIVATE
61-
$<$<COMPILE_LANGUAGE:Swift>:
62-
-wmo
63-
>)
61+
$<$<COMPILE_LANGUAGE:Swift>:-wmo>)
6462
endif()
6563

6664
# NOTE: workaround for CMake not setting up include flags yet

0 commit comments

Comments
 (0)