[flang-commits] [flang] 3d2e05d - [flang] Install Fortran_main library

Diana Picus via flang-commits flang-commits at lists.llvm.org
Mon May 16 01:32:42 PDT 2022


Author: Diana Picus
Date: 2022-05-16T08:30:53Z
New Revision: 3d2e05d542e646891745c5278a09950d3c4fb4a5

URL: https://github.com/llvm/llvm-project/commit/3d2e05d542e646891745c5278a09950d3c4fb4a5
DIFF: https://github.com/llvm/llvm-project/commit/3d2e05d542e646891745c5278a09950d3c4fb4a5.diff

LOG: [flang] Install Fortran_main library

At the moment the Fortran_main library is not installed, so it cannot be
found by the driver when run from an install directory. This patch fixes
the issue by replacing llvm_add_library with add_flang_library, which
already contains all the proper incantations for installing a library.
It also enhances add_flang_library to support a STATIC arg which forces
the library to be static even when BUILD_SHARED_LIBS is on.

Differential Revision: https://reviews.llvm.org/D124759

Co-authored-by: Dan Palermo <Dan.Palermo at amd.com>

Added: 
    

Modified: 
    flang/cmake/modules/AddFlang.cmake
    flang/runtime/FortranMain/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/cmake/modules/AddFlang.cmake b/flang/cmake/modules/AddFlang.cmake
index 369e303e148a5..f6fc2ac363fc5 100644
--- a/flang/cmake/modules/AddFlang.cmake
+++ b/flang/cmake/modules/AddFlang.cmake
@@ -18,7 +18,7 @@ endmacro()
 
 macro(add_flang_library name)
   cmake_parse_arguments(ARG
-    "SHARED"
+    "SHARED;STATIC"
     ""
     "ADDITIONAL_HEADERS"
     ${ARGN})
@@ -53,7 +53,7 @@ macro(add_flang_library name)
   else()
     # llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set,
     # so we need to handle it here.
-    if (BUILD_SHARED_LIBS)
+    if (BUILD_SHARED_LIBS AND NOT ARG_STATIC)
       set(LIBTYPE SHARED OBJECT)
     else()
       set(LIBTYPE STATIC OBJECT)

diff  --git a/flang/runtime/FortranMain/CMakeLists.txt b/flang/runtime/FortranMain/CMakeLists.txt
index aa214cee31ff7..1d840ee5d1a38 100644
--- a/flang/runtime/FortranMain/CMakeLists.txt
+++ b/flang/runtime/FortranMain/CMakeLists.txt
@@ -1,3 +1,3 @@
-llvm_add_library(Fortran_main STATIC
+add_flang_library(Fortran_main STATIC
   Fortran_main.c
 )


        


More information about the flang-commits mailing list