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 8
8
9
9
macro (enable_cuda_compilation name files )
10
10
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
-
17
11
enable_language (CUDA )
18
12
19
13
# TODO: figure out how to make target property CUDA_SEPARABLE_COMPILATION
@@ -70,12 +64,6 @@ macro(enable_omp_offload_compilation name files)
70
64
if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "OpenMP" )
71
65
# OpenMP offload build only works with Clang compiler currently.
72
66
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
-
79
67
if ("${CMAKE_CXX_COMPILER_ID} " MATCHES "Clang" AND
80
68
"${CMAKE_C_COMPILER_ID} " MATCHES "Clang" )
81
69
Original file line number Diff line number Diff line change 6
6
#
7
7
#===------------------------------------------------------------------------===#
8
8
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} )
13
9
14
- add_flangrt_library (${CUFRT_LIBNAME}
10
+ add_flangrt_library (CufRuntime STATIC
15
11
allocatable.cpp
16
12
allocator.cpp
17
13
descriptor.cpp
@@ -20,21 +16,19 @@ add_flangrt_library(${CUFRT_LIBNAME}
20
16
memory.cpp
21
17
registration.cpp
22
18
)
23
- target_include_directories (${CUFRT_LIBNAME} PRIVATE ${CUDAToolkit_INCLUDE_DIRS} )
24
19
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} "
35
26
)
36
27
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} )
40
29
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
12
12
Memory.cpp
13
13
)
14
14
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
-
21
15
target_link_libraries (FlangCufRuntimeTests
22
16
PRIVATE
23
- ${CUDA_RT_TARGET}
24
- CufRuntime_cuda_${CUDAToolkit_VERSION_MAJOR}
25
- flang_rt.unittest
17
+ CufRuntime
26
18
)
27
-
28
- target_include_directories (FlangCufRuntimeTests PRIVATE ${CUDAToolkit_INCLUDE_DIRS} )
You can’t perform that action at this time.
0 commit comments