Skip to content

Commit fae4276

Browse files
committed
centralize output/install location
1 parent 3b22a98 commit fae4276

File tree

6 files changed

+7
-76
lines changed

6 files changed

+7
-76
lines changed

flang-rt/CMakeLists.txt

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -76,66 +76,8 @@ include(ExtendPath)
7676
# Path to LLVM development tools (FileCheck, llvm-lit, not, ...)
7777
set(LLVM_TOOLS_DIR "${LLVM_BINARY_DIR}/bin")
7878

79-
8079
flang_module_fortran_enable()
8180

82-
# Determine build and install paths.
83-
# The build path is absolute, but the install dir is relative, CMake's install
84-
# command has to apply CMAKE_INSTALL_PREFIX itself.
85-
get_toolchain_library_subdir(toolchain_lib_subdir)
86-
get_toolchain_module_subdir(toolchain_mod_subdir)
87-
88-
if (LLVM_TREE_AVAILABLE)
89-
# In a bootstrap build emit the libraries into a default search path in the
90-
# build directory of the just-built compiler. This allows using the
91-
# just-built compiler without specifying paths to runtime libraries.
92-
#
93-
# Despite Clang in the name, get_clang_resource_dir does not depend on Clang
94-
# being added to the build. Flang uses the same resource dir as clang.
95-
include(GetClangResourceDir)
96-
get_clang_resource_dir(FLANG_RT_OUTPUT_RESOURCE_DIR PREFIX "${LLVM_LIBRARY_OUTPUT_INTDIR}/..")
97-
get_clang_resource_dir(FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT)
98-
99-
extend_path(FLANG_RT_OUTPUT_RESOURCE_LIB_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "${toolchain_lib_subdir}")
100-
extend_path(FLANG_RT_OUTPUT_RESOURCE_MOD_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "${toolchain_mod_subdir}")
101-
else ()
102-
# In a standalone runtimes build, do not write into LLVM_BINARY_DIR. It may be
103-
# read-only and/or shared by multiple runtimes with different build
104-
# configurations (e.g. Debug/Release). Use the runtime's own lib dir like any
105-
# non-toolchain library.
106-
# For the install prefix, still use the resource dir assuming that Flang will
107-
# be installed there using the same prefix. This is to not have a difference
108-
# between bootstrap and standalone runtimes builds.
109-
set(FLANG_RT_OUTPUT_RESOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
110-
set(FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT "lib${LLVM_LIBDIR_SUFFIX}/clang/${LLVM_VERSION_MAJOR}")
111-
112-
extend_path(FLANG_RT_OUTPUT_RESOURCE_LIB_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "lib${LLVM_LIBDIR_SUFFIX}")
113-
extend_path(FLANG_RT_OUTPUT_RESOURCE_MOD_DIR "${FLANG_RT_OUTPUT_RESOURCE_DIR}" "finclude")
114-
endif ()
115-
set(FLANG_RT_INSTALL_RESOURCE_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH_DEFAULT}"
116-
CACHE PATH "Path to install runtime libraries to (default: clang resource dir)")
117-
extend_path(FLANG_RT_INSTALL_RESOURCE_LIB_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH}" "${toolchain_lib_subdir}")
118-
#extend_path(FLANG_RT_INSTALL_RESOURCE_MOD_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH}" "${toolchain_mod_subdir}")
119-
cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_DIR)
120-
cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_PATH)
121-
# FIXME: For the libflang_rt.so, the toolchain resource lib dir is not a good
122-
# destination because it is not a ld.so default search path.
123-
# The machine where the executable is eventually executed may not be the
124-
# machine where the Flang compiler and its resource dir is installed, so
125-
# setting RPath by the driver is not an solution. It should belong into
126-
# /usr/lib/<triple>/libflang_rt.so, like e.g. libgcc_s.so.
127-
# But the linker as invoked by the Flang driver also requires
128-
# libflang_rt.so to be found when linking and the resource lib dir is
129-
# the only reliable location.
130-
cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_LIB_DIR)
131-
cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_LIB_PATH)
132-
cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_MOD_DIR)
133-
#cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_MOD_PATH)
134-
135-
message("toolchain_mod_subdir: ${toolchain_mod_subdir}")
136-
message("FLANG_RT_OUTPUT_RESOURCE_MOD_DIR: ${FLANG_RT_OUTPUT_RESOURCE_MOD_DIR}")
137-
#message("FLANG_RT_INSTALL_RESOURCE_MOD_PATH: ${FLANG_RT_INSTALL_RESOURCE_MOD_PATH}")
138-
13981

14082
#################
14183
# Build Options #

flang-rt/cmake/modules/AddFlangRT.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,13 @@ function (add_flangrt_library name)
354354
if (ARG_INSTALL_WITH_TOOLCHAIN)
355355
set_target_properties(${tgtname}
356356
PROPERTIES
357-
ARCHIVE_OUTPUT_DIRECTORY "${FLANG_RT_OUTPUT_RESOURCE_LIB_DIR}"
358-
LIBRARY_OUTPUT_DIRECTORY "${FLANG_RT_OUTPUT_RESOURCE_LIB_DIR}"
357+
ARCHIVE_OUTPUT_DIRECTORY "${RUNTIMES_OUTPUT_RESOURCE_LIB_DIR}"
358+
LIBRARY_OUTPUT_DIRECTORY "${RUNTIMES_OUTPUT_RESOURCE_LIB_DIR}"
359359
)
360360

361361
install(TARGETS ${tgtname}
362-
ARCHIVE DESTINATION "${FLANG_RT_INSTALL_RESOURCE_LIB_PATH}"
363-
LIBRARY DESTINATION "${FLANG_RT_INSTALL_RESOURCE_LIB_PATH}"
362+
ARCHIVE DESTINATION "${RUNTIMES_INSTALL_RESOURCE_LIB_PATH}"
363+
LIBRARY DESTINATION "${RUNTIMES_INSTALL_RESOURCE_LIB_PATH}"
364364
)
365365
endif ()
366366

flang/test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ if (LLVM_BUILD_EXAMPLES)
9797
endif ()
9898

9999
if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES AND NOT FLANG_STANDALONE_BUILD)
100-
list(APPEND FLANG_TEST_DEPENDS "flang-rt-mod") # For intrinsic module files (in flang-rt)
100+
list(APPEND FLANG_TEST_DEPENDS "flang-rt-mod") # For intrinsic module files (in flang-rt/)
101101
endif ()
102102

103103
if ("openmp" IN_LIST LLVM_ENABLE_RUNTIMES AND NOT FLANG_STANDALONE_BUILD)
104-
list(APPEND FLANG_TEST_DEPENDS "libomp-mod") # For omplib.mod and omplib_kinds.mod (in openmp)
104+
list(APPEND FLANG_TEST_DEPENDS "libomp-mod") # For omplib.mod and omplib_kinds.mod (in openmp/)
105105
endif ()
106106

107107
add_custom_target(flang-test-depends DEPENDS ${FLANG_TEST_DEPENDS})

flang/tools/bbc/bbc.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
#include "flang/Tools/CrossToolHelpers.h"
4646
#include "flang/Tools/TargetSetup.h"
4747
#include "flang/Version.inc"
48-
#include "clang/Driver/Driver.h"
49-
#include "llvm/Support/VirtualFileSystem.h"
5048
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
5149
#include "mlir/IR/AsmState.h"
5250
#include "mlir/IR/BuiltinOps.h"
@@ -92,8 +90,6 @@ static llvm::cl::alias includeAlias("module-directory",
9290
llvm::cl::desc("module search directory"),
9391
llvm::cl::aliasopt(includeDirs));
9492

95-
96-
9793
static llvm::cl::list<std::string>
9894
intrinsicIncludeDirs("J", llvm::cl::desc("intrinsic module search paths"));
9995

@@ -643,8 +639,6 @@ int main(int argc, char **argv) {
643639
options.isFixedForm = fixedForm;
644640
}
645641

646-
647-
648642
Fortran::common::IntrinsicTypeDefaultKinds defaultKinds;
649643
Fortran::parser::AllSources allSources;
650644
Fortran::parser::AllCookedSources allCookedSources(allSources);
@@ -653,7 +647,7 @@ int main(int argc, char **argv) {
653647
semanticsContext.set_moduleDirectory(moduleDir)
654648
.set_moduleFileSuffix(moduleSuffix)
655649
.set_searchDirectories(includeDirs)
656-
.set_intrinsicModuleDirectories(intrinsicIncludeDirs )
650+
.set_intrinsicModuleDirectories(intrinsicIncludeDirs)
657651
.set_warnOnNonstandardUsage(warnStdViolation)
658652
.set_warningsAreErrors(warnIsError);
659653

llvm/lib/Support/VirtualFileSystem.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ std::error_code FileSystem::isLocal(const Twine &Path, bool &Result) {
148148

149149
bool FileSystem::exists(const Twine &Path) {
150150
auto Status = status(Path);
151-
// llvm::errs() << " FileSystem::exists: " << Path << "-> " << (Status && Status->exists()) << "\n";
152151
return Status && Status->exists();
153152
}
154153

runtimes/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,6 @@ macro(flang_module_fortran_enable)
352352

353353
enable_language(Fortran)
354354

355-
356-
357-
358-
359355
if (CMAKE_Fortran_COMPILER_ID STREQUAL "LLVMFlang")
360356
if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
361357
message(STATUS "Compiling Flang modules")

0 commit comments

Comments
 (0)