Skip to content

Commit

Permalink
Fix flags with CUDA. Lower CUDA standard to 11
Browse files Browse the repository at this point in the history
CUDA_STANDARD 17 does not seem to be required to build samples
and breaks with older, but still valid, nvcc compilers.
  • Loading branch information
kwryankrattiger committed Nov 9, 2021
1 parent d810da8 commit 795ceae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions CMake/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ function (_sensei_set_target_properties name)

target_compile_features(${name} PUBLIC cxx_std_11)
target_compile_options(${name} PUBLIC
-Wall -Wextra
$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wall -Wextra>
# Need to explicitly set optimization level to -O3 because some systems default to -O2
$<$<STREQUAL:$<UPPER_CASE:${CMAKE_BUILD_TYPE}>,"Release">:"-03">
$<$<STREQUAL:$<CXX_COMPILER_ID>,"AppleClang">:"-stdlib=libc++">)
$<$<STREQUAL:$<UPPER_CASE:${CMAKE_BUILD_TYPE}>,"Release">:-03>
$<$<STREQUAL:$<CXX_COMPILER_ID>,"AppleClang">:-stdlib=libc++>)
set_target_properties(${name} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
Expand Down
2 changes: 1 addition & 1 deletion CMake/cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function(sensei_cuda_target)

message(STATUS "Created CUDA target ${CUDA_TGT_TARGET}")

target_compile_features(${CUDA_TGT_TARGET} PUBLIC cxx_std_11)
target_compile_features(${CUDA_TGT_TARGET} PUBLIC cxx_std_17)

set_target_properties(${CUDA_TGT_TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(${CUDA_TGT_TARGET} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
Expand Down

0 comments on commit 795ceae

Please sign in to comment.