MCPcopy Index your code
hub / github.com/emscripten-core/emsdk / make_build

Function make_build

emsdk.py:965–999  ·  view source on GitHub ↗
(build_root, build_type)

Source from the content-addressed store, hash-verified

963
964
965def make_build(build_root, build_type):
966 debug_print(f'make_build(build_root={build_root}, build_type={build_type})')
967 if CPU_CORES > 1:
968 print(f'Performing a parallel build with {CPU_CORES} cores.')
969 else:
970 print('Performing a singlethreaded build.')
971
972 make = [find_cmake(), '--build', '.', '--config', build_type]
973 if 'Visual Studio' in CMAKE_GENERATOR:
974 # Visual Studio historically has had a two-tier problem in its build system design. A single MSBuild.exe instance only governs
975 # the build of a single project (.exe/.lib/.dll) in a solution. Passing the -j parameter above will only enable multiple MSBuild.exe
976 # instances to be spawned to build multiple projects in parallel, but each MSBuild.exe is still singlethreaded.
977 # To enable each MSBuild.exe instance to also compile several .cpp files in parallel inside a single project, pass the extra
978 # MSBuild.exe specific "Multi-ToolTask" (MTT) setting /p:CL_MPCount. This enables each MSBuild.exe to parallelize builds wide.
979 # This requires CMake 3.12 or newer.
980 make += ['-j', str(CPU_CORES), '--', '/p:CL_MPCount=' + str(CPU_CORES)]
981 else:
982 # Pass -j to native make, CMake might not support -j option.
983 make += ['--', '-j', str(CPU_CORES)]
984
985 # Build
986 try:
987 print('Running build: ' + str(make))
988 ret = subprocess.check_call(make, cwd=build_root, env=build_env())
989 if ret != 0:
990 errlog(f'Build failed with exit code {ret}!')
991 errlog('Working directory: ' + build_root)
992 return False
993 except Exception as e:
994 errlog('Build failed due to exception!')
995 errlog('Working directory: ' + build_root)
996 errlog(str(e))
997 return False
998
999 return True
1000
1001
1002def cmake_configure(generator, build_root, src_root, build_type, extra_cmake_args):

Callers 1

Calls 4

debug_printFunction · 0.85
find_cmakeFunction · 0.85
build_envFunction · 0.85
errlogFunction · 0.85

Tested by

no test coverage detected