Skip to content

Commit a0edc08

Browse files
committed
build: parallelise build
Enable parallel compilation when building Foundation. We were previously building Foundation in single threaded mode. This should significantly improve builds.
1 parent 0f18d1a commit a0edc08

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmake/modules/SwiftSupport.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
include(CMakeParseArguments)
3+
include(ProcessorCount)
34

45
# Creates an output file map give a target and its list of sources at
56
# output_path
@@ -43,6 +44,10 @@ function(add_swift_target target)
4344
set(link_flags)
4445

4546
list(APPEND compile_flags -incremental)
47+
ProcessorCount(CPU_COUNT)
48+
if(NOT CPU_COUNT EQUAL 0)
49+
list(APPEND compile_flags -num-threads;${CPU_COUNT})
50+
endif()
4651
if(AST_TARGET)
4752
list(APPEND compile_flags -target;${AST_TARGET})
4853
list(APPEND link_flags -target;${AST_TARGET})

0 commit comments

Comments
 (0)