Skip to content

Commit

Permalink
Forward C++ standard to the CUDA compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Mar 10, 2020
1 parent bfd4775 commit 1e3fc3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ endforeach(func_name __PRETTY_FUNCTION__ __FUNCTION__)
# Libraries
#

if(WITH_CUDA)
find_package(CUDACompiler REQUIRED)
endif(WITH_CUDA)

find_package(PythonInterp 3.5 REQUIRED)

if(WITH_PYTHON)
Expand Down Expand Up @@ -288,6 +284,11 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# CUDA compiler
if(WITH_CUDA)
find_package(CUDACompiler REQUIRED)
endif(WITH_CUDA)

# drop 'lib' prefix from all libraries
set(CMAKE_SHARED_LIBRARY_PREFIX "")

Expand Down
4 changes: 2 additions & 2 deletions cmake/FindCUDACompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ else()
set(CUDA 1)
set(HIP 1)
set(CUDA_COMPILER_EXE ${HIP_HIPCC_EXECUTABLE})
list(APPEND HIP_HCC_FLAGS "-I${HIP_ROOT_DIR}/include -I${ROCM_HOME}/include -Wno-c99-designator -Wno-macro-redefined -Wno-duplicate-decl-specifier -std=c++14")
list(APPEND HIP_HCC_FLAGS "-I${HIP_ROOT_DIR}/include -I${ROCM_HOME}/include -Wno-c99-designator -Wno-macro-redefined -Wno-duplicate-decl-specifier -std=c++${CMAKE_CXX_STANDARD}")
list(APPEND HIP_HCC_FLAGS "-pedantic -Wall -Wextra -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter -Wno-missing-braces -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-gnu-zero-variadic-macro-arguments")
if(WARNINGS_ARE_ERRORS)
list(APPEND HIP_HCC_FLAGS "-Werror")
Expand Down Expand Up @@ -102,7 +102,7 @@ else()
set(CUDA_NVCC_FLAGS_RELEASE "${CUDA_NVCC_FLAGS_RELEASE} -O3 -DNDEBUG")
set(CUDA_NVCC_FLAGS_MINSIZEREL "${CUDA_NVCC_FLAGS_MINSIZEREL} -Os -DNDEBUG")
set(CUDA_NVCC_FLAGS_RELWITHDEBINFO "${CUDA_NVCC_FLAGS_RELWITHDEBINFO} -g -O2")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_52,code=compute_52 -std=c++14")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_52,code=compute_52 -std=c++${CMAKE_CXX_STANDARD}")
SET(CUDA_PROPAGATE_HOST_FLAGS OFF)

if(WARNINGS_ARE_ERRORS)
Expand Down

0 comments on commit 1e3fc3b

Please sign in to comment.