diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2019-03-19 21:04:56 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-03-19 21:04:56 +0200 |
commit | fd624a848e4f77b60c5859363e3c22052e779d3b (patch) | |
tree | 38f4af1923512dd23a7b57258ce268131a8dfe88 | |
parent | 6ee2796879c49a1a338e7dbf4ddab59c140ccf14 (diff) | |
download | meson-fd624a848e4f77b60c5859363e3c22052e779d3b.zip meson-fd624a848e4f77b60c5859363e3c22052e779d3b.tar.gz meson-fd624a848e4f77b60c5859363e3c22052e779d3b.tar.bz2 |
Fix codegen with clang-cl.
-rwxr-xr-x | test cases/common/216 link custom/custom_stlib.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test cases/common/216 link custom/custom_stlib.py b/test cases/common/216 link custom/custom_stlib.py index 7311c4c..80334ed 100755 --- a/test cases/common/216 link custom/custom_stlib.py +++ b/test cases/common/216 link custom/custom_stlib.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import os, sys, subprocess, argparse, pathlib +import shutil, sys, subprocess, argparse, pathlib parser = argparse.ArgumentParser() @@ -16,7 +16,14 @@ void flob() { ''' def generate_lib_gnulike(outfile, c_file, private_dir, compiler_array): - static_linker = 'ar' + if shutil.which('ar'): + static_linker = 'ar' + elif shutil.which('llvm-ar'): + static_linker = 'llvm-ar' + elif shutil.which('gcc-ar'): + static_linker = 'gcc-ar' + else: + sys.exit('Could not detect a static linker.') o_file = c_file.with_suffix('.o') compile_cmd = compiler_array + ['-c', '-g', '-O2', '-o', str(o_file), str(c_file)] subprocess.check_call(compile_cmd) @@ -57,7 +64,7 @@ def generate_lib(outfile, private_dir, compiler_array): c_file = private_dir / 'flob.c' c_file.write_text(contents) for i in compiler_array: - if i.endswith('cl') or i.endswith('cl.exe'): + if (i.endswith('cl') or i.endswith('cl.exe')) and 'clang-cl' not in i: return generate_lib_msvc(outfile, c_file, private_dir, compiler_array) return generate_lib_gnulike(outfile, c_file, private_dir, compiler_array) |