Move UICommon/Disassembler to Common/HostDisassembler

A preliminary commit for a cleaner diff and an easier review
This commit is contained in:
mitaclaw 2024-07-28 19:12:21 -07:00
parent a0987829e5
commit ca9222a16b
6 changed files with 33 additions and 28 deletions

View File

@ -75,6 +75,8 @@ add_library(common
Hash.cpp Hash.cpp
Hash.h Hash.h
HookableEvent.h HookableEvent.h
HostDisassembler.cpp
HostDisassembler.h
HttpRequest.cpp HttpRequest.cpp
HttpRequest.h HttpRequest.h
Image.cpp Image.cpp
@ -180,6 +182,11 @@ PRIVATE
${VTUNE_LIBRARIES} ${VTUNE_LIBRARIES}
) )
if ((DEFINED CMAKE_ANDROID_ARCH_ABI AND CMAKE_ANDROID_ARCH_ABI MATCHES "x86|x86_64") OR
(NOT DEFINED CMAKE_ANDROID_ARCH_ABI AND _M_X86_64))
target_link_libraries(common PRIVATE bdisasm)
endif()
if (APPLE) if (APPLE)
target_link_libraries(common target_link_libraries(common
PRIVATE PRIVATE
@ -330,6 +337,28 @@ if(OPROFILE_FOUND)
target_link_libraries(common PRIVATE OProfile::OProfile) target_link_libraries(common PRIVATE OProfile::OProfile)
endif() endif()
if(ENABLE_LLVM)
find_package(LLVM CONFIG)
if(LLVM_FOUND)
message(STATUS "LLVM found, enabling LLVM support in disassembler")
target_compile_definitions(common PRIVATE HAVE_LLVM)
# Minimal documentation about LLVM's CMake functions is available here:
# https://releases.llvm.org/16.0.0/docs/CMake.html#embedding-llvm-in-your-project
# https://groups.google.com/g/llvm-dev/c/YeEVe7HTasQ?pli=1
#
# However, you have to read the source code in any case.
# Look for LLVM-Config.cmake in your (Unix) system:
# $ find /usr -name LLVM-Config\\.cmake 2>/dev/null
llvm_expand_pseudo_components(LLVM_EXPAND_COMPONENTS
AllTargetsInfos AllTargetsDisassemblers AllTargetsCodeGens
)
llvm_config(common USE_SHARED
mcdisassembler target ${LLVM_EXPAND_COMPONENTS}
)
target_include_directories(common PRIVATE ${LLVM_INCLUDE_DIRS})
endif()
endif()
if(UNIX) if(UNIX)
# Posix networking code needs to be fixed for Windows # Posix networking code needs to be fixed for Windows
add_executable(traversal_server TraversalServer.cpp) add_executable(traversal_server TraversalServer.cpp)

View File

@ -1,7 +1,7 @@
// Copyright 2008 Dolphin Emulator Project // Copyright 2008 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "UICommon/Disassembler.h" #include "Common/HostDisassembler.h"
#include <sstream> #include <sstream>

View File

@ -117,6 +117,7 @@
<ClInclude Include="Common\GL\GLX11Window.h" /> <ClInclude Include="Common\GL\GLX11Window.h" />
<ClInclude Include="Common\Hash.h" /> <ClInclude Include="Common\Hash.h" />
<ClInclude Include="Common\HookableEvent.h" /> <ClInclude Include="Common\HookableEvent.h" />
<ClInclude Include="Common\HostDisassembler.h" />
<ClInclude Include="Common\HRWrap.h" /> <ClInclude Include="Common\HRWrap.h" />
<ClInclude Include="Common\HttpRequest.h" /> <ClInclude Include="Common\HttpRequest.h" />
<ClInclude Include="Common\Image.h" /> <ClInclude Include="Common\Image.h" />
@ -549,7 +550,6 @@
<ClInclude Include="InputCommon\KeyboardStatus.h" /> <ClInclude Include="InputCommon\KeyboardStatus.h" />
<ClInclude Include="UICommon\AutoUpdate.h" /> <ClInclude Include="UICommon\AutoUpdate.h" />
<ClInclude Include="UICommon\CommandLineParse.h" /> <ClInclude Include="UICommon\CommandLineParse.h" />
<ClInclude Include="UICommon\Disassembler.h" />
<ClInclude Include="UICommon\DiscordPresence.h" /> <ClInclude Include="UICommon\DiscordPresence.h" />
<ClInclude Include="UICommon\GameFile.h" /> <ClInclude Include="UICommon\GameFile.h" />
<ClInclude Include="UICommon\GameFileCache.h" /> <ClInclude Include="UICommon\GameFileCache.h" />
@ -809,6 +809,7 @@
<ClCompile Include="Common\GL\GLInterface\WGL.cpp" /> <ClCompile Include="Common\GL\GLInterface\WGL.cpp" />
<ClCompile Include="Common\GL\GLUtil.cpp" /> <ClCompile Include="Common\GL\GLUtil.cpp" />
<ClCompile Include="Common\Hash.cpp" /> <ClCompile Include="Common\Hash.cpp" />
<ClCompile Include="Common\HostDisassembler.cpp" />
<ClCompile Include="Common\HRWrap.cpp" /> <ClCompile Include="Common\HRWrap.cpp" />
<ClCompile Include="Common\HttpRequest.cpp" /> <ClCompile Include="Common\HttpRequest.cpp" />
<ClCompile Include="Common\Image.cpp" /> <ClCompile Include="Common\Image.cpp" />
@ -1207,7 +1208,6 @@
<ClCompile Include="InputCommon\InputProfile.cpp" /> <ClCompile Include="InputCommon\InputProfile.cpp" />
<ClCompile Include="UICommon\AutoUpdate.cpp" /> <ClCompile Include="UICommon\AutoUpdate.cpp" />
<ClCompile Include="UICommon\CommandLineParse.cpp" /> <ClCompile Include="UICommon\CommandLineParse.cpp" />
<ClCompile Include="UICommon\Disassembler.cpp" />
<ClCompile Include="UICommon\DiscordPresence.cpp" /> <ClCompile Include="UICommon\DiscordPresence.cpp" />
<ClCompile Include="UICommon\GameFile.cpp" /> <ClCompile Include="UICommon\GameFile.cpp" />
<ClCompile Include="UICommon\GameFileCache.cpp" /> <ClCompile Include="UICommon\GameFileCache.cpp" />

View File

@ -12,10 +12,10 @@
#include <fmt/format.h> #include <fmt/format.h>
#include "Common/GekkoDisassembler.h" #include "Common/GekkoDisassembler.h"
#include "Common/HostDisassembler.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/PowerPC/PPCAnalyst.h" #include "Core/PowerPC/PPCAnalyst.h"
#include "Core/System.h" #include "Core/System.h"
#include "UICommon/Disassembler.h"
#include "DolphinQt/Host.h" #include "DolphinQt/Host.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"

View File

@ -3,8 +3,6 @@ add_library(uicommon
AutoUpdate.h AutoUpdate.h
CommandLineParse.cpp CommandLineParse.cpp
CommandLineParse.h CommandLineParse.h
Disassembler.cpp
Disassembler.h
DiscordPresence.cpp DiscordPresence.cpp
DiscordPresence.h DiscordPresence.h
GameFile.cpp GameFile.cpp
@ -59,28 +57,6 @@ if(TARGET LibUSB::LibUSB)
target_link_libraries(uicommon PRIVATE LibUSB::LibUSB) target_link_libraries(uicommon PRIVATE LibUSB::LibUSB)
endif() endif()
if(ENABLE_LLVM)
find_package(LLVM CONFIG)
if(LLVM_FOUND)
message(STATUS "LLVM found, enabling LLVM support in disassembler")
target_compile_definitions(uicommon PRIVATE HAVE_LLVM)
# Minimal documentation about LLVM's CMake functions is available here:
# https://releases.llvm.org/16.0.0/docs/CMake.html#embedding-llvm-in-your-project
# https://groups.google.com/g/llvm-dev/c/YeEVe7HTasQ?pli=1
#
# However, you have to read the source code in any case.
# Look for LLVM-Config.cmake in your (Unix) system:
# $ find /usr -name LLVM-Config\\.cmake 2>/dev/null
llvm_expand_pseudo_components(LLVM_EXPAND_COMPONENTS
AllTargetsInfos AllTargetsDisassemblers AllTargetsCodeGens
)
llvm_config(uicommon USE_SHARED
mcdisassembler target ${LLVM_EXPAND_COMPONENTS}
)
target_include_directories(uicommon PRIVATE ${LLVM_INCLUDE_DIRS})
endif()
endif()
if(USE_DISCORD_PRESENCE) if(USE_DISCORD_PRESENCE)
target_compile_definitions(uicommon PRIVATE -DUSE_DISCORD_PRESENCE) target_compile_definitions(uicommon PRIVATE -DUSE_DISCORD_PRESENCE)
target_link_libraries(uicommon PRIVATE discord-rpc) target_link_libraries(uicommon PRIVATE discord-rpc)