mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Make recompilation part of the CMake build process.
This commit is contained in:
parent
a272c6d32a
commit
afc02cd68b
3 changed files with 37 additions and 15 deletions
|
|
@ -8,9 +8,6 @@ git clone --recurse-submodules https://github.com/hedge-dev/UnleashedRecomp.git
|
||||||
3. Decompress `shader.ar` and place the resulting file in `./UnleashedRecompLib/private/`.
|
3. Decompress `shader.ar` and place the resulting file in `./UnleashedRecompLib/private/`.
|
||||||
4. Open the repository directory in Visual Studio 2022 *(not Preview)* and wait for CMake generation to complete.
|
4. Open the repository directory in Visual Studio 2022 *(not Preview)* and wait for CMake generation to complete.
|
||||||
5. Under Solution Explorer, right-click and choose "Switch to CMake Targets View".
|
5. Under Solution Explorer, right-click and choose "Switch to CMake Targets View".
|
||||||
6. Expand the root project and right-click the **PowerRecomp** project and choose "Set as Startup Item", then run it and wait for recompilation to complete.
|
6. Right-click the **UnleashedRecomp** project and choose "Set as Startup Item", then choose "Add Debug Configuration".
|
||||||
7. After code recompilation, right-click the **ShaderRecomp** project and choose "Set as Startup Item", then run it and wait for recompilation to complete.
|
7. Add a `currentDir` property to the first element under `configurations` in the generated JSON and set its value to the path to your game directory (where root is the directory containing `dlc`, `game`, `save`, `update`, etc).
|
||||||
8. After shader recompilation, expand the **UnleashedRecompLib** project and open `CMakeLists.txt`, then save (CTRL+S) to force CMake cache regeneration to populate the recompiled code.
|
8. Start debugging **UnleashedRecomp**. The initial compilation might take a while to complete due to code and shader recompilation.
|
||||||
9. Right-click the **UnleashedRecomp** project and choose "Set as Startup Item" and then choose "Add Debug Configuration".
|
|
||||||
10. Add a `currentDir` property to the first element under `configurations` in the generated JSON and set its value to the path to your game directory (where root is the directory containing `dlc`, `game`, `save`, `update`, etc).
|
|
||||||
11. Start debugging **UnleashedRecomp**.
|
|
||||||
|
|
@ -3,19 +3,44 @@ project("UnleashedRecompLib")
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
"/fp:strict"
|
"/fp:strict"
|
||||||
"-march=sandybridge"
|
"-march=sandybridge"
|
||||||
"-fno-strict-aliasing")
|
"-fno-strict-aliasing"
|
||||||
|
)
|
||||||
|
|
||||||
file(GLOB SWA_PPC_RECOMPILED_SOURCES "ppc/*.cpp")
|
target_compile_definitions(PowerRecomp PRIVATE CONFIG_FILE_PATH=\"${CMAKE_CURRENT_SOURCE_DIR}/config/SWA.toml\")
|
||||||
file(GLOB SWA_SHADER_RECOMPILED_SOURCES "shader/*.cpp")
|
|
||||||
add_library(UnleashedRecompLib "main.cpp" ${SWA_PPC_RECOMPILED_SOURCES} "shader/shader_cache.h" ${SWA_SHADER_RECOMPILED_SOURCES})
|
|
||||||
|
|
||||||
target_include_directories(UnleashedRecompLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
set(SWA_PPC_RECOMPILED_SOURCES
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/ppc/ppc_config.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/ppc/ppc_context.h"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/ppc/ppc_func_mapping.cpp"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/ppc/ppc_recomp_shared.h"
|
||||||
|
)
|
||||||
|
|
||||||
target_precompile_headers(UnleashedRecompLib PUBLIC ppc/ppc_recomp_shared.h)
|
foreach(i RANGE 0 260)
|
||||||
|
list(APPEND SWA_PPC_RECOMPILED_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ppc/ppc_recomp.${i}.cpp")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
target_compile_definitions(PowerRecomp PRIVATE
|
add_custom_command(
|
||||||
CONFIG_FILE_PATH=\"${CMAKE_CURRENT_SOURCE_DIR}/config/SWA.toml\")
|
OUTPUT ${SWA_PPC_RECOMPILED_SOURCES}
|
||||||
|
COMMAND PowerRecomp
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/config/SWA.toml"
|
||||||
|
)
|
||||||
|
|
||||||
target_compile_definitions(ShaderRecomp PRIVATE
|
target_compile_definitions(ShaderRecomp PRIVATE
|
||||||
SHADER_RECOMP_INPUT=\"${CMAKE_CURRENT_SOURCE_DIR}/private\"
|
SHADER_RECOMP_INPUT=\"${CMAKE_CURRENT_SOURCE_DIR}/private\"
|
||||||
SHADER_RECOMP_OUTPUT=\"${CMAKE_CURRENT_SOURCE_DIR}/shader/shader_cache.cpp\")
|
SHADER_RECOMP_OUTPUT=\"${CMAKE_CURRENT_SOURCE_DIR}/shader/shader_cache.cpp\"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/shader/shader_cache.cpp"
|
||||||
|
COMMAND ShaderRecomp
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/private/shader.ar"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(UnleashedRecompLib
|
||||||
|
${SWA_PPC_RECOMPILED_SOURCES}
|
||||||
|
"shader/shader_cache.h"
|
||||||
|
"shader/shader_cache.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(UnleashedRecompLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
target_precompile_headers(UnleashedRecompLib PUBLIC "ppc/ppc_recomp_shared.h")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue