build_analyzer.py bails after first build error

This commit is contained in:
Ian Rees 2017-12-10 17:15:13 +13:00
parent 67724ea54d
commit 7e49ad81de

View file

@ -1,7 +1,8 @@
# Python 3 script to build the analyzer
import os, glob, platform import os, glob, platform
#find out if we're running on mac or linux and set the dynamic library extension #find out if we're running on mac or linux and set the dynamic library extension
dylib_ext = ""
if platform.system().lower() == "darwin": if platform.system().lower() == "darwin":
dylib_ext = ".dylib" dylib_ext = ".dylib"
else: else:
@ -45,6 +46,12 @@ link_dependencies = [ "-lAnalyzer" ] #refers to libAnalyzer.dylib or libAnalyzer
debug_compile_flags = "-O0 -w -c -fpic -g" debug_compile_flags = "-O0 -w -c -fpic -g"
release_compile_flags = "-O3 -w -c -fpic" release_compile_flags = "-O3 -w -c -fpic"
def run_command(cmd):
"Display cmd, then run it in a subshell, raise if there's an error"
print(cmd)
if os.system(cmd):
raise Exception("Shell execution returned nonzero status")
#loop through all the cpp files, build up the gcc command line, and attempt to compile each cpp file #loop through all the cpp files, build up the gcc command line, and attempt to compile each cpp file
for cpp_file in cpp_files: for cpp_file in cpp_files:
@ -66,10 +73,8 @@ for cpp_file in cpp_files:
debug_command += "\"" + "source/" + cpp_file + "\"" #the cpp file to compile debug_command += "\"" + "source/" + cpp_file + "\"" #the cpp file to compile
#run the commands from the command line #run the commands from the command line
print(release_command) run_command(release_command)
os.system( release_command ) run_command(debug_command)
print(debug_command)
os.system( debug_command )
#lastly, link #lastly, link
#g++ #g++
@ -111,9 +116,5 @@ for cpp_file in cpp_files:
debug_command += "debug/" + cpp_file.replace( ".cpp", ".o" ) + " " debug_command += "debug/" + cpp_file.replace( ".cpp", ".o" ) + " "
#run the commands from the command line #run the commands from the command line
print(release_command) run_command(release_command)
os.system( release_command ) run_command(debug_command)
print(debug_command)
os.system( debug_command )