aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Seifert <soap@gentoo.org>2023-08-22 18:34:03 +0200
committerEli Schwartz <eschwartz93@gmail.com>2023-08-23 18:39:30 -0400
commit10e8995fc8394c71e5def6d055f542c5f80ca06c (patch)
treefffb36c6be6f636eac1597ab906f6a3ccd66ade1
parent078dc2ca101f3fea115471d1a488c72fbd80c065 (diff)
downloadmeson-10e8995fc8394c71e5def6d055f542c5f80ca06c.zip
meson-10e8995fc8394c71e5def6d055f542c5f80ca06c.tar.gz
meson-10e8995fc8394c71e5def6d055f542c5f80ca06c.tar.bz2
Use `cudart_static` by default in dependency('cuda')
* Without this, using nvcc as the sole driver vs dependency('cuda') and host compiler driver yields differently linked binaries.
-rw-r--r--mesonbuild/dependencies/cuda.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/cuda.py b/mesonbuild/dependencies/cuda.py
index 45df11b..aaed6b3 100644
--- a/mesonbuild/dependencies/cuda.py
+++ b/mesonbuild/dependencies/cuda.py
@@ -46,8 +46,10 @@ class CudaDependency(SystemDependency):
self.lib_modules: T.Dict[str, T.List[str]] = {}
self.requested_modules = self.get_requested(kwargs)
if not any(runtime in self.requested_modules for runtime in ['cudart', 'cudart_static']):
+ # By default, we prefer to link the static CUDA runtime, since this is what nvcc also does by default:
+ # https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#cudart-none-shared-static-cudart
req_modules = ['cudart']
- if kwargs.get('static', False):
+ if kwargs.get('static', True):
req_modules = ['cudart_static']
machine = self.env.machines[self.for_machine]
if machine.is_linux():