[Build] Enable test discovery in VS Test Explorer

This commit is contained in:
Herman S.
2026-03-05 16:18:23 +09:00
parent 16d2cc05c5
commit 086decfa6e
5 changed files with 10 additions and 1 deletions

View File

@@ -10,6 +10,11 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
option(XENIA_BUILD_TESTS "Build test suites" OFF)
option(XENIA_BUILD_MISC "Build misc subprojects (trace viewers, shader compiler, vfs-dump, demos)" OFF)
if(XENIA_BUILD_TESTS)
enable_testing()
include(${PROJECT_SOURCE_DIR}/third_party/catch/contrib/Catch.cmake)
endif()
# Multi-config generators (VS, Ninja Multi-Config)
get_property(_is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_is_multi_config)

View File

@@ -247,4 +247,6 @@ function(xe_test_suite name base_path)
# Disable Edit and Continue - breaks Catch2 __LINE__ usage
target_compile_options(${name} PRIVATE /Zi)
endif()
catch_discover_tests(${name})
endfunction()

View File

@@ -35,3 +35,4 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
endif()
xe_target_defaults(xenia-cpu-ppc-tests)
add_test(NAME xenia-cpu-ppc-tests COMMAND xenia-cpu-ppc-tests)

View File

@@ -3,5 +3,5 @@ xe_test_suite(xenia-cpu-tests ${CMAKE_CURRENT_SOURCE_DIR}
capstone fmt imgui
xenia-base xenia-core xenia-cpu xenia-gpu
xenia-hid-skylander xenia-kernel xenia-ui xenia-patcher
$<$<STREQUAL:${CMAKE_SYSTEM_PROCESSOR},x86_64>:xenia-cpu-backend-x64>
$<$<OR:$<STREQUAL:${CMAKE_SYSTEM_PROCESSOR},x86_64>,$<STREQUAL:${CMAKE_SYSTEM_PROCESSOR},AMD64>>:xenia-cpu-backend-x64>
)

View File

@@ -1805,6 +1805,7 @@ class DevenvCommand(Command):
"-B", vs_build_dir,
"-G", "Visual Studio 17 2022",
"-A", "x64",
"-DXENIA_BUILD_TESTS=ON",
])
sln_path = os.path.join(vs_build_dir, "xenia.sln")
print(f"Opening {sln_path} in Visual Studio...")