File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,10 @@ function (add_flangrt_library name)
6565 set_target_properties (${name} PROPERTIES FOLDER "Fortran Runtime/Libraries" )
6666 endif ()
6767
68+ # Minimum required C++ version for Flang-RT, even if CMAKE_CXX_STANDARD is defined to something else.
6869 target_compile_features (${name} PRIVATE cxx_std_17)
70+
71+ # Use compiler-specific options to disable exceptions and RTTI.
6972 if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
7073 target_compile_options (${name} PRIVATE
7174 $<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables>
@@ -80,6 +83,19 @@ function (add_flangrt_library name)
8083 )
8184 endif ()
8285
86+ # Also for CUDA source when compiling with FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT=CUDA
87+ if (CMAKE_CUDA_COMPILER_ID MATCHES "NVIDIA" )
88+ # Assuming gcc as host compiler.
89+ target_compile_options (${name} PRIVATE
90+ $<$<COMPILE_LANGUAGE:CUDA>:--no -exceptions -Xcompiler -fno-rtti -Xcompiler -fno-unwind-tables -Xcompiler -fno-asynchronous-unwind-tables>
91+ )
92+ else ()
93+ # Assuming a clang-compatible CUDA compiler.
94+ target_compile_options (${name} PRIVATE
95+ $<$<COMPILE_LANGUAGE:CUDA>:-fno-exceptions -fno-rtti -fno-unwind-tables -fno-asynchronous-unwind-tables>
96+ )
97+ endif ()
98+
8399 # Flang-rt's public headers
84100 target_include_directories (${name} PRIVATE "${FLANG_RT_SOURCE_DIR} /include" )
85101
You can’t perform that action at this time.
0 commit comments