Files
ARMSX2/CMakePresets.json
Brian Degenhardt 47fa49f3d2 Build: add source-based coverage for the ARM64 recompilers
USE_COVERAGE instruments the build with clang's -fprofile-instr-generate
-fcoverage-mapping, exposed as the clang-coverage preset (build-coverage/,
inheriting clang-devel so the dev asserts stay on, Qt off since nothing in
the test path needs it).

The instrumentation is tree-wide rather than scoped to pcsx2/arm64: much of
the JIT is inline code living in headers that get pulled into core and common
translation units, so narrowing at build time would drop counters for exactly
the code we care about. tools/coverage.sh narrows at report time instead,
where the filter is exact.

The script builds the five gtest binaries, runs them with per-process profile
files, merges, and reports scoped to pcsx2/arm64/ (--scope all widens to the
other ARM64-only sources). Two hazards it defends against:

  - cmake --preset takes the source dir from the working directory and ignores
    -S, so running this through the /home/bmd/ARMSX2 symlink bakes the
    symlinked path into every coverage mapping. It cds first.
  - llvm-cov does not error when --sources matches nothing; it reports every
    file it has data for, which reads as a plausible whole-tree number. The
    filter prefix is read back from CMAKE_HOME_DIRECTORY so it always matches
    what the compiler recorded, and a row-count tripwire fails the run if the
    report escapes its scope anyway.

Baseline for pcsx2/arm64/: 74.65% lines, 79.94% functions, 77.70% regions.
2026-07-28 15:24:36 -07:00

103 lines
4.1 KiB
JSON

{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"patch": 0
},
"configurePresets": [
{
"name": "clang-base",
"displayName": "Base",
"description": "Base preset for Clang. Only for inheriting from.",
"hidden": true,
"binaryDir": "${sourceDir}/build",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_EXE_LINKER_FLAGS_INIT": "-fuse-ld=lld",
"CMAKE_MODULE_LINKER_FLAGS_INIT": "-fuse-ld=lld",
"CMAKE_SHARED_LINKER_FLAGS_INIT": "-fuse-ld=lld",
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "ninja-multi",
"displayName": "Ninja Multi Config",
"description": "Generate multiple ninja build files.",
"inherits": "clang-base",
"generator": "Ninja Multi-Config"
},
{
"name": "clang-debug",
"displayName": "Clang Debug",
"description": "Debug build using ninja and clang.",
"inherits": "clang-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "clang-devel",
"displayName": "Clang Devel",
"description": "Developer build using ninja & clang.",
"inherits": "clang-base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Devel"
}
},
{
"name": "clang-release",
"displayName": "Clang Release",
"description": "Release lto build using ninja & clang.",
"inherits": "clang-base",
"cacheVariables": {
"CMAKE_INTERPROCEDURAL_OPTIMIZATION": "ON",
"CMAKE_BUILD_TYPE": "Release",
"ENABLE_RECOMPILER_TEST_HOOKS": "OFF"
}
},
{
"name": "clang-perf",
"displayName": "Clang Devel + perf jitdump",
"description": "Devel build with USE_PERF_JITDUMP=ON; emits /tmp/pcsx2-perf-<pid>/jit-<pid>.dump for `perf inject --jit`.",
"inherits": "clang-devel",
"binaryDir": "${sourceDir}/build-perf",
"cacheVariables": {
"USE_PERF_JITDUMP": "ON"
}
},
{
"name": "clang-coverage",
"displayName": "Clang Devel + source-based coverage",
"description": "Devel build instrumented with -fprofile-instr-generate -fcoverage-mapping, into build-coverage/. Drive it with tools/coverage.sh, which runs the gtest binaries and reports line/region coverage scoped to pcsx2/arm64/.",
"inherits": "clang-devel",
"binaryDir": "${sourceDir}/build-coverage",
"cacheVariables": {
"USE_COVERAGE": "ON",
"ENABLE_TESTS": "ON",
"ENABLE_RECOMPILER_TEST_HOOKS": "ON",
"ENABLE_QT_UI": "OFF"
}
},
{
"name": "clang-handheld",
"displayName": "Clang Handheld (SDL3 / kmsdrm)",
"description": "RelWithDebInfo build of the SDL3 frontend for handhelds. No Qt. Primary display path is VK_KHR_display (VulkanDirect, kmsdrm); WAYLAND_API is on so the SDL frontend can fall back to a Wayland Vulkan surface when launched inside a compositor. Requires ECM + Wayland-Egl dev headers on the build host — pure kmsdrm targets without them can build VulkanDirect-only by overriding -DWAYLAND_API=OFF.",
"inherits": "clang-base",
"binaryDir": "${sourceDir}/build-handheld",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"ENABLE_QT_UI": "OFF",
"ENABLE_GSRUNNER": "ON",
"ENABLE_SDL_FRONTEND": "ON",
"ENABLE_TESTS": "OFF",
"ENABLE_RECOMPILER_TEST_HOOKS": "OFF",
"USE_BACKTRACE": "OFF",
"X11_API": "OFF",
"WAYLAND_API": "ON"
}
}
]
}