-
Notifications
You must be signed in to change notification settings - Fork 1
/
cuda_compiler.pri
48 lines (38 loc) · 1.75 KB
/
cuda_compiler.pri
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
LIBS += -L${CUDA_PATH}/lib -L${CUDA_PATH}/lib64 -L${CUDA_PATH}/lib64/nvidia
LIBS += -lcudart -lcurand -licudata -lcudart_static -lcudadevrt -lcusparse -lcusolver
INCLUDEPATH += \
$${PWD}/dep/cusplibrary \
${CUDA_PATH}/include \
${CUDA_PATH}/include/cuda
CUDA_INC += $$join(INCLUDEPATH, ' -I', '-I', ' ')
NVCCFLAGS += -ccbin ${HOST_COMPILER} -pg -g -lineinfo --std=c++11 -O3
NVCCFLAGS += -arch=sm_${CUDA_ARCH}
NVCCFLAGS += -Xcompiler -fno-strict-aliasing -Xcompiler -fPIC
NVCCFLAGS += -Xptxas -O3 --use_fast_math --restrict --expt-relaxed-constexpr --expt-extended-lambda
NVCCFLAGS += $$join(DEFINES, ' -D', '-D', ' ')
#NVCCFLAGS += -v
#NVCCFLAGS += -G
# Suppress warnings about __host__ and __device__ macros being used on defaulted ctors/dtors
NVCCFLAGS += -Xcudafe --display_error_number
NVCC_IGNORED_WARNINGS = 2906 186
NVCCFLAGS += $$join(NVCC_IGNORED_WARNINGS, ' -Xcudafe --diag_suppress=', '-Xcudafe --diag_suppress=', ' ')
NVCCBIN = ${CUDA_PATH}/bin/nvcc
CUDA_COMPILE_BASE = $${NVCCBIN} $${NVCCFLAGS} $${CUDA_INC} ${QMAKE_FILE_NAME}
CUDA_COMPILE = $${CUDA_COMPILE_BASE} -o ${QMAKE_FILE_OUT} $${LIBS}
# Compile cuda (device) code into object files
cuda.input = CUDA_SOURCES
cuda.output = $${CUDA_OBJECTS_DIR}/${QMAKE_FILE_BASE}.o
cuda.commands += $${CUDA_COMPILE} -dc
cuda.CONFIG = no_link
cuda.variable_out = CUDA_OBJ
cuda.variable_out += OBJECTS
cuda.clean = $${CUDA_OBJECTS_DIR}/*.o
QMAKE_EXTRA_COMPILERS += cuda
# Link cuda object files into one object file with symbols that GCC can recognise
cudalink.input = CUDA_OBJ
cudalink.output = $${OBJECTS_DIR}/cuda_link.o
cudalink.commands = $${CUDA_COMPILE} -dlink
cudalink.CONFIG = combine
cudalink.dependency_type = TYPE_C
cudalink.depend_command = $${CUDA_COMPILE_BASE} -M
QMAKE_EXTRA_COMPILERS += cudalink