diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4b5a7b5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "thirdparty/xxHash"] + path = thirdparty/xxHash + url = https://github.com/Cyan4973/xxHash.git +[submodule "thirdparty/fmt"] + path = thirdparty/fmt + url = https://github.com/fmtlib/fmt.git +[submodule "thirdparty/tomlplusplus"] + path = thirdparty/tomlplusplus + url = https://github.com/marzer/tomlplusplus.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 184ab29..450a6dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required (VERSION 3.20) -include($ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake) set(THIRDPARTY_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty) set(CMAKE_CXX_STANDARD 17) @@ -16,10 +15,10 @@ set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") include("cmake/bin2h.cmake") -add_subdirectory(${THIRDPARTY_ROOT}/disasm) +add_subdirectory(${THIRDPARTY_ROOT}) set(POWERANALYSE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/PowerAnalyse) -set(POWERRECOMP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/PowerRecomp) set(POWERUTILS_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/PowerUtils) +set(POWERRECOMP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/PowerRecomp) project ("PowerRecomp-ALL") diff --git a/PowerAnalyse/CMakeLists.txt b/PowerAnalyse/CMakeLists.txt index 2937470..f8f9f1c 100644 --- a/PowerAnalyse/CMakeLists.txt +++ b/PowerAnalyse/CMakeLists.txt @@ -2,12 +2,13 @@ project("PowerAnalyse") -add_executable(PowerAnalyse "main.cpp" "function.h" "function.cpp") -add_library(LibPowerAnalyse "function.h" "function.cpp") - -find_package(fmt CONFIG REQUIRED) - -target_include_directories(LibPowerAnalyse PUBLIC .) -target_link_libraries(LibPowerAnalyse PUBLIC PowerUtils) +add_executable(PowerAnalyse + "main.cpp" + "function.cpp") target_link_libraries(PowerAnalyse PRIVATE PowerUtils fmt::fmt) + +add_library(LibPowerAnalyse "function.cpp") +target_include_directories(LibPowerAnalyse PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(LibPowerAnalyse PUBLIC PowerUtils) + diff --git a/PowerAnalyse/main.cpp b/PowerAnalyse/main.cpp index be77ef2..74f04b4 100644 --- a/PowerAnalyse/main.cpp +++ b/PowerAnalyse/main.cpp @@ -364,7 +364,7 @@ int main() if (f.base == 0x82BD7420) { - __debugbreak(); + __builtin_debugtrap(); } image.symbols.emplace(fmt::format("sub_{:X}", f.base), f.base, f.size, Symbol_Function); diff --git a/PowerRecomp/CMakeLists.txt b/PowerRecomp/CMakeLists.txt index b675e22..287e9e3 100644 --- a/PowerRecomp/CMakeLists.txt +++ b/PowerRecomp/CMakeLists.txt @@ -2,17 +2,26 @@ cmake_minimum_required (VERSION 3.8) project("PowerRecomp") -BIN2H(SOURCE_FILE ${POWERUTILS_ROOT}/ppc_context.h HEADER_FILE "generated/ppc_context.gen.h" ARRAY_TYPE "char" VARIABLE_NAME "g_PPCContextText") +BIN2H(SOURCE_FILE + ${POWERUTILS_ROOT}/ppc_context.h + HEADER_FILE "generated/ppc_context.gen.h" + ARRAY_TYPE "char" + VARIABLE_NAME "g_PPCContextText") + +add_executable(PowerRecomp + "main.cpp" + "recompiler.cpp" + "test_recompiler.cpp" + "recompiler_config.cpp") -add_executable(PowerRecomp "main.cpp" "pch.h" "recompiler.cpp" "recompiler.h" "test_recompiler.cpp" "test_recompiler.h" "recompiler_config.h" "recompiler_config.cpp") target_precompile_headers(PowerRecomp PUBLIC "pch.h") -find_package(fmt CONFIG REQUIRED) -find_package(PkgConfig REQUIRED) -pkg_check_modules(tomlplusplus REQUIRED IMPORTED_TARGET tomlplusplus) -find_package(xxHash CONFIG REQUIRED) - -target_link_libraries(PowerRecomp PRIVATE LibPowerAnalyse fmt::fmt PkgConfig::tomlplusplus xxHash::xxhash) +target_link_libraries(PowerRecomp PRIVATE + LibPowerAnalyse + PowerUtils + fmt::fmt + tomlplusplus::tomlplusplus + xxHash::xxhash) if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(PowerRecomp PRIVATE -Wno-switch -Wno-unused-variable -Wno-null-arithmetic) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt new file mode 100644 index 0000000..06e6572 --- /dev/null +++ b/thirdparty/CMakeLists.txt @@ -0,0 +1,13 @@ +add_subdirectory(${THIRDPARTY_ROOT}/disasm) + +if (NOT TARGET fmt::fmt) + add_subdirectory(${THIRDPARTY_ROOT}/fmt) +endif() + +if (NOT TARGET tomlplusplus::tomlplusplus) + add_subdirectory(${THIRDPARTY_ROOT}/tomlplusplus) +endif() + +if (NOT TARGET xxHash::xxhash) + add_subdirectory(${THIRDPARTY_ROOT}/xxHash/cmake_unofficial) +endif() diff --git a/thirdparty/fmt b/thirdparty/fmt new file mode 160000 index 0000000..873670b --- /dev/null +++ b/thirdparty/fmt @@ -0,0 +1 @@ +Subproject commit 873670ba3f9e7bc77ec2c1c94b04f1f8bef77e9f diff --git a/thirdparty/tomlplusplus b/thirdparty/tomlplusplus new file mode 160000 index 0000000..c4369ae --- /dev/null +++ b/thirdparty/tomlplusplus @@ -0,0 +1 @@ +Subproject commit c4369ae1d8955cae20c4ab40b9813ef4b60e48be diff --git a/thirdparty/xxHash b/thirdparty/xxHash new file mode 160000 index 0000000..2bf8313 --- /dev/null +++ b/thirdparty/xxHash @@ -0,0 +1 @@ +Subproject commit 2bf8313b934633b2a5b7e8fd239645b85e10c852 diff --git a/vcpkg.json b/vcpkg.json deleted file mode 100644 index db96992..0000000 --- a/vcpkg.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "builtin-baseline": "e63bd09dc0b7204467705c1c7c71d0e2a3f8860b", - "dependencies": [ - { - "name": "pkgconf", - "platform": "windows" - }, - "fmt", - "tomlplusplus", - "xxhash" - ] -}