File tree Expand file tree Collapse file tree 3 files changed +14
-42
lines changed Expand file tree Collapse file tree 3 files changed +14
-42
lines changed Original file line number Diff line number Diff line change 88
99macro (enable_cuda_compilation name files )
1010 if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "CUDA" )
11- if (BUILD_SHARED_LIBS )
12- message (FATAL_ERROR
13- "BUILD_SHARED_LIBS is not supported for CUDA build of Fortran runtime"
14- )
15- endif ()
16-
1711 enable_language (CUDA)
1812
1913 # TODO: figure out how to make target property CUDA_SEPARABLE_COMPILATION
@@ -70,12 +64,6 @@ macro(enable_omp_offload_compilation name files)
7064 if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "OpenMP" )
7165 # OpenMP offload build only works with Clang compiler currently.
7266
73- if (BUILD_SHARED_LIBS )
74- message (FATAL_ERROR
75- "BUILD_SHARED_LIBS is not supported for OpenMP offload build of Fortran runtime"
76- )
77- endif ()
78-
7967 if ("${CMAKE_CXX_COMPILER_ID} " MATCHES "Clang" AND
8068 "${CMAKE_C_COMPILER_ID} " MATCHES "Clang" )
8169
Original file line number Diff line number Diff line change 66#
77#===------------------------------------------------------------------------===#
88
9- # libCufRuntime depends on a certain version of CUDA. To be able to have
10- # multiple build of this library with different CUDA version, the version is
11- # added to the library name.
12- set (CUFRT_LIBNAME CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR} )
139
14- add_flangrt_library(${CUFRT_LIBNAME}
10+ add_flangrt_library(CufRuntime STATIC
1511 allocatable.cpp
1612 allocator.cpp
1713 descriptor.cpp
@@ -20,21 +16,19 @@ add_flangrt_library(${CUFRT_LIBNAME}
2016 memory.cpp
2117 registration.cpp
2218)
23- target_include_directories (${CUFRT_LIBNAME} PRIVATE ${CUDAToolkit_INCLUDE_DIRS} )
2419
25- if (BUILD_SHARED_LIBS )
26- set (CUDA_RT_TARGET CUDA::cudart)
27- else ()
28- set (CUDA_RT_TARGET CUDA::cudart_static)
29- endif ()
30-
31- target_link_libraries (${CUFRT_LIBNAME}
32- PRIVATE
33- flang_rt
34- ${CUDA_RT_TARGET}
20+ # libCufRuntime depends on a certain version of CUDA. To be able to have
21+ # multiple build of this library with different CUDA version, the version is
22+ # added to the library name.
23+ set_target_properties (CufRuntime
24+ PROPERTIES
25+ OUTPUT_NAME "CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR} "
3526)
3627
37- # Phony build target that does not include the CUDA version.
38- add_custom_target (CufRuntime)
39- add_dependencies (CufRuntime ${CUFRT_LIBNAME} )
28+ target_include_directories (CufRuntime PRIVATE ${CUDAToolkit_INCLUDE_DIRS} )
4029
30+ target_link_libraries (CufRuntime
31+ PUBLIC
32+ flang_rt
33+ CUDA::cudart_static
34+ )
Original file line number Diff line number Diff line change @@ -12,17 +12,7 @@ add_flangrt_unittest(FlangCufRuntimeTests
1212 Memory.cpp
1313)
1414
15- if (BUILD_SHARED_LIBS )
16- set (CUDA_RT_TARGET CUDA::cudart)
17- else ()
18- set (CUDA_RT_TARGET CUDA::cudart_static)
19- endif ()
20-
2115target_link_libraries (FlangCufRuntimeTests
2216 PRIVATE
23- ${CUDA_RT_TARGET}
24- CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR}
25- flang_rt.unittest
17+ CufRuntime
2618)
27-
28- target_include_directories (FlangCufRuntimeTests PRIVATE ${CUDAToolkit_INCLUDE_DIRS} )
You can’t perform that action at this time.
0 commit comments