From 70e7209f32910ccfd479c97cdc46f3cb3973cef0 Mon Sep 17 00:00:00 2001 From: Federico Pellegrin Date: Thu, 7 Jan 2021 09:48:05 +0100 Subject: [PATCH] cuda: pass correctly compiler options from nvcc to the underlying compiler with --compiler-options --- playground/cuda/cuda.py | 3 ++- playground/cuda/wscript | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/playground/cuda/cuda.py b/playground/cuda/cuda.py index 60266dc9..d4135eb1 100644 --- a/playground/cuda/cuda.py +++ b/playground/cuda/cuda.py @@ -10,7 +10,7 @@ from waflib.Tools import ccroot, c_preproc from waflib.Configure import conf class cuda(Task.Task): - run_str = '${NVCC} ${CUDAFLAGS} ${CXXFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F} ${TGT}' + run_str = '${NVCC} ${CUDAFLAGS} ${NVCCFLAGS_ST:CXXFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F} ${TGT}' color = 'GREEN' ext_in = ['.h'] vars = ['CCDEPS'] @@ -32,6 +32,7 @@ def cxx_hook(self, node): def configure(conf): conf.find_program('nvcc', var='NVCC') conf.find_cuda_libs() + conf.env.NVCCFLAGS_ST = "--compiler-options=%s" @conf def find_cuda_libs(self): diff --git a/playground/cuda/wscript b/playground/cuda/wscript index 30303a3d..db592d4d 100644 --- a/playground/cuda/wscript +++ b/playground/cuda/wscript @@ -18,6 +18,9 @@ def configure(conf): conf.load('cuda', tooldir='.') + # Add a few flags to test proper passing to nvcc + conf.env.CXXFLAGS=['-fPIC', '--std=c++11'] + def build(bld): # cuda application