Merge pull request #9662 from abouvier/cmake-llvm
cmake: prefer system llvm library
This commit is contained in:
commit
44b981fd3e
@ -208,6 +208,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
|||||||
find_package(enet 1.3 MODULE)
|
find_package(enet 1.3 MODULE)
|
||||||
find_package(fmt 9 REQUIRED)
|
find_package(fmt 9 REQUIRED)
|
||||||
find_package(inih MODULE)
|
find_package(inih MODULE)
|
||||||
|
find_package(LLVM MODULE)
|
||||||
find_package(lz4 REQUIRED)
|
find_package(lz4 REQUIRED)
|
||||||
find_package(nlohmann_json 3.8 REQUIRED)
|
find_package(nlohmann_json 3.8 REQUIRED)
|
||||||
find_package(Opus 1.3 MODULE)
|
find_package(Opus 1.3 MODULE)
|
||||||
|
16
CMakeModules/FindLLVM.cmake
Normal file
16
CMakeModules/FindLLVM.cmake
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2023 Alexandre Bouvier <contact@amb.tf>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
find_package(LLVM QUIET CONFIG)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(LLVM CONFIG_MODE)
|
||||||
|
|
||||||
|
if (LLVM_FOUND AND NOT TARGET LLVM::Demangle)
|
||||||
|
add_library(LLVM::Demangle INTERFACE IMPORTED)
|
||||||
|
llvm_map_components_to_libnames(LLVM_LIBRARIES demangle)
|
||||||
|
target_compile_definitions(LLVM::Demangle INTERFACE ${LLVM_DEFINITIONS})
|
||||||
|
target_include_directories(LLVM::Demangle INTERFACE ${LLVM_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(LLVM::Demangle INTERFACE ${LLVM_LIBRARIES})
|
||||||
|
endif()
|
9
externals/CMakeLists.txt
vendored
9
externals/CMakeLists.txt
vendored
@ -158,6 +158,9 @@ if (YUZU_USE_EXTERNAL_VULKAN_HEADERS)
|
|||||||
add_subdirectory(Vulkan-Headers EXCLUDE_FROM_ALL)
|
add_subdirectory(Vulkan-Headers EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(demangle STATIC)
|
if (NOT TARGET LLVM::Demangle)
|
||||||
target_include_directories(demangle PUBLIC ./demangle)
|
add_library(demangle STATIC)
|
||||||
target_sources(demangle PRIVATE demangle/ItaniumDemangle.cpp)
|
target_include_directories(demangle PUBLIC ./demangle)
|
||||||
|
target_sources(demangle PRIVATE demangle/ItaniumDemangle.cpp)
|
||||||
|
add_library(LLVM::Demangle ALIAS demangle)
|
||||||
|
endif()
|
||||||
|
4
externals/demangle/ItaniumDemangle.cpp
vendored
4
externals/demangle/ItaniumDemangle.cpp
vendored
@ -11,8 +11,8 @@
|
|||||||
// file does not yet support:
|
// file does not yet support:
|
||||||
// - C++ modules TS
|
// - C++ modules TS
|
||||||
|
|
||||||
#include "Demangle.h"
|
#include "llvm/Demangle/Demangle.h"
|
||||||
#include "ItaniumDemangle.h"
|
#include "llvm/Demangle/ItaniumDemangle.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
@ -177,7 +177,7 @@ endif()
|
|||||||
create_target_directory_groups(common)
|
create_target_directory_groups(common)
|
||||||
|
|
||||||
target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
|
target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
|
||||||
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd demangle)
|
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
|
||||||
|
|
||||||
if (YUZU_USE_PRECOMPILED_HEADERS)
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
target_precompile_headers(common PRIVATE precompiled_headers.h)
|
target_precompile_headers(common PRIVATE precompiled_headers.h)
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <llvm/Demangle/Demangle.h>
|
||||||
|
|
||||||
#include "common/demangle.h"
|
#include "common/demangle.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
|
|
||||||
namespace llvm {
|
|
||||||
char* itaniumDemangle(const char* mangled_name, char* buf, size_t* n, int* status);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
|
|
||||||
std::string DemangleSymbol(const std::string& mangled) {
|
std::string DemangleSymbol(const std::string& mangled) {
|
||||||
|
Loading…
Reference in New Issue
Block a user