mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-30 02:04:32 -04:00
ee149581aa
* feat: implement memory card IOP * feat: IOP trace * feat: move IOP logic to ps2xIOP refactor: small refactor on audio api on runtime
129 lines
3.6 KiB
CMake
129 lines
3.6 KiB
CMake
cmake_minimum_required(VERSION 3.21)
|
|
|
|
project(ps2xTest LANGUAGES C CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
if(PS2X_IOP_ENABLE_PLUGINS AND (WIN32 OR (UNIX AND NOT APPLE)))
|
|
add_library(ps2_iop_fake_plugin MODULE
|
|
src/fake_iop_plugin.cpp
|
|
)
|
|
add_library(ps2_iop_bad_abi_plugin MODULE
|
|
src/fake_iop_bad_abi.c
|
|
)
|
|
add_library(ps2_iop_missing_symbol_plugin MODULE
|
|
src/fake_iop_missing_symbol.cpp
|
|
)
|
|
|
|
foreach(plugin_target IN ITEMS
|
|
ps2_iop_fake_plugin
|
|
ps2_iop_bad_abi_plugin
|
|
ps2_iop_missing_symbol_plugin)
|
|
target_compile_features(${plugin_target} PRIVATE cxx_std_20)
|
|
target_include_directories(${plugin_target} PRIVATE
|
|
${CMAKE_SOURCE_DIR}/ps2xIOP/include
|
|
)
|
|
set_target_properties(${plugin_target} PROPERTIES
|
|
PREFIX ""
|
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/iop_test_plugins"
|
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/iop_test_plugins"
|
|
)
|
|
endforeach()
|
|
endif()
|
|
|
|
# Static library with test logic (no main), used by ps2xStudio
|
|
add_library(ps2_test_function_table OBJECT
|
|
src/test_function_table.cpp
|
|
)
|
|
|
|
target_include_directories(ps2_test_function_table PRIVATE
|
|
${CMAKE_SOURCE_DIR}/ps2xRuntime/include
|
|
${CMAKE_SOURCE_DIR}/ps2xIOP/include
|
|
)
|
|
|
|
add_library(ps2_test_lib STATIC
|
|
src/code_generator_tests.cpp
|
|
src/r5900_decoder_tests.cpp
|
|
src/elf_analyzer_tests.cpp
|
|
src/pad_input_tests.cpp
|
|
src/ps2_runtime_io_tests.cpp
|
|
src/ps2_runtime_kernel_tests.cpp
|
|
src/ps2_runtime_interrupt_tests.cpp
|
|
src/ps2_memory_tests.cpp
|
|
src/ps2_vu1_tests.cpp
|
|
src/ps2_gs_tests.cpp
|
|
src/ps2_iop_tests.cpp
|
|
src/ps2_sif_rpc_tests.cpp
|
|
src/ps2_sif_dma_tests.cpp
|
|
src/ps2_recompiler_tests.cpp
|
|
src/ps2_runtime_expansion_tests.cpp
|
|
)
|
|
|
|
target_include_directories(ps2_test_lib PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
${CMAKE_SOURCE_DIR}/ps2xRecomp/include
|
|
${CMAKE_SOURCE_DIR}/ps2xAnalyzer/include
|
|
${CMAKE_SOURCE_DIR}/ps2xRuntime/include
|
|
${CMAKE_SOURCE_DIR}/ps2xRuntime/src/lib
|
|
)
|
|
|
|
target_link_libraries(ps2_test_lib PRIVATE
|
|
ps2_recomp_lib
|
|
ps2_analyzer_lib
|
|
ps2_runtime
|
|
ps2_iop
|
|
)
|
|
|
|
if(UNIX AND NOT APPLE)
|
|
target_link_libraries(ps2_test_lib PRIVATE ${CMAKE_DL_LIBS})
|
|
endif()
|
|
|
|
if(TARGET ps2_iop_fake_plugin)
|
|
target_compile_definitions(ps2_test_lib PRIVATE
|
|
PS2X_TEST_IOP_PLUGIN_DIR="$<TARGET_FILE_DIR:ps2_iop_fake_plugin>"
|
|
)
|
|
add_dependencies(ps2_test_lib
|
|
ps2_iop_fake_plugin
|
|
ps2_iop_bad_abi_plugin
|
|
ps2_iop_missing_symbol_plugin
|
|
)
|
|
endif()
|
|
|
|
add_executable(ps2x_tests
|
|
src/main.cpp
|
|
$<TARGET_OBJECTS:ps2_test_function_table>
|
|
)
|
|
|
|
option(PRINT_GENERATED_CODE "Print generated code in tests" OFF)
|
|
if(PRINT_GENERATED_CODE)
|
|
|
|
target_compile_definitions(ps2x_tests PRIVATE PRINT_GENERATED_CODE)
|
|
target_compile_definitions(ps2_test_lib PRIVATE PRINT_GENERATED_CODE)
|
|
endif()
|
|
|
|
target_include_directories(ps2x_tests PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
${CMAKE_SOURCE_DIR}/ps2xRecomp/include
|
|
${CMAKE_SOURCE_DIR}/ps2xAnalyzer/include
|
|
${CMAKE_SOURCE_DIR}/ps2xRuntime/include
|
|
)
|
|
|
|
target_link_libraries(ps2x_tests PRIVATE
|
|
ps2_test_lib
|
|
ps2_recomp_lib
|
|
ps2_analyzer_lib
|
|
ps2_runtime
|
|
)
|
|
|
|
if(COMMAND ps2x_stage_ffmpeg_runtime_dlls)
|
|
ps2x_stage_ffmpeg_runtime_dlls(ps2x_tests)
|
|
endif()
|
|
|
|
include("${CMAKE_SOURCE_DIR}/ps2xRuntime/cmake/ReleaseMode.cmake")
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
|
EnableFastReleaseMode(ps2_test_lib)
|
|
EnableFastReleaseMode(ps2x_tests)
|
|
endif()
|