[flang-commits] [flang] 6a7deff - [flang] Remove `LINK_WITH_FIR` cmake switch

Sourabh Singh Tomar via flang-commits flang-commits at lists.llvm.org
Thu Feb 11 09:22:34 PST 2021


Author: Sourabh Singh Tomar
Date: 2021-02-11T22:52:13+05:30
New Revision: 6a7deff58e3f725801f8566ef414af4074bc7a9d

URL: https://github.com/llvm/llvm-project/commit/6a7deff58e3f725801f8566ef414af4074bc7a9d
DIFF: https://github.com/llvm/llvm-project/commit/6a7deff58e3f725801f8566ef414af4074bc7a9d.diff

LOG: [flang] Remove `LINK_WITH_FIR` cmake switch

Most components required for this are already there.

Build and Testing clean.
ninja check-flang

Reviewed By: clementval, tskeith

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

Added: 
    

Modified: 
    flang/CMakeLists.txt
    flang/include/flang/CMakeLists.txt
    flang/lib/CMakeLists.txt
    flang/test/CMakeLists.txt
    flang/tools/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 79aa53830d5e..4ea0569ceb47 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.13.4)
 
 set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
 
-option(LINK_WITH_FIR "Link driver with FIR and LLVM" ON)
 option(FLANG_BUILD_NEW_DRIVER "Build the flang compiler driver" OFF)
 
 # Flang requires C++17.
@@ -72,19 +71,17 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
     include(AddClang)
   endif()
 
-  if(LINK_WITH_FIR)
-    include(TableGen)
-    find_package(MLIR REQUIRED CONFIG)
-    # Use SYSTEM for the same reasons as for LLVM includes
-    include_directories(SYSTEM ${MLIR_INCLUDE_DIRS})
-    # If the user specifies a relative path to MLIR_DIR, the calls to include
-    # MLIR modules fail. Append the absolute path to MLIR_DIR instead.
-    get_filename_component(MLIR_DIR_ABSOLUTE ${MLIR_DIR} REALPATH)
-    list(APPEND CMAKE_MODULE_PATH ${MLIR_DIR_ABSOLUTE})
-    include(AddMLIR)
-    find_program(MLIR_TABLEGEN_EXE "mlir-tblgen" ${LLVM_TOOLS_BINARY_DIR}
-      NO_DEFAULT_PATH)
-  endif()
+  include(TableGen)
+  find_package(MLIR REQUIRED CONFIG)
+  # Use SYSTEM for the same reasons as for LLVM includes
+  include_directories(SYSTEM ${MLIR_INCLUDE_DIRS})
+  # If the user specifies a relative path to MLIR_DIR, the calls to include
+  # MLIR modules fail. Append the absolute path to MLIR_DIR instead.
+  get_filename_component(MLIR_DIR_ABSOLUTE ${MLIR_DIR} REALPATH)
+  list(APPEND CMAKE_MODULE_PATH ${MLIR_DIR_ABSOLUTE})
+  include(AddMLIR)
+  find_program(MLIR_TABLEGEN_EXE "mlir-tblgen" ${LLVM_TOOLS_BINARY_DIR}
+    NO_DEFAULT_PATH)
 
   option(LLVM_INSTALL_TOOLCHAIN_ONLY
     "Only include toolchain files in the 'install' target." OFF)
@@ -186,14 +183,12 @@ else()
   endif()
 
   set(BACKEND_PACKAGE_STRING "${PACKAGE_STRING}")
-  if (LINK_WITH_FIR)
-    set(MLIR_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --src-root
-    set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --includedir
-    set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include)
-    set(MLIR_TABLEGEN_EXE $<TARGET_FILE:mlir-tblgen>)
-    include_directories(SYSTEM ${MLIR_INCLUDE_DIR})
-    include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR})
-  endif()
+  set(MLIR_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --src-root
+  set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --includedir
+  set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include)
+  set(MLIR_TABLEGEN_EXE $<TARGET_FILE:mlir-tblgen>)
+  include_directories(SYSTEM ${MLIR_INCLUDE_DIR})
+  include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR})
 endif()
 
 if(FLANG_BUILD_NEW_DRIVER)
@@ -211,17 +206,13 @@ if(FLANG_BUILD_NEW_DRIVER)
     include_directories(SYSTEM ${CLANG_INCLUDE_DIR})
 endif()
 
-if(LINK_WITH_FIR)
-  # tco tool and FIR lib output directories
-  if(FLANG_STANDALONE_BUILD)
-    set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin)
-    set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib)
-  endif()
-  # Always build tco tool
-  set(LLVM_BUILD_TOOLS ON)
-  set(LLVM_COMMON_COMPONENTS Support)
-  message(STATUS "Linking driver with FIR and LLVM, using LLVM components: ${LLVM_COMMON_COMPONENTS}")
+# tco tool and FIR lib output directories
+if(FLANG_STANDALONE_BUILD)
+  set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin)
+  set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib)
 endif()
+# Always build tco tool
+set(LLVM_BUILD_TOOLS ON)
 
 # Add Flang-centric modules to cmake path.
 include_directories(BEFORE

diff  --git a/flang/include/flang/CMakeLists.txt b/flang/include/flang/CMakeLists.txt
index db5d26a83b56..8fa6447f19be 100644
--- a/flang/include/flang/CMakeLists.txt
+++ b/flang/include/flang/CMakeLists.txt
@@ -1,3 +1 @@
-if(LINK_WITH_FIR)
-  add_subdirectory(Optimizer)
-endif()
+add_subdirectory(Optimizer)

diff  --git a/flang/lib/CMakeLists.txt b/flang/lib/CMakeLists.txt
index d9848bce0fa5..9ebb9f6a72ca 100644
--- a/flang/lib/CMakeLists.txt
+++ b/flang/lib/CMakeLists.txt
@@ -10,6 +10,4 @@ if(FLANG_BUILD_NEW_DRIVER)
   add_subdirectory(FrontendTool)
 endif()
 
-if(LINK_WITH_FIR)
-  add_subdirectory(Optimizer)
-endif()
+add_subdirectory(Optimizer)

diff  --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt
index 635d3d88b61c..abda950e1d3e 100644
--- a/flang/test/CMakeLists.txt
+++ b/flang/test/CMakeLists.txt
@@ -37,9 +37,7 @@ set(FLANG_TEST_DEPENDS
   f18 FileCheck count not module_files
 )
 
-if (LINK_WITH_FIR)
-  list(APPEND FLANG_TEST_DEPENDS tco)
-endif()
+list(APPEND FLANG_TEST_DEPENDS tco)
 
 if (FLANG_BUILD_NEW_DRIVER)
   list(APPEND FLANG_TEST_DEPENDS flang-new)

diff  --git a/flang/tools/CMakeLists.txt b/flang/tools/CMakeLists.txt
index 0fbf828253ef..ecce72771172 100644
--- a/flang/tools/CMakeLists.txt
+++ b/flang/tools/CMakeLists.txt
@@ -10,7 +10,5 @@ add_subdirectory(f18)
 if(FLANG_BUILD_NEW_DRIVER)
   add_subdirectory(flang-driver)
 endif()
-if(LINK_WITH_FIR)
-  add_subdirectory(tco)
-endif()
+add_subdirectory(tco)
 add_subdirectory(f18-parse-demo)


        


More information about the flang-commits mailing list