Skip to content

Commit ca5a020

Browse files
committed
[CMake] '-no-emit-module-separately-wmo' for swift modules
Emitting modules in separate frontend job doesn't give any benefits because single add_library is just a single job from CMake's point of view. Clients need to wait for `.dylib`/`.so` being emitted before using the `.swiftmodule`. *Not* emitting modules separately is actually faster in CMake because it doesn't parse and typecheck the source code twice.
1 parent 4c60e03 commit ca5a020

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: cmake/modules/AddPureSwift.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ function(_add_host_swift_compile_options name)
2828
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>")
2929
endif()
3030

31+
# Emitting module seprately doesn't give us any benefit.
32+
target_compile_options(${name} PRIVATE
33+
"$<$<COMPILE_LANGUAGE:Swift>:-no-emit-module-separately-wmo>")
34+
3135
if(SWIFT_ANALYZE_CODE_COVERAGE)
3236
set(_cov_flags $<$<COMPILE_LANGUAGE:Swift>:-profile-generate -profile-coverage-mapping>)
3337
target_compile_options(${name} PRIVATE ${_cov_flags})

0 commit comments

Comments
 (0)