Skip to content

Commit a476889

Browse files
authored
Merge pull request #2745 from DougGregor/integrated-driver-wmo
[Integrated Swift driver] Pass -whole-module-optimization as appropriate
2 parents 8cfdbab + f16338e commit a476889

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Sources/Build/BuildPlan.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,10 @@ public final class SwiftTargetBuildDescription {
678678

679679
result.append("-module-name")
680680
result.append(target.c99name)
681-
result.append("-incremental")
681+
682682
result.append("-emit-dependencies")
683+
684+
// FIXME: Do we always have a module?
683685
result.append("-emit-module")
684686
result.append("-emit-module-path")
685687
result.append(moduleOutputPath.pathString)
@@ -690,7 +692,14 @@ public final class SwiftTargetBuildDescription {
690692
if target.type == .library || target.type == .test {
691693
result.append("-parse-as-library")
692694
}
693-
// FIXME: WMO
695+
696+
if (buildParameters.configuration == .release) {
697+
result.append("-whole-module-optimization")
698+
result.append("-num-threads")
699+
result.append(String(ProcessInfo.processInfo.activeProcessorCount))
700+
} else {
701+
result.append("-incremental")
702+
}
694703

695704
result.append("-c")
696705
for source in target.sources.paths {

0 commit comments

Comments
 (0)