add an alloy.py option to build ispc binary with g++
This commit is contained in:
31
alloy.py
31
alloy.py
@@ -239,7 +239,7 @@ def check_targets():
|
||||
answer_sde = []
|
||||
# check what native targets do we have
|
||||
if current_OS != "Windows":
|
||||
try_do_LLVM("build check_ISA", "clang check_isa.cpp -o check_isa.exe", True)
|
||||
try_do_LLVM("build check_ISA", "g++ check_isa.cpp -o check_isa.exe", True)
|
||||
else:
|
||||
try_do_LLVM("build check_ISA", "cl check_isa.cpp", True)
|
||||
SSE2 = ["sse2-i32x4", "sse2-i32x8"]
|
||||
@@ -296,6 +296,18 @@ def check_targets():
|
||||
def build_ispc(version_LLVM, make):
|
||||
current_path = os.getcwd()
|
||||
os.chdir(os.environ["ISPC_HOME"])
|
||||
|
||||
# the default 'make' variable for ISPC and LLVM may be actually different,
|
||||
# so we have to manually set a new make command here (make targets are already verified in Main() )
|
||||
if (options.ispc_compiler == "clang"):
|
||||
make_target = "clang"
|
||||
elif (options.ispc_compiler == "gcc"):
|
||||
make_target = "gcc"
|
||||
elif (options.ispc_compiler == "g++"):
|
||||
make_target = "gcc"
|
||||
|
||||
make_ispc = "make " + make_target + " -j" + options.speed
|
||||
|
||||
if current_OS != "Windows":
|
||||
p_temp = os.getenv("PATH")
|
||||
os.environ["PATH"] = os.environ["LLVM_HOME"] + "/bin-" + version_LLVM + "/bin:" + os.environ["PATH"]
|
||||
@@ -312,7 +324,7 @@ def build_ispc(version_LLVM, make):
|
||||
(revision_llvm, err) = p.communicate()
|
||||
|
||||
try_do_LLVM("recognize LLVM revision", "svn info " + folder, True)
|
||||
try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", make, True)
|
||||
try_do_LLVM("build ISPC with LLVM version " + version_LLVM + " ", make_ispc, True)
|
||||
os.environ["PATH"] = p_temp
|
||||
else:
|
||||
p_temp = os.getenv("LLVM_INSTALL_DIR")
|
||||
@@ -650,6 +662,19 @@ def Main():
|
||||
parser.print_help()
|
||||
exit(0)
|
||||
|
||||
# set appropriate makefile target
|
||||
# gcc and g++ options are equal and added for ease of use
|
||||
if (options.ispc_compiler == "clang"):
|
||||
make_target = "clang"
|
||||
elif (options.ispc_compiler == "gcc"):
|
||||
make_target = "gcc"
|
||||
elif (options.ispc_compiler == "g++"):
|
||||
make_target = "gcc"
|
||||
else:
|
||||
error("unknow option for --ispc-compiler: " + options.ispc_compiler, 1)
|
||||
parser.print_help()
|
||||
exit(0)
|
||||
|
||||
setting_paths(options.llvm_home, options.ispc_home, options.sde_home)
|
||||
if os.environ.get("LLVM_HOME") == None:
|
||||
error("you have no LLVM_HOME", 1)
|
||||
@@ -759,6 +784,8 @@ if __name__ == '__main__':
|
||||
help='ask for validation run', default=False, action="store_true")
|
||||
parser.add_option('-j', dest='speed',
|
||||
help='set -j for make', default=num_threads)
|
||||
parser.add_option('--ispc-compiler', dest='ispc_compiler',
|
||||
help='set compiler to build ispc binary (clang or g++)', default="clang")
|
||||
# options for activity "build LLVM"
|
||||
llvm_group = OptionGroup(parser, "Options for building LLVM",
|
||||
"These options must be used with -b option.")
|
||||
|
||||
Reference in New Issue
Block a user