[flang-commits] [flang] 765b81f - Revert "[flang] Fix multi-config generator builds."

Tim Keith via flang-commits flang-commits at lists.llvm.org
Fri Jul 31 11:11:01 PDT 2020


Author: Tim Keith
Date: 2020-07-31T11:10:44-07:00
New Revision: 765b81f6b93f747bbca57e9042bdd3ce9fea5c5b

URL: https://github.com/llvm/llvm-project/commit/765b81f6b93f747bbca57e9042bdd3ce9fea5c5b
DIFF: https://github.com/llvm/llvm-project/commit/765b81f6b93f747bbca57e9042bdd3ce9fea5c5b.diff

LOG: Revert "[flang] Fix multi-config generator builds."

This reverts commit 332170356e35ea9cdc2c1d612b61a50ec5ea322e.

The change breaks out-of-tree builds.
Discussion in https://reviews.llvm.org/D84022

Added: 
    

Modified: 
    flang/CMakeLists.txt
    flang/test/lit.cfg.py
    flang/test/lit.site.cfg.py.in
    flang/tools/f18/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 337311fc0a63..f1aaa5c6473f 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -180,7 +180,7 @@ else()
          ${LLVM_INCLUDE_TESTS})
   set(FLANG_GTEST_AVAIL 1)
 
-  set(FLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+  set(FLANG_BINARY_DIR ${CMAKE_BINARY_DIR}/tools/flang)
   set(BACKEND_PACKAGE_STRING "${PACKAGE_STRING}")
   if (LINK_WITH_FIR)
     set(MLIR_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --src-root
@@ -194,6 +194,8 @@ endif()
 
 if(LINK_WITH_FIR)
   # tco tool and FIR lib output directories
+  set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin)
+  set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib)
   # Always build tco tool
   set(LLVM_BUILD_TOOLS ON)
   message(STATUS "Linking driver with FIR and LLVM")

diff  --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py
index 521ae968d1cb..8ad5a9b6357f 100644
--- a/flang/test/lit.cfg.py
+++ b/flang/test/lit.cfg.py
@@ -48,6 +48,12 @@
 llvm_config.with_environment('PATH', config.flang_tools_dir, append_path=True)
 llvm_config.with_environment('PATH', config.llvm_tools_dir, append_path=True)
 
+# For builds with FIR, set path for tco and enable related tests
+if config.flang_llvm_tools_dir != "" :
+  config.available_features.add('fir')
+  if config.llvm_tools_dir != config.flang_llvm_tools_dir :
+    llvm_config.with_environment('PATH', config.flang_llvm_tools_dir, append_path=True)
+
 # For each occurrence of a flang tool name, replace it with the full path to
 # the build directory holding that tool.
 tools = [
@@ -55,7 +61,7 @@
     extra_args=["-intrinsic-module-directory "+config.flang_intrinsic_modules_dir],
     unresolved='fatal')
 ]
-llvm_config.add_tool_substitutions(tools, config.llvm_tools_dir)
+llvm_config.add_tool_substitutions(tools, [config.flang_llvm_tools_dir])
 
 # Enable libpgmath testing
 result = lit_config.params.get("LIBPGMATH")

diff  --git a/flang/test/lit.site.cfg.py.in b/flang/test/lit.site.cfg.py.in
index 34bcdab11b55..e8e2945a2cbf 100644
--- a/flang/test/lit.site.cfg.py.in
+++ b/flang/test/lit.site.cfg.py.in
@@ -7,6 +7,7 @@ config.flang_obj_root = "@FLANG_BINARY_DIR@"
 config.flang_src_dir = "@FLANG_SOURCE_DIR@"
 config.flang_tools_dir = "@FLANG_TOOLS_DIR@"
 config.flang_intrinsic_modules_dir = "@FLANG_INTRINSIC_MODULES_DIR@"
+config.flang_llvm_tools_dir = "@CMAKE_BINARY_DIR@/bin"
 config.python_executable = "@PYTHON_EXECUTABLE@"
 
 # Support substitution of the tools_dir with user parameters. This is

diff  --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index 8e8b3d6b6ab1..46c38fa43a2e 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -59,14 +59,8 @@ add_custom_target(module_files ALL DEPENDS ${MODULE_FILES})
 install(TARGETS f18 DESTINATION bin)
 
 set(FLANG_INTRINSIC_MODULES_DIR ${FLANG_BINARY_DIR}/include/flang)
-# This flang shell script will only work in a POSIX shell.
-if (NOT WIN32)
-  configure_file(${CMAKE_CURRENT_SOURCE_DIR}/flang.sh.in ${CMAKE_CURRENT_BINARY_DIR}/tools/flang/bin/flang @ONLY)
-add_custom_command(TARGET f18
-  POST_BUILD
-  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/tools/flang/bin/flang ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang
-  COMMAND chmod +x ${LLVM_RUNTIME_OUTPUT_INTDIR}/flang)
-endif()
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/flang.sh.in ${CMAKE_BINARY_DIR}/tools/flang/bin/flang @ONLY)
+file(COPY ${CMAKE_BINARY_DIR}/tools/flang/bin/flang DESTINATION ${CMAKE_BINARY_DIR}/bin FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE)
 # The flang script to be installed needs a 
diff erent path to the headers.
 set(FLANG_INTRINSIC_MODULES_DIR ${CMAKE_INSTALL_PREFIX}/include/flang)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/flang.sh.in ${FLANG_BINARY_DIR}/bin/flang-install.sh @ONLY)


        


More information about the flang-commits mailing list