build: Build and statically link capstone to work around Ubuntu issues
Sigh...
This commit is contained in:
parent
f325d50ab8
commit
1770235648
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -18,3 +18,6 @@
|
||||
path = external/curl
|
||||
url = https://github.com/curl/curl
|
||||
ignore = dirty
|
||||
[submodule "external/capstone"]
|
||||
path = external/capstone
|
||||
url = https://github.com/capstone-engine/capstone
|
||||
|
1
external/capstone
vendored
Submodule
1
external/capstone
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 68102c05f1c55eeed1035e7ab2638181e872c162
|
@ -54,9 +54,6 @@ add_library(${PROJECT_NAME} SHARED
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
||||
|
||||
# Add additional libraries here #
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_search_module(CAPSTONE 4.0.2 REQUIRED capstone)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE libimhex LLVMDemangle capstone)
|
||||
|
||||
# ---- No need to change anything from here downwards unless you know what you're doing ---- #
|
||||
|
@ -37,7 +37,12 @@ namespace hex::plugin::builtin {
|
||||
bool m_shouldMatchSelection = false;
|
||||
|
||||
Architecture m_architecture = Architecture::ARM;
|
||||
cs_mode m_modeBasicARM = cs_mode(0), m_modeExtraARM = cs_mode(0), m_modeBasicMIPS = cs_mode(0), m_modeBasicPPC = cs_mode(0), m_modeBasicX86 = cs_mode(0);
|
||||
cs_mode m_modeBasicARM = cs_mode(0);
|
||||
cs_mode m_modeExtraARM = cs_mode(0);
|
||||
cs_mode m_modeBasicMIPS = cs_mode(0);
|
||||
cs_mode m_modeBasicPPC = cs_mode(0);
|
||||
cs_mode m_modeBasicX86 = cs_mode(0);
|
||||
|
||||
bool m_littleEndianMode = true, m_micoMode = false, m_sparcV9Mode = false;
|
||||
|
||||
std::vector<Disassembly> m_disassembly;
|
||||
|
@ -17,7 +17,7 @@ set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "")
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
if(NOT USE_SYSTEM_NLOHMANN_JSON)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nlohmann_json ${CMAKE_CURRENT_BINARY_DIR}/external/nlohmann_json)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nlohmann_json ${CMAKE_CURRENT_BINARY_DIR}/external/nlohmann_json EXCLUDE_FROM_ALL)
|
||||
set(NLOHMANN_JSON_LIBRARIES nlohmann_json)
|
||||
else()
|
||||
find_package(nlohmann_json 3.10.2 REQUIRED)
|
||||
@ -25,7 +25,7 @@ else()
|
||||
endif()
|
||||
|
||||
if(NOT USE_SYSTEM_FMT)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/fmt ${CMAKE_CURRENT_BINARY_DIR}/external/fmt)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/fmt ${CMAKE_CURRENT_BINARY_DIR}/external/fmt EXCLUDE_FROM_ALL)
|
||||
set(FMT_LIBRARIES fmt-header-only)
|
||||
else()
|
||||
find_package(fmt 8.0.0 REQUIRED)
|
||||
@ -55,6 +55,19 @@ else()
|
||||
pkg_check_modules(YARA REQUIRED IMPORTED_TARGET yara)
|
||||
endif()
|
||||
|
||||
if (NOT USE_SYSTEM_CAPSTONE)
|
||||
set(CAPSTONE_BUILD_STATIC_RUNTIME OFF)
|
||||
set(CAPSTONE_BUILD_SHARED OFF)
|
||||
set(CAPSTONE_BUILD_TESTS OFF)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/capstone ${CMAKE_CURRENT_BINARY_DIR}/external/capstone EXCLUDE_FROM_ALL)
|
||||
set(CAPSTONE_LIBRARIES capstone-static)
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_search_module(CAPSTONE 4.0.2 REQUIRED capstone)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
find_package(mbedTLS 2.26.0 REQUIRED)
|
||||
configurePython()
|
||||
|
||||
@ -134,4 +147,4 @@ if (APPLE)
|
||||
target_link_libraries(libimhex PUBLIC ${FOUNDATION})
|
||||
endif ()
|
||||
|
||||
target_link_libraries(libimhex PUBLIC imgui nfd magic capstone LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} ${Python_LIBRARIES})
|
||||
target_link_libraries(libimhex PUBLIC imgui nfd magic ${CAPSTONE_LIBRARIES} LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${LIBCURL_LIBRARIES} ${MBEDTLS_LIBRARIES} ${FMT_LIBRARIES} ${Python_LIBRARIES})
|
||||
|
@ -22,6 +22,10 @@ namespace hex {
|
||||
TMS320C64X,
|
||||
M680X,
|
||||
EVM,
|
||||
MOS65XX,
|
||||
WASM,
|
||||
BPF,
|
||||
RISCV,
|
||||
|
||||
MAX,
|
||||
MIN = ARM
|
||||
@ -37,7 +41,7 @@ namespace hex {
|
||||
return cs_support(toCapstoneArchictecture(architecture));
|
||||
}
|
||||
|
||||
constexpr static const char * const ArchitectureNames[] = { "ARM32", "ARM64", "MIPS", "x86", "PowerPC", "Sparc", "SystemZ", "XCore", "68K", "TMS320C64x", "680X", "Ethereum" };
|
||||
constexpr static const char * const ArchitectureNames[] = { "ARM32", "ARM64", "MIPS", "x86", "PowerPC", "Sparc", "SystemZ", "XCore", "68K", "TMS320C64x", "680X", "Ethereum", "MOS65XX", "WebAssembly", "Berkeley Packet Filter", "RISC-V" };
|
||||
|
||||
static inline s32 getArchitectureSupportedCount() {
|
||||
static s32 supportedCount = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user