Skip to content

Commit f2aec02

Browse files
committed
Work around Linux bot not having 'cmake --build . -j' flag.
1 parent dc7b6ac commit f2aec02

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

emsdk.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,14 +926,18 @@ def make_build(build_root, build_type, build_target_platform='x64'):
926926
else:
927927
print('Performing a singlethreaded build.')
928928

929-
make = ['cmake', '--build', '.', '--config', build_type, '-j', str(CPU_CORES)]
929+
make = ['cmake', '--build', '.', '--config', build_type]
930930
if 'Visual Studio' in CMAKE_GENERATOR:
931931
# Visual Studio historically has had a two-tier problem in its build system design. A single MSBuild.exe instance only governs
932932
# the build of a single project (.exe/.lib/.dll) in a solution. Passing the -j parameter above will only enable multiple MSBuild.exe
933933
# instances to be spawned to build multiple projects in parallel, but each MSBuild.exe is still singlethreaded.
934934
# To enable each MSBuild.exe instance to also compile several .cpp files in parallel inside a single project, pass the extra
935935
# MSBuild.exe specific "Multi-ToolTask" (MTT) setting /p:CL_MPCount. This enables each MSBuild.exe to parallelize builds wide.
936-
make += ['--', '/p:CL_MPCount=' + str(CPU_CORES)]
936+
# This requires CMake 3.12 or newer.
937+
make += ['-j', str(CPU_CORES), '--', '/p:CL_MPCount=' + str(CPU_CORES)]
938+
else:
939+
# Pass -j to native make, CMake might not support -j option.
940+
make += ['--', '-j', str(CPU_CORES)]
937941

938942
# Build
939943
try:

0 commit comments

Comments
 (0)