[flang-commits] [flang] 1ab70fe - [flang] Enable installing binding header and modules as part of distribution (#133962)

via flang-commits flang-commits at lists.llvm.org
Fri May 2 07:24:05 PDT 2025


Author: Reilly Brogan
Date: 2025-05-02T15:24:02+01:00
New Revision: 1ab70fed622bcbd4a679f66b1c638cdd46f0365c

URL: https://github.com/llvm/llvm-project/commit/1ab70fed622bcbd4a679f66b1c638cdd46f0365c
DIFF: https://github.com/llvm/llvm-project/commit/1ab70fed622bcbd4a679f66b1c638cdd46f0365c.diff

LOG: [flang] Enable installing binding header and modules as part of distribution (#133962)

This allows the C/Fortran interop header (`ISO_Fortran_binding.h`) and
the Fortran module interfaces (`.mod` files) to be installed with
`LLVM_DISTRIBUTION_COMPONENTS`.

Signed-off-by: Reilly Brogan <reilly at reillybrogan.com>

Added: 
    

Modified: 
    flang/CMakeLists.txt
    flang/tools/f18/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index f43f4ab310a13..f358a93fdd792 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -585,5 +585,7 @@ configure_file(
 get_clang_resource_dir(HEADER_INSTALL_DIR SUBDIR include)
 install(
   FILES include/flang/ISO_Fortran_binding.h
-  DESTINATION ${HEADER_INSTALL_DIR} )
-
+  DESTINATION ${HEADER_INSTALL_DIR}
+  COMPONENT flang-fortran-binding)
+add_llvm_install_targets(install-flang-fortran-binding
+  COMPONENT flang-fortran-binding)

diff  --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index 817f3687dbcc8..fb5510d7163d1 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -111,7 +111,7 @@ if (NOT CMAKE_CROSSCOMPILING)
       DEPENDS flang ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${FLANG_SOURCE_DIR}/module/__fortran_builtins.f90 ${depends}
     )
     list(APPEND MODULE_FILES ${base}.mod)
-    install(FILES ${base}.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
+    install(FILES ${base}.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang" COMPONENT flang-module-interfaces)
 
     # If a module has been compiled into an object file, add the file to
     # the link line for the flang_rt.runtime library.
@@ -144,12 +144,14 @@ if (NOT CMAKE_CROSSCOMPILING)
         DEPENDS ${base}.mod
         COMMAND ${CMAKE_COMMAND} -E copy ${base}_kinds.mod ${base}_kinds.f18.mod)
     list(APPEND MODULE_FILES ${base}.mod ${base}.f18.mod ${base}_kinds.mod ${base}_kinds.f18.mod)
-    install(FILES ${base}.mod ${base}.f18.mod ${base}_kinds.mod ${base}_kinds.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
+    install(FILES ${base}.mod ${base}.f18.mod ${base}_kinds.mod ${base}_kinds.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang" COMPONENT flang-module-interfaces)
   elseif ("openmp" IN_LIST LLVM_ENABLE_RUNTIMES)
     message(STATUS "OpenMP runtime support enabled via LLVM_ENABLE_RUNTIMES, assuming omp_lib.mod is built there")
   else()
     message(WARNING "Not building omp_lib.mod, no OpenMP runtime in either LLVM_ENABLE_PROJECTS or LLVM_ENABLE_RUNTIMES")
   endif()
+  add_llvm_install_targets(install-flang-module-interfaces
+    COMPONENT flang-module-interfaces)
 endif()
 
 add_custom_target(module_files ALL DEPENDS ${MODULE_FILES})


        


More information about the flang-commits mailing list