mirror of
https://github.com/Mr-Wiseguy/Zelda64Recomp.git
synced 2024-12-26 04:41:49 +01:00
Build and run N64Recomp in CMake
This commit is contained in:
parent
b31cf0a76b
commit
0a5a067ac0
3
.gitignore
vendored
3
.gitignore
vendored
@ -55,6 +55,5 @@ rt64.log
|
|||||||
|
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
||||||
# Recompiler Linux binary
|
# macOS
|
||||||
N64Recomp
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -19,3 +19,6 @@
|
|||||||
[submodule "lib/N64ModernRuntime"]
|
[submodule "lib/N64ModernRuntime"]
|
||||||
path = lib/N64ModernRuntime
|
path = lib/N64ModernRuntime
|
||||||
url = https://github.com/N64Recomp/N64ModernRuntime.git
|
url = https://github.com/N64Recomp/N64ModernRuntime.git
|
||||||
|
[submodule "lib/N64Recomp"]
|
||||||
|
path = lib/N64Recomp
|
||||||
|
url = https://github.com/N64Recomp/N64Recomp.git
|
||||||
|
@ -31,12 +31,31 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/lib/lunasvg)
|
|||||||
SET(ENABLE_SVG_PLUGIN ON CACHE BOOL "" FORCE)
|
SET(ENABLE_SVG_PLUGIN ON CACHE BOOL "" FORCE)
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/RmlUi)
|
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/RmlUi)
|
||||||
|
|
||||||
|
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/N64Recomp)
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime)
|
add_subdirectory(${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime)
|
||||||
|
|
||||||
target_include_directories(rt64 PRIVATE ${CMAKE_BINARY_DIR}/rt64/src)
|
target_include_directories(rt64 PRIVATE ${CMAKE_BINARY_DIR}/rt64/src)
|
||||||
|
|
||||||
|
# N64Recomp - Generate the necessary C files
|
||||||
|
configure_file(${CMAKE_SOURCE_DIR}/funcs.txt ${CMAKE_BINARY_DIR}/funcs.txt COPYONLY)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${CMAKE_BINARY_DIR}/funcs.txt
|
||||||
|
COMMAND N64Recomp us.rev1.toml
|
||||||
|
COMMAND RSPRecomp aspMain.us.rev1.toml
|
||||||
|
COMMAND RSPRecomp njpgdspMain.us.rev1.toml
|
||||||
|
DEPENDS N64Recomp RSPRecomp
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
COMMENT "Generating C source files"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(generate_c_sources
|
||||||
|
DEPENDS ${CMAKE_BINARY_DIR}/funcs.txt
|
||||||
|
)
|
||||||
|
|
||||||
# RecompiledFuncs - Library containing the primary recompiler output
|
# RecompiledFuncs - Library containing the primary recompiler output
|
||||||
add_library(RecompiledFuncs STATIC)
|
add_library(RecompiledFuncs STATIC)
|
||||||
|
add_dependencies(RecompiledFuncs generate_c_sources)
|
||||||
|
|
||||||
target_compile_options(RecompiledFuncs PRIVATE
|
target_compile_options(RecompiledFuncs PRIVATE
|
||||||
# -Wno-unused-but-set-variable
|
# -Wno-unused-but-set-variable
|
||||||
@ -51,7 +70,23 @@ target_include_directories(RecompiledFuncs PRIVATE
|
|||||||
${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime/librecomp/include
|
${CMAKE_SOURCE_DIR}/lib/N64ModernRuntime/librecomp/include
|
||||||
)
|
)
|
||||||
|
|
||||||
file(GLOB FUNC_C_SOURCES ${CMAKE_SOURCE_DIR}/RecompiledFuncs/*.c)
|
file(STRINGS ${CMAKE_BINARY_DIR}/funcs.txt FUNC_C_SOURCES)
|
||||||
|
list(TRANSFORM FUNC_C_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/RecompiledFuncs/")
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${FUNC_C_SOURCES}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E echo "Generating source files from funcs.txt"
|
||||||
|
DEPENDS ${CMAKE_BINARY_DIR}/funcs.txt
|
||||||
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
COMMENT "Processing funcs.txt to generate source files"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(process_generated_sources
|
||||||
|
DEPENDS ${FUNC_C_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_dependencies(RecompiledFuncs process_generated_sources)
|
||||||
|
|
||||||
file(GLOB FUNC_CXX_SOURCES ${CMAKE_SOURCE_DIR}/RecompiledFuncs/*.cpp)
|
file(GLOB FUNC_CXX_SOURCES ${CMAKE_SOURCE_DIR}/RecompiledFuncs/*.cpp)
|
||||||
|
|
||||||
target_sources(RecompiledFuncs PRIVATE ${FUNC_C_SOURCES} ${FUNC_CXX_SOURCES})
|
target_sources(RecompiledFuncs PRIVATE ${FUNC_C_SOURCES} ${FUNC_CXX_SOURCES})
|
||||||
@ -98,9 +133,9 @@ add_custom_command(OUTPUT
|
|||||||
${CMAKE_SOURCE_DIR}/RecompiledPatches/recomp_overlays.inl
|
${CMAKE_SOURCE_DIR}/RecompiledPatches/recomp_overlays.inl
|
||||||
${CMAKE_SOURCE_DIR}/RecompiledPatches/funcs.h
|
${CMAKE_SOURCE_DIR}/RecompiledPatches/funcs.h
|
||||||
# TODO: Look into why modifying patches requires two builds to take
|
# TODO: Look into why modifying patches requires two builds to take
|
||||||
COMMAND ./N64Recomp patches.toml
|
COMMAND N64Recomp patches.toml
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/patches/patches.bin
|
DEPENDS N64Recomp ${CMAKE_SOURCE_DIR}/patches/patches.bin
|
||||||
)
|
)
|
||||||
|
|
||||||
# Main executable
|
# Main executable
|
||||||
|
1
lib/N64Recomp
Submodule
1
lib/N64Recomp
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit fb7f4d0c0a90197360f3f6a6fbc9b81e7da2b216
|
Loading…
Reference in New Issue
Block a user