99from os import chdir , environ
1010from shutil import rmtree
1111import subprocess
12+ import platform
1213
1314#
1415
@@ -29,7 +30,8 @@ def run_command(command, workingDir):
2930 print (cp .stderr )
3031
3132 except subprocess .CalledProcessError as error :
32- print (error .output )
33+ print ("STDOUT:" , error .stdout )
34+ print ("STDERR:" , error .stderr )
3335 print (f"Command { error .cmd } failed with exit code { error .returncode } " )
3436 exit (1 )
3537
@@ -44,22 +46,34 @@ def run_command(command, workingDir):
4446
4547environ ["MP_PERFETTO_SHOULD_BE_ON" ] = "FALSE"
4648
47- run_command (command = f"cmake -B { BUILD_DIR } " ,
49+ # Single-config generators (Unix Makefiles, Ninja) require CMAKE_BUILD_TYPE at configure time
50+ # Multi-config generators (Xcode, Visual Studio) ignore it and use --config at build time
51+ if platform .system () == "Windows" :
52+ build_type_flag = ""
53+ generator_flag = ""
54+ elif platform .system () == "Linux" :
55+ build_type_flag = " -DCMAKE_BUILD_TYPE=Debug"
56+ generator_flag = " -G Ninja" # Ninja is faster and installed in CI
57+ else :
58+ build_type_flag = " -DCMAKE_BUILD_TYPE=Debug"
59+ generator_flag = ""
60+
61+ run_command (command = f"cmake -B { BUILD_DIR } { generator_flag } { build_type_flag } " ,
4862 workingDir = REPO_ROOT )
4963
50- run_command (command = f"cmake --build { BUILD_DIR } " ,
64+ run_command (command = f"cmake --build { BUILD_DIR } --parallel " ,
5165 workingDir = REPO_ROOT )
5266
53- run_command (command = "ctest -C Debug" ,
67+ run_command (command = "ctest -C Debug -j --output-on-failure " ,
5468 workingDir = BUILD_DIR )
5569
5670environ ["MP_PERFETTO_SHOULD_BE_ON" ] = "TRUE"
5771
58- run_command (command = f"cmake -B { BUILD_DIR } -D PERFETTO=ON" ,
72+ run_command (command = f"cmake -B { BUILD_DIR } -D PERFETTO=ON{ generator_flag } { build_type_flag } " ,
5973 workingDir = REPO_ROOT )
6074
61- run_command (command = f"cmake --build { BUILD_DIR } " ,
75+ run_command (command = f"cmake --build { BUILD_DIR } --parallel " ,
6276 workingDir = REPO_ROOT )
6377
64- run_command (command = "ctest -C Debug" ,
78+ run_command (command = "ctest -C Debug -j --output-on-failure " ,
6579 workingDir = BUILD_DIR )
0 commit comments