aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKramer Peace <kpeace1@gmail.com>2019-09-03 19:33:11 +0300
committerDylan Baker <dylan@pnwbakers.com>2019-09-05 08:38:56 -0700
commitcaec875fe1922b40037e1fd9229433ede64f9f25 (patch)
tree142985197c0c5c0e0426da5989c3e10fd05ebb9f
parent7e8febaa8c48cd0e7aed4dcc1b0cc7e30e5b8a0a (diff)
downloadmeson-caec875fe1922b40037e1fd9229433ede64f9f25.zip
meson-caec875fe1922b40037e1fd9229433ede64f9f25.tar.gz
meson-caec875fe1922b40037e1fd9229433ede64f9f25.tar.bz2
Create CUDA linker with CUDA compiler
Since they are laways paired there is no need to "search" for the cuda linker.
-rw-r--r--mesonbuild/compilers/cuda.py8
-rw-r--r--mesonbuild/environment.py5
2 files changed, 3 insertions, 10 deletions
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index 0a26bed..57935d8 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -18,7 +18,7 @@ import typing
from .. import mlog
from ..mesonlib import EnvironmentException, MachineChoice, Popen_safe
from .compilers import (Compiler, cuda_buildtype_args, cuda_optimization_args,
- cuda_debug_args, CompilerType)
+ cuda_debug_args)
if typing.TYPE_CHECKING:
from ..environment import Environment # noqa: F401
@@ -34,7 +34,7 @@ class CudaCompiler(Compiler):
super().__init__(exelist, version, for_machine, **kwargs)
self.is_cross = is_cross
self.exe_wrapper = exe_wrapper
- self.id = CudaCompiler.cuda_id()
+ self.id = 'nvcc'
default_warn_args = []
self.warn_args = {'0': [],
'1': default_warn_args,
@@ -42,10 +42,6 @@ class CudaCompiler(Compiler):
'3': default_warn_args + ['-Xcompiler=-Wextra',
'-Xcompiler=-Wpedantic']}
- @staticmethod
- def cuda_id():
- return 'nvcc'
-
def needs_static_linker(self):
return False
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index b53c6f5..7e1ca9d 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -697,9 +697,6 @@ class Environment:
`-Xlinker=--version`) you must pass as a list.
:extra_args: Any addtional arguments rquired (such as a source file)
"""
- if CudaCompiler.cuda_id() in compiler:
- return CudaLinker(compiler, for_machine, 'nvlink', prefix, version=CudaLinker.parse_version())
-
extra_args = typing.cast(typing.List[str], extra_args or [])
if isinstance(prefix, str):
check_args = [prefix + '--version'] + extra_args
@@ -963,7 +960,7 @@ class Environment:
# Luckily, the "V" also makes it very simple to extract
# the full version:
version = out.strip().split('V')[-1]
- linker = self._guess_nix_linker(compiler, for_machine, CudaCompiler.LINKER_PREFIX)
+ linker = CudaLinker(compiler, for_machine, 'nvlink', CudaCompiler.LINKER_PREFIX, version=CudaLinker.parse_version())
return CudaCompiler(ccache + compiler, version, for_machine, exe_wrap, linker=linker)
raise EnvironmentException('Could not find suitable CUDA compiler: "' + ' '.join(compilers) + '"')