[llvm] Allow flang-new binary to be specified for omp fortran modules (PR #101438)

Daniel Martinez via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 18:22:05 PDT 2024


https://github.com/Calandracas606 created https://github.com/llvm/llvm-project/pull/101438

This allows the path of the flang-new binary to be specified as a cmake configuration.

This is useful when cross compiling, as flang-new may exist on the build machine, which should be used instead of the host.

For example, by passing "-DFLANG_NEW_EXE=/usr/bin/flang-new", that binary will be used instead of just built host compiler.

>From 61215cf73fcbcf81545e6702fb7c9e32ae614c56 Mon Sep 17 00:00:00 2001
From: Daniel Martinez <danielmartinez at cock.li>
Date: Wed, 31 Jul 2024 21:14:52 -0400
Subject: [PATCH] Allow flang-new binary to be specified for omp modules

This allows the path of the flang-new binary to be specified as a
cmake configuration.

This is useful when cross compiling, as flang-new may exist
on the build machine, which should be used instead of the host.

For example, by passing "-DFLANG_NEW_EXE=/usr/bin/flang-new", that
binary will be used instead of just built host compiler.
---
 llvm/runtimes/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 42b1b86ebaadf..22999827d4a8c 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -498,7 +498,7 @@ if(build_runtimes)
   if("openmp" IN_LIST LLVM_ENABLE_RUNTIMES)
     if (${LLVM_TOOL_FLANG_BUILD})
       message(STATUS "Configuring build of omp_lib.mod and omp_lib_kinds.mod via flang-new")
-      set(LIBOMP_FORTRAN_MODULES_COMPILER "${CMAKE_BINARY_DIR}/bin/flang-new")
+      set(LIBOMP_FORTRAN_MODULES_COMPILER "${FLANG_NEW_EXE}" CACHE INTERNAL "${CMAKE_BINARY_DIR}/bin/flang-new")
       set(LIBOMP_MODULES_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}/flang")
       # TODO: This is a workaround until flang becomes a first-class project
       # in llvm/CMakeList.txt.  Until then, this line ensures that flang-new is



More information about the llvm-commits mailing list