From b6e9e7292f61882ae45c059aa531353213a02cc8 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Fri, 19 Nov 2021 17:00:59 +0000 Subject: [PATCH] BF: CUDACXXFLAGS was getting mixed into NVCCFLAGS --- config/buildSettings.mk | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/config/buildSettings.mk b/config/buildSettings.mk index f01ec64..450bc75 100644 --- a/config/buildSettings.mk +++ b/config/buildSettings.mk @@ -168,16 +168,30 @@ ifneq (${NVCC}, ) CUDA_VER = $(shell ${NVCC} --version | grep -Po "release \K[0-9\.]+") GENCODEFLAGS ?= $(shell ${FSLCONFDIR}/supportedGencodes.sh ${CUDA_VER}) + # We use nvcc to compile .cu files, g++ to + # compile .cc/.cpp files, and nvcc to perform + # the final linking. So we need to manage + # compiler/linker flags carefully. + + # CUDACXXFLAGS is to be used when compiling + # .cc/.cpp files which are to be linked into + # CUDA applications - CUDA-specific include + # paths, and any USRNVCCFLAGS are added to it. + # + # In contrast, NVCCFLAGS is used for compiling + # .cu files (and final linking) - it contains + # nvcc-specific options. + CUDACXXFLAGS ?= -I${CUDA_HOME}/include + # We specify the compiler to use with -ccbin, as # nvcc might otherwise naively call "g++", rather # than honouring $(CXX). We specifically use # "-ccbin" rather than "--compiler-bindir" here, # because the conda-forge nvcc wrapper checks for # -ccbin, and adds its own if not present. - CUDACXXFLAGS ?= -I${CUDA_HOME}/include - NVCCFLAGS ?= ${GENCODEFLAGS} \ - -ccbin $(CXX) \ - ${CUDACXXFLAGS} + NVCCFLAGS ?= ${GENCODEFLAGS} \ + -ccbin $(CXX) \ + -I${CUDA_HOME}/include NVCCLDFLAGS ?= -L${CUDA_HOME}/lib \ -L${CUDA_HOME}/lib64 \ -L${CUDA_HOME}/lib/stubs \ -- GitLab