Skip to content

Commit 2b8a095

Browse files
committed
Unconditionally compile CUDA-Fortran modules
1 parent 7f71455 commit 2b8a095

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

flang-rt/lib/runtime/CMakeLists.txt

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ find_package(Backtrace)
1212
set(HAVE_BACKTRACE ${Backtrace_FOUND})
1313
set(BACKTRACE_HEADER ${Backtrace_HEADER})
1414

15+
# Module sources that are required by other modules
16+
set(intrinsics_sources
17+
__fortran_builtins.f90
18+
__cuda_builtins.f90
19+
)
20+
21+
1522
# List of files that are buildable for all devices.
1623
set(supported_sources
1724
${FLANG_SOURCE_DIR}/lib/Decimal/binary-to-decimal.cpp
@@ -97,12 +104,10 @@ set(host_sources
97104
temporary-stack.cpp
98105
time-intrinsic.cpp
99106
unit-map.cpp
100-
)
101107

102-
# Module sources that are required by other modules
103-
set(intrinsics_sources
104-
__fortran_builtins.f90
105-
__cuda_builtins.f90
108+
__cuda_device.f90
109+
cooperative_groups.f90
110+
cudadevice.f90
106111
)
107112

108113
if (LLVM_TARGET_TRIPLE MATCHES "^ppc|^powerpc")
@@ -113,22 +118,15 @@ if (LLVM_TARGET_TRIPLE MATCHES "^ppc|^powerpc")
113118
)
114119
endif ()
115120

116-
if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "CUDA")
117-
list(APPEND host_sources
121+
# Compile as CUDA-Fortran, not directly supported by CMake
122+
set_property(SOURCE
118123
__cuda_device.f90
119124
cooperative_groups.f90
120125
cudadevice.f90
121-
)
126+
APPEND PROPERTY
127+
COMPILE_OPTIONS --offload-host-only -xcuda
128+
)
122129

123-
# Compile as CUDA-Fortran, not directly supported by CMake
124-
set_property(SOURCE
125-
__cuda_device.f90
126-
cooperative_groups.f90
127-
cudadevice.f90
128-
APPEND PROPERTY
129-
COMPILE_OPTIONS --offload-host-only -xcuda
130-
)
131-
endif ()
132130

133131
# Sources that can be compiled directly for the GPU.
134132
set(gpu_sources

0 commit comments

Comments
 (0)