Compare commits

...

3 commits

Author SHA1 Message Date
dcvz ef2e471667 Only one project define 2024-05-14 17:18:27 +02:00
dcvz 0325461afb Be more explicit with the cplusplus path 2024-05-14 15:17:46 +02:00
dcvz 42a7718f71 Simplify CMake + add a few more building instructions 2024-05-14 15:12:00 +02:00
2 changed files with 22 additions and 53 deletions

View file

@ -1,3 +1,4 @@
project(N64Recomp)
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
set(CMAKE_C_STANDARD 17) set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
@ -9,55 +10,19 @@ set(CMAKE_CXX_EXTENSIONS OFF)
add_subdirectory(lib/fmt) add_subdirectory(lib/fmt)
# Rabbitizer # Rabbitizer
project(rabbitizer) file(GLOB_RECURSE RABBITIZER_SOURCES
add_library(rabbitizer STATIC) "${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/*.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/*.c"
)
target_sources(rabbitizer PRIVATE add_library(rabbitizer STATIC ${RABBITIZER_SOURCES})
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/src/analysis/LoPairingInfo.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/src/analysis/RegistersTracker.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/src/instructions/InstrId.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/src/instructions/InstrIdType.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/src/instructions/InstructionBase.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/src/instructions/InstructionCpu.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/src/instructions/InstructionR3000GTE.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/src/instructions/InstructionR5900.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/src/instructions/InstructionRsp.cpp"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/analysis/RabbitizerLoPairingInfo.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/analysis/RabbitizerRegistersTracker.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/analysis/RabbitizerTrackedRegisterState.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/common/RabbitizerConfig.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/common/RabbitizerVersion.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/common/Utils.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstrCategory.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstrDescriptor.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstrId.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstrIdType.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstrSuffix.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionCpu/RabbitizerInstructionCpu_OperandType.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionR3000GTE/RabbitizerInstructionR3000GTE.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionR3000GTE/RabbitizerInstructionR3000GTE_OperandType.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionR3000GTE/RabbitizerInstructionR3000GTE_ProcessUniqueId.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionR5900/RabbitizerInstructionR5900.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionR5900/RabbitizerInstructionR5900_OperandType.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionR5900/RabbitizerInstructionR5900_ProcessUniqueId.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionRsp/RabbitizerInstructionRsp.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionRsp/RabbitizerInstructionRsp_OperandType.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstructionRsp/RabbitizerInstructionRsp_ProcessUniqueId.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstruction/RabbitizerInstruction.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstruction/RabbitizerInstruction_Disassemble.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstruction/RabbitizerInstruction_Examination.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstruction/RabbitizerInstruction_Operand.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerInstruction/RabbitizerInstruction_ProcessUniqueId.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerRegister.c"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/src/instructions/RabbitizerRegisterDescriptor.c")
target_include_directories(rabbitizer PRIVATE target_include_directories(rabbitizer PRIVATE "${CMAKE_SOURCE_DIR}/lib/rabbitizer/tables")
target_include_directories(rabbitizer PUBLIC
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/include" "${CMAKE_SOURCE_DIR}/lib/rabbitizer/include"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/include" "${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/include")
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/tables")
# N64 recompiler # N64 recompiler
project(N64Recomp)
add_executable(N64Recomp) add_executable(N64Recomp)
target_sources(N64Recomp PRIVATE target_sources(N64Recomp PRIVATE
@ -67,23 +32,16 @@ target_sources(N64Recomp PRIVATE
${CMAKE_SOURCE_DIR}/src/recompilation.cpp) ${CMAKE_SOURCE_DIR}/src/recompilation.cpp)
target_include_directories(N64Recomp PRIVATE target_include_directories(N64Recomp PRIVATE
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/include"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/include"
"${CMAKE_SOURCE_DIR}/lib/ELFIO" "${CMAKE_SOURCE_DIR}/lib/ELFIO"
"${CMAKE_SOURCE_DIR}/lib/fmt/include"
"${CMAKE_SOURCE_DIR}/lib/toml11" "${CMAKE_SOURCE_DIR}/lib/toml11"
"${CMAKE_SOURCE_DIR}/include") "${CMAKE_SOURCE_DIR}/include")
target_link_libraries(N64Recomp fmt rabbitizer) target_link_libraries(N64Recomp fmt rabbitizer)
# RSP recompiler # RSP recompiler
project(RSPRecomp)
add_executable(RSPRecomp) add_executable(RSPRecomp)
target_include_directories(RSPRecomp PRIVATE target_include_directories(RSPRecomp PRIVATE
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/include"
"${CMAKE_SOURCE_DIR}/lib/rabbitizer/cplusplus/include"
"${CMAKE_SOURCE_DIR}/lib/fmt/include"
"${CMAKE_SOURCE_DIR}/lib/toml11" "${CMAKE_SOURCE_DIR}/lib/toml11"
"${CMAKE_SOURCE_DIR}/include") "${CMAKE_SOURCE_DIR}/include")

View file

@ -50,7 +50,18 @@ RSP microcode can also be recompiled with this tool. Currently there is no suppo
* Ability to recompile into a dynamic language (such as Lua) to be able to load code at runtime for mod support * Ability to recompile into a dynamic language (such as Lua) to be able to load code at runtime for mod support
## Building ## Building
This project can be built with CMake 3.20 or above and a C++ compiler that supports C++20. This repo uses git submodules, so be sure to clone recursively (`git clone --recurse-submodules`) or initialize submodules recursively after cloning (`git submodule update --init --recursive`). From there, building is identical to any other cmake project, e.g. run `cmake` in the target build folder and point it at the root of this repo, then run `cmake --build .` from that target folder. This project can be built with CMake 3.20 or above and a C++ compiler that supports C++20. This repo uses git submodules, so be sure to clone recursively (`git clone --recurse-submodules`) or initialize submodules recursively after cloning (`git submodule update --init --recursive`).
From there, building is identical to any other cmake project, e.g. run `cmake` in the target build folder and point it at the root of this repo, then run `cmake --build .` from that target folder. You can also use different generators if you'd like to work in different IDE's like Xcode or Visual Studio by using the generator flag:
```bash
# generates into a folder called `build-cmake`
# open the generated Xcode project in that folder
cmake -H. -Bbuild-cmake -GXcode
# generates into a folder called `build-cmake`
# open the generated Visual Studio 2022 solution in that folder
cmake -S . -B "build-cmake" -G "Visual Studio 17 2022"
```
## Libraries Used ## Libraries Used
* [rabbitizer](https://github.com/Decompollaborate/rabbitizer) for instruction decoding/analysis * [rabbitizer](https://github.com/Decompollaborate/rabbitizer) for instruction decoding/analysis