[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=flang-rt (PR #110217)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Dec 11 03:15:52 PST 2024
================
@@ -155,169 +50,139 @@ set(sources
product.cpp
pseudo-unit.cpp
ragged.cpp
- random.cpp
- reduce.cpp
- reduction.cpp
stat.cpp
- stop.cpp
sum.cpp
support.cpp
- temporary-stack.cpp
terminator.cpp
- time-intrinsic.cpp
tools.cpp
transformational.cpp
type-code.cpp
type-info.cpp
- unit-map.cpp
unit.cpp
+ unit-map.cpp
utf.cpp
- ${FORTRAN_MODULE_OBJECTS}
)
-include(AddFlangOffloadRuntime)
+# List of source not used for GPU offloading.
+set(host_sources
+ ${FLANG_SOURCE_DIR}/lib/Common/binary-to-decimal.cpp
+ ${FLANG_SOURCE_DIR}/lib/Common/decimal-to-binary.cpp
+ command.cpp
+ complex-powi.cpp
+ complex-reduction.c
+ exceptions.cpp
+ execute.cpp
+ extensions.cpp
+ ${FLANG_SOURCE_DIR}/module/iso_fortran_env_impl.f90
+ main.cpp
+ random.cpp
+ reduce.cpp
+ reduction.cpp
+ stop.cpp
+ temporary-stack.cpp
+ time-intrinsic.cpp
+)
-# List of files that are buildable for all devices.
-set(supported_files
- ISO_Fortran_binding.cpp
- allocatable.cpp
- allocator-registry.cpp
- array-constructor.cpp
- assign.cpp
- buffer.cpp
- character.cpp
- connection.cpp
- copy.cpp
- derived-api.cpp
- derived.cpp
- descriptor.cpp
- descriptor-io.cpp
- dot-product.cpp
- edit-input.cpp
- edit-output.cpp
- environment.cpp
- extrema.cpp
- external-unit.cpp
- file.cpp
- findloc.cpp
- format.cpp
- inquiry.cpp
- internal-unit.cpp
- io-api.cpp
- io-api-minimal.cpp
- io-error.cpp
- io-stmt.cpp
- iostat.cpp
- matmul-transpose.cpp
- matmul.cpp
- memory.cpp
- misc-intrinsic.cpp
- namelist.cpp
- non-tbp-dio.cpp
- numeric.cpp
- pointer.cpp
- product.cpp
- pseudo-unit.cpp
- ragged.cpp
- stat.cpp
- sum.cpp
- support.cpp
- terminator.cpp
- tools.cpp
- transformational.cpp
- type-code.cpp
- type-info.cpp
- unit.cpp
- utf.cpp
+file(GLOB_RECURSE public_headers
+ "${FLANG_RT_SOURCE_DIR}/include/flang_rt/*.h"
+ "${FLANG_SOURCE_DIR}/include/flang/Common/*.h"
+ )
+
+file(GLOB_RECURSE private_headers
+ "${FLANG_RT_SOURCE_DIR}/lib/flang_rt/*.h"
+ "${FLANG_SOURCE_DIR}/lib/Common/*.h"
)
-enable_cuda_compilation(FortranRuntime "${supported_files}")
-enable_omp_offload_compilation("${supported_files}")
-if (NOT TARGET FortranFloat128Math)
- # If FortranFloat128Math is not defined, then we are not building
- # standalone FortranFloat128Math library. Instead, include
- # the relevant sources into FortranRuntime itself.
- # The information is provided via FortranFloat128MathILib
- # interface library.
- get_target_property(f128_sources
- FortranFloat128MathILib INTERFACE_SOURCES
+# Import changes from sibling FortranFloat128Math
+get_target_property(f128_sources
+ FortranFloat128MathILib INTERFACE_SOURCES
+ )
+if (f128_sources)
+ # The interface may define special macros for Float128Math files,
+ # so we need to propagate them.
+ get_target_property(f128_defs
+ FortranFloat128MathILib INTERFACE_COMPILE_DEFINITIONS
)
- if (f128_sources)
- # The interface may define special macros for Float128Math files,
- # so we need to propagate them.
- get_target_property(f128_defs
- FortranFloat128MathILib INTERFACE_COMPILE_DEFINITIONS
- )
- set_property(SOURCE ${f128_sources}
- APPEND PROPERTY COMPILE_DEFINITIONS
- ${f128_defs}
- )
- get_target_property(f128_include_dirs
- FortranFloat128MathILib INTERFACE_INCLUDE_DIRECTORIES
- )
- set_property(SOURCE ${f128_sources}
- APPEND PROPERTY INCLUDE_DIRECTORIES
- ${f128_include_dirs}
- )
- list(APPEND sources ${f128_sources})
- endif()
-endif()
+ set_property(SOURCE ${f128_sources}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ ${f128_defs}
+ )
+ get_target_property(f128_include_dirs
+ FortranFloat128MathILib INTERFACE_INCLUDE_DIRECTORIES
+ )
+ set_property(SOURCE ${f128_sources}
+ APPEND PROPERTY INCLUDE_DIRECTORIES
+ ${f128_include_dirs}
+ )
+else ()
+ set(f128_sources "")
+endif ()
-if (NOT DEFINED MSVC)
- add_flang_library(FortranRuntime
- ${sources}
- LINK_LIBS
- FortranDecimal
+set(sources ${supported_sources} ${host_sources} ${f128_sources})
+
+if (NOT WIN32)
+ add_flangrt_library(flang_rt STATIC
----------------
jeanPerier wrote:
When trying an out-of-tree shared build of the runtime (-DBUILD_SHARED_LIBS=ON) against a compiler built with static libs, the out-of-tree only builds libflang_rt.a, but not the shared library I want.
Why is this forced to static here? If I remove that, I get the shared lib as expected.
Our use case is to build both STATIC and SHARED versions of the runtime usually, hence we do two builds of the runtime. Ideally, we would be able to combine those builds to avoid recompiling/optimizing the object twice, but that something we can try adding once this lands, for now having the ability to build either static or shared out-of-tree is good enough.
https://github.com/llvm/llvm-project/pull/110217
More information about the llvm-branch-commits
mailing list