summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwrvsrx <wrvsrx@outlook.com>2023-12-23 11:32:32 +0800
committerEli Schwartz <eschwartz93@gmail.com>2023-12-26 23:37:27 -0500
commite2458c6f943ad9f3640036a0c48497759edee585 (patch)
tree718a9c45342950efdaa34133baddcd8dd95e3826
parent2fbc7b5ce3aced483b196dd10ca9eee1713b7494 (diff)
downloadmeson-e2458c6f943ad9f3640036a0c48497759edee585.tar.gz
nvcc compiler: support find dependency header files
This commit supersedes PR #11229 and #10993. It also adds version check according to [comments](https://github.com/mesonbuild/meson/pull/11229#issuecomment-1370287546)
-rw-r--r--mesonbuild/compilers/cuda.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index 969040ad9..2ea5d9f24 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -744,6 +744,15 @@ class CudaCompiler(Compiler):
def get_output_args(self, target: str) -> T.List[str]:
return ['-o', target]
+ def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
+ if version_compare(self.version, '>= 10.2'):
+ # According to nvcc Documentation, `-MD` option is added after 10.2
+ # Reference: [CUDA 10.1](https://docs.nvidia.com/cuda/archive/10.1/cuda-compiler-driver-nvcc/index.html#options-for-specifying-compilation-phase-generate-nonsystem-dependencies)
+ # Reference: [CUDA 10.2](https://docs.nvidia.com/cuda/archive/10.2/cuda-compiler-driver-nvcc/index.html#options-for-specifying-compilation-phase-generate-nonsystem-dependencies)
+ return ['-MD', '-MT', outtarget, '-MF', outfile]
+ else:
+ return []
+
def get_std_exe_link_args(self) -> T.List[str]:
return self._to_host_flags(self.host_compiler.get_std_exe_link_args(), _Phase.LINKER)