aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorCarlos Bederian <carlos.bederian@unc.edu.ar>2020-10-14 16:50:43 -0300
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-10-16 18:18:46 +0200
commitf09457a1e8878598eaf3862e1b759e53429b2528 (patch)
treede5458cf9523e4944d5363ec2e61c8ee45f78dfd /mesonbuild
parentbcf369ea3c6ac9d48759a9a11304a853dfdab5ff (diff)
downloadmeson-f09457a1e8878598eaf3862e1b759e53429b2528.zip
meson-f09457a1e8878598eaf3862e1b759e53429b2528.tar.gz
meson-f09457a1e8878598eaf3862e1b759e53429b2528.tar.bz2
compilers/cuda: Fix has_header_symbol check
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/cuda.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index bf46a7d..4dd9c36 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -170,16 +170,29 @@ class CudaCompiler(Compiler):
env: 'Environment', *,
extra_args: T.Optional[T.List[str]] = None,
dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[bool, bool]:
- result, cached = super().has_header_symbol(hname, symbol, prefix, env, extra_args=extra_args, dependencies=dependencies)
- if result:
- return True, cached
if extra_args is None:
extra_args = []
fargs = {'prefix': prefix, 'header': hname, 'symbol': symbol}
+ # Check if it's a C-like symbol
+ t = '''{prefix}
+ #include <{header}>
+ int main(void) {{
+ /* If it's not defined as a macro, try to use as a symbol */
+ #ifndef {symbol}
+ {symbol};
+ #endif
+ return 0;
+ }}'''
+ found, cached = self.compiles(t.format(**fargs), env, extra_args=extra_args, dependencies=dependencies)
+ if found:
+ return True, cached
+ # Check if it's a class or a template
t = '''{prefix}
#include <{header}>
using {symbol};
- int main(void) {{ return 0; }}'''
+ int main(void) {{
+ return 0;
+ }}'''
return self.compiles(t.format(**fargs), env, extra_args=extra_args, dependencies=dependencies)
def get_options(self) -> 'OptionDictType':