summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--CMakeModules/FindLLVM.cmake16
-rw-r--r--externals/CMakeLists.txt9
-rw-r--r--externals/demangle/ItaniumDemangle.cpp4
-rw-r--r--externals/demangle/llvm/Demangle/Demangle.h (renamed from externals/demangle/Demangle.h)0
-rw-r--r--externals/demangle/llvm/Demangle/DemangleConfig.h (renamed from externals/demangle/DemangleConfig.h)0
-rw-r--r--externals/demangle/llvm/Demangle/ItaniumDemangle.h (renamed from externals/demangle/ItaniumDemangle.h)0
-rw-r--r--externals/demangle/llvm/Demangle/StringView.h (renamed from externals/demangle/StringView.h)0
-rw-r--r--externals/demangle/llvm/Demangle/Utility.h (renamed from externals/demangle/Utility.h)0
-rw-r--r--src/common/CMakeLists.txt2
-rw-r--r--src/common/demangle.cpp6
11 files changed, 28 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f91ba950a..b3329318a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -208,6 +208,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
find_package(enet 1.3 MODULE)
find_package(fmt 9 REQUIRED)
find_package(inih MODULE)
+find_package(LLVM MODULE)
find_package(lz4 REQUIRED)
find_package(nlohmann_json 3.8 REQUIRED)
find_package(Opus 1.3 MODULE)
diff --git a/CMakeModules/FindLLVM.cmake b/CMakeModules/FindLLVM.cmake
new file mode 100644
index 000000000..513d9a536
--- /dev/null
+++ b/CMakeModules/FindLLVM.cmake
@@ -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()
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index 94dd8bb62..8532fd7a8 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -158,6 +158,9 @@ if (YUZU_USE_EXTERNAL_VULKAN_HEADERS)
add_subdirectory(Vulkan-Headers EXCLUDE_FROM_ALL)
endif()
-add_library(demangle STATIC)
-target_include_directories(demangle PUBLIC ./demangle)
-target_sources(demangle PRIVATE demangle/ItaniumDemangle.cpp)
+if (NOT TARGET LLVM::Demangle)
+ add_library(demangle STATIC)
+ target_include_directories(demangle PUBLIC ./demangle)
+ target_sources(demangle PRIVATE demangle/ItaniumDemangle.cpp)
+ add_library(LLVM::Demangle ALIAS demangle)
+endif()
diff --git a/externals/demangle/ItaniumDemangle.cpp b/externals/demangle/ItaniumDemangle.cpp
index 5e078e3e2..b055a2fd7 100644
--- a/externals/demangle/ItaniumDemangle.cpp
+++ b/externals/demangle/ItaniumDemangle.cpp
@@ -11,8 +11,8 @@
// file does not yet support:
// - C++ modules TS
-#include "Demangle.h"
-#include "ItaniumDemangle.h"
+#include "llvm/Demangle/Demangle.h"
+#include "llvm/Demangle/ItaniumDemangle.h"
#include <cassert>
#include <cctype>
diff --git a/externals/demangle/Demangle.h b/externals/demangle/llvm/Demangle/Demangle.h
index 5b673e4e1..5b673e4e1 100644
--- a/externals/demangle/Demangle.h
+++ b/externals/demangle/llvm/Demangle/Demangle.h
diff --git a/externals/demangle/DemangleConfig.h b/externals/demangle/llvm/Demangle/DemangleConfig.h
index a8aef9df1..a8aef9df1 100644
--- a/externals/demangle/DemangleConfig.h
+++ b/externals/demangle/llvm/Demangle/DemangleConfig.h
diff --git a/externals/demangle/ItaniumDemangle.h b/externals/demangle/llvm/Demangle/ItaniumDemangle.h
index 64b35c142..64b35c142 100644
--- a/externals/demangle/ItaniumDemangle.h
+++ b/externals/demangle/llvm/Demangle/ItaniumDemangle.h
diff --git a/externals/demangle/StringView.h b/externals/demangle/llvm/Demangle/StringView.h
index 44d2b18a3..44d2b18a3 100644
--- a/externals/demangle/StringView.h
+++ b/externals/demangle/llvm/Demangle/StringView.h
diff --git a/externals/demangle/Utility.h b/externals/demangle/llvm/Demangle/Utility.h
index 50d05c6b1..50d05c6b1 100644
--- a/externals/demangle/Utility.h
+++ b/externals/demangle/llvm/Demangle/Utility.h
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index bd6ac6716..9884a4a0b 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -177,7 +177,7 @@ endif()
create_target_directory_groups(common)
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)
target_precompile_headers(common PRIVATE precompiled_headers.h)
diff --git a/src/common/demangle.cpp b/src/common/demangle.cpp
index f4246f666..3310faf86 100644
--- a/src/common/demangle.cpp
+++ b/src/common/demangle.cpp
@@ -1,13 +1,11 @@
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
+#include <llvm/Demangle/Demangle.h>
+
#include "common/demangle.h"
#include "common/scope_exit.h"
-namespace llvm {
-char* itaniumDemangle(const char* mangled_name, char* buf, size_t* n, int* status);
-}
-
namespace Common {
std::string DemangleSymbol(const std::string& mangled) {