diff --git a/CMakeLists.txt b/CMakeLists.txt index 125c74311d8..cf6a3b0cdd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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 "") diff --git a/cmake/FindCUDACompiler.cmake b/cmake/FindCUDACompiler.cmake index 14c4b7243d8..3685f551d46 100644 --- a/cmake/FindCUDACompiler.cmake +++ b/cmake/FindCUDACompiler.cmake @@ -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") @@ -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)