openmp_wrappers/new
)
-include(GetClangResourceDir)
-get_clang_resource_dir(output_dir PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. SUBDIR include)
+set(output_dir ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION_MAJOR}/include)
set(out_files)
set(generated_files)
add_header_target("windows-resource-headers" ${windows_only_files})
add_header_target("utility-resource-headers" ${utility_files})
-get_clang_resource_dir(header_install_dir SUBDIR include)
+set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR}/include)
#############################################################
# Install rules for the catch-all clang-resource-headers target
list(APPEND implicitDirs -I ${implicitDir})
endforeach()
- include(GetClangResourceDir)
- get_clang_resource_dir(resource_dir PREFIX ${LLVM_BINARY_DIR})
add_custom_command(
COMMENT Generate ASTNodeAPI.json
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ASTNodeAPI.json
$<TARGET_FILE:clang-ast-dump>
# Skip this in debug mode because parsing AST.h is too slow
--skip-processing=${skip_expensive_processing}
- -I ${resource_dir}/include
+ -I ${LLVM_BINARY_DIR}/lib/clang/${CLANG_VERSION_MAJOR}/include
-I ${CLANG_SOURCE_DIR}/include
-I ${LLVM_BINARY_DIR}/tools/clang/include
-I ${LLVM_BINARY_DIR}/include
list(APPEND compiler_rt_configure_deps LLVMTestingSupport)
endif()
- include(GetClangResourceDir)
- get_clang_resource_dir(output_resource_dir PREFIX ${LLVM_BINARY_DIR})
- get_clang_resource_dir(install_resource_dir)
ExternalProject_Add(compiler-rt
DEPENDS llvm-config clang ${compiler_rt_configure_deps}
PREFIX ${COMPILER_RT_PREFIX}
-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}
-DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config
-DLLVM_LIT_ARGS=${LLVM_LIT_ARGS}
- -DCOMPILER_RT_OUTPUT_DIR=${output_resource_dir}
+ -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION_MAJOR}
-DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR}
- -DCOMPILER_RT_INSTALL_PATH:PATH=${install_resource_dir}
+ -DCOMPILER_RT_INSTALL_PATH:PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR}
-DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX}
include(CheckIncludeFile)
include(CheckCXXSourceCompiles)
include(GNUInstallDirs)
-include(GetClangResourceDir)
include(ExtendPath)
include(CompilerRTDarwinUtils)
endif()
if (LLVM_TREE_AVAILABLE)
+ # Compute the Clang version from the LLVM version.
+ # FIXME: We should be able to reuse CLANG_VERSION_MAJOR variable calculated
+ # in Clang cmake files, instead of copying the rules here.
+ string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR
+ ${PACKAGE_VERSION})
# Setup the paths where compiler-rt runtimes and headers should be stored.
- get_clang_resource_dir(COMPILER_RT_OUTPUT_DIR PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/..)
+ set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION_MAJOR})
set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
- get_clang_resource_dir(COMPILER_RT_INSTALL_PATH)
+ set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR})
option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests."
${LLVM_INCLUDE_TESTS})
option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
#include "clang/Basic/Version.h"
#include "clang/Config/config.h"
-#include "clang/Driver/Driver.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
Log *log = GetLog(LLDBLog::Host);
std::string raw_path = lldb_shlib_spec.GetPath();
llvm::StringRef parent_dir = llvm::sys::path::parent_path(raw_path);
- const std::string clang_resource_path =
- clang::driver::Driver::GetResourcesPath("bin/lldb", CLANG_RESOURCE_DIR);
static const llvm::StringRef kResourceDirSuffixes[] = {
// LLVM.org's build of LLDB uses the clang resource directory placed
- // in $install_dir/lib{,64}/clang/$clang_version or
- // $install_dir/bin/$CLANG_RESOURCE_DIR
- clang_resource_path,
+ // in $install_dir/lib{,64}/clang/$clang_version.
+ CLANG_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_MAJOR_STRING,
// swift-lldb uses the clang resource directory copied from swift, which
// by default is placed in $install_dir/lib{,64}/lldb/clang. LLDB places
// it there, so we use LLDB_INSTALL_LIBDIR_BASENAME.
}
bool lldb_private::ComputeClangResourceDirectory(FileSpec &lldb_shlib_spec,
- FileSpec &file_spec,
- bool verify) {
+ FileSpec &file_spec, bool verify) {
#if !defined(__APPLE__)
return DefaultComputeClangResourceDirectory(lldb_shlib_spec, file_spec,
verify);
//===----------------------------------------------------------------------===//
#include "clang/Basic/Version.h"
-#include "clang/Config/config.h"
-#include "clang/Driver/Driver.h"
#include "Plugins/ExpressionParser/Clang/ClangHost.h"
#include "TestingSupport/SubsystemRAII.h"
TEST_F(ClangHostTest, ComputeClangResourceDirectory) {
#if !defined(_WIN32)
std::string path_to_liblldb = "/foo/bar/lib/";
+ std::string path_to_clang_dir =
+ "/foo/bar/" LLDB_INSTALL_LIBDIR_BASENAME "/clang/" CLANG_VERSION_MAJOR_STRING;
#else
- std::string path_to_liblldb = "C:\\foo\\bar\\lib\\";
+ std::string path_to_liblldb = "C:\\foo\\bar\\lib";
+ std::string path_to_clang_dir =
+ "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_MAJOR_STRING;
#endif
- std::string path_to_clang_dir = clang::driver::Driver::GetResourcesPath(
- path_to_liblldb + "liblldb", CLANG_RESOURCE_DIR);
EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir);
// The path doesn't really exist, so setting verify to true should make
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR
${PACKAGE_VERSION})
- if(DEFINED CLANG_RESOURCE_DIR AND NOT CLANG_RESOURCE_DIR STREQUAL "")
- set(resource_dir ${LLVM_TOOLS_BINARY_DIR}/${CLANG_RESOURCE_DIR})
- else()
- set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION_MAJOR}")
- endif()
+ set(resource_dir "${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION_MAJOR}")
set(flag_types ASM C CXX MODULE_LINKER SHARED_LINKER EXE_LINKER)
foreach(type ${flag_types})
set(${type}_flag -DCMAKE_${type}_FLAGS=-resource-dir=${resource_dir})
if(${OPENMP_STANDALONE_BUILD})
set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
else()
- include(GetClangResourceDir)
- get_clang_resource_dir(LIBOMP_HEADERS_INSTALL_PATH SUBDIR include)
+ string(REGEX MATCH "[0-9]+" CLANG_VERSION ${PACKAGE_VERSION})
+ set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include")
endif()
# Build host runtime library, after LIBOMPTARGET variables are set since they are needed