diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-09-14 15:18:16 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-09-19 15:19:00 -0400 |
commit | f6f876481f84867ba4150967c8966dcc29df6358 (patch) | |
tree | 088ddf6f0c8e7cbd684567aeb5b005f387be4a05 /mesonbuild/compilers/detect.py | |
parent | 775b67c5c1920808af94d754fafd6f89e88e80a7 (diff) | |
download | meson-f6f876481f84867ba4150967c8966dcc29df6358.zip meson-f6f876481f84867ba4150967c8966dcc29df6358.tar.gz meson-f6f876481f84867ba4150967c8966dcc29df6358.tar.bz2 |
compilers: use more direct checks for what kind of compiler we have
Instead of comparing against specific compiler classes, check the
logical compiler id or language etc.
In a couple cases, we seem to be missing a couple things by being a bit
too strict about the exact class type.
Diffstat (limited to 'mesonbuild/compilers/detect.py')
-rw-r--r-- | mesonbuild/compilers/detect.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 9b7099c..c128a9b 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -275,26 +275,26 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker trials = [linker] else: default_linkers = [[l] for l in defaults['static_linker']] - if isinstance(compiler, CudaCompiler): + if compiler.language == 'cuda': trials = [defaults['cuda_static_linker']] + default_linkers - elif isinstance(compiler, VisualStudioLikeCompiler): + elif compiler.get_argument_syntax() == 'msvc': trials = [defaults['vs_static_linker'], defaults['clang_cl_static_linker']] - elif isinstance(compiler, GnuCompiler): + elif compiler.id == 'gcc': # Use gcc-ar if available; needed for LTO trials = [defaults['gcc_static_linker']] + default_linkers - elif isinstance(compiler, ClangCompiler): + elif compiler.id == 'clang': # Use llvm-ar if available; needed for LTO trials = [defaults['clang_static_linker']] + default_linkers - elif isinstance(compiler, DCompiler): + elif compiler.language == 'd': # Prefer static linkers over linkers used by D compilers if is_windows(): trials = [defaults['vs_static_linker'], defaults['clang_cl_static_linker'], compiler.get_linker_exelist()] else: trials = default_linkers - elif isinstance(compiler, IntelClCCompiler): + elif compiler.id == 'intel-cl' and compiler.language == 'c': # why not cpp? Is this a bug? # Intel has it's own linker that acts like microsoft's lib trials = [['xilib']] - elif isinstance(compiler, (PGICCompiler, PGIFortranCompiler)) and is_windows(): + elif is_windows() and compiler.id == 'pgi': # this handles cpp / nvidia HPC, in addition to just c/fortran trials = [['ar']] # For PGI on Windows, "ar" is just a wrapper calling link/lib. else: trials = default_linkers |