Skip to content

build: add ANYPS5_USE_SYSTEM_DEPS option - #921

Merged
adriadam10 merged 5 commits into
boykopovar:mainfrom
011010:feat/cmake-use-system-deps
Oct 11, 2026
Merged

adriadam10 merged 5 commits into
boykopovar:mainfrom
011010:feat/cmake-use-system-deps

Conversation

@011010

@011010 011010 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

What

Adds ANYPS5_USE_SYSTEM_DEPS, OFF by default (implements #400). With it ON, SDL2, freetype, Vulkan-Headers, SPIRV-Headers, glslang and SPIRV-Tools come from the system instead of the bundled submodules. The default build is unchanged: the option only wraps the existing add_subdirectory calls and skips the bundled shader-cache submodule stamps.

Design:

  • cmake/SystemDeps.cmake resolves each package with find_package(... CONFIG) (freetype through FindFreetype) and re-exposes them under the target names the rest of the build already uses: SDL2-static, freetype, glslang, SPIRV, glslang-standalone, SPIRV-Tools-opt, SPIRV-Tools-static. Because of that, no other CMake file changed except the two submodule stamps in core/shader/recompiler/CMakeLists.txt, which would otherwise depend on the missing bundled paths.
  • Every package is required. A missing one fails the configure (find_package(... REQUIRED)), and if glslang is found without the tools, or the headers are incomplete, the configure fails with a named error. Nothing falls back to the submodule, as you asked.
  • The system glslang splits the headers (<prefix>/include/glslang/Public/... and <prefix>/include/glslang/SPIRV/GlslangToSpv.h), unlike the bundled single root; the helper adds both.
  • Vulkan-Headers must provide VK_KHR_maintenance8, which the agc driver uses. The helper checks it at configure with check_cxx_source_compiles on VkPhysicalDeviceMaintenance8FeaturesKHR and fails with a clear message when the headers are older. Ubuntu 24.04 (headers 1.4.304) fails there; Ubuntu 25.10 (1.4.321) passes.
  • SDL2 is linked from the system as a shared library (SDL2::SDL2). The prx libraries are shared objects and distribution static SDL2 is built without PIC, so libSDL2.a cannot be linked into them (relocation R_X86_64_PC32 ... can not be used when making a shared object). The default build keeps its own static SDL2. The other five packages link fine from the system.
  • ffmpeg-core (carries ffmpeg.patch), libjpeg-turbo, stb, VulkanMemoryAllocator and LibAtrac9 always stay bundled and still need git submodule update --init.

On your Linux-only vs Windows question: the interface is platform-neutral, but I only exercised the Linux packages, so I would call the Windows side untested rather than claim it. If you prefer to scope it to Linux for now, that is a small change to the helper.

Tested

Ubuntu 25.10 and 24.04 in linux/amd64 containers (the host is arm64; Docker Desktop runs the containers through Rosetta). Packages: libsdl2-dev libfreetype-dev libvulkan-dev spirv-headers glslang-dev glslang-tools spirv-tools, GCC 15, Ninja, x86-64 as the project requires.

  • -DANYPS5_USE_SYSTEM_DEPS=ON: configure OK and cmake --build . --target libs builds.
  • -DANYPS5_USE_SYSTEM_DEPS=ON -DBUILD_TESTING=ON: configure OK; pad_sdl_tests builds (the executables keep -static-libgcc -static-libstdc++ and link the shared system SDL2).
  • Ubuntu 24.04 (Vulkan-Headers 1.4.304): configure fails with the VK_KHR_maintenance8 message, at configure time.
  • Missing package (-DCMAKE_DISABLE_FIND_PACKAGE_glslang=ON, and separately SDL2 and SPIRV-Tools-opt): configure fails with a named error each time.
  • Default (flag OFF): still reaches add_subdirectory(3rdparty/SDL2) and add_subdirectory(3rdparty/freetype).
  • The relinker and the rest of the tree are untouched; both paths use the same target names.

Not tested: Windows, and no PS5 title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

@011010

011010 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

The overlap with #674 is textual, not a dependency. #674 flips SDL_RENDER to ON for its ImGui input editor; this PR only guards the add_subdirectory calls of the bundled libraries. I moved the guard so it no longer wraps the SDL cache block, so the changed lines do not overlap #674's any more. There is no Depends on.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the scope matches what was agreed in #400 and the default build is unchanged (merged onto current main, full ctest green here). Three things before it can go in:

  • Bundled headers are still on the include path. Many targets keep hard-coded submodule include dirs, e.g. core/libs/prx/libSceAgcDriver/CMakeLists.txt:179-180,292,306,378,455-456,480,493-494,510,599-600,660 (3rdparty/Vulkan-Headers/include, 3rdparty/SPIRV-Headers/include), core/shader/recompiler/CMakeLists.txt:154-155 (3rdparty/SPIRV-Headers/include, 3rdparty/glslang), and 3rdparty/SDL2/include in libSceAudioOut, libSceAudioIn, libSceVideoOut, libScePad, libSceMouse and libSceKeyboard. The submodules are still checked out for ffmpeg-core/libjpeg-turbo/stb/VMA/LibAtrac9, so those dirs exist, and -I is searched before the include_directories(SYSTEM ...) you add. The ON build therefore compiles against the bundled Vulkan/SPIRV/SDL2/glslang headers and links the system libraries. The VK_KHR_maintenance8 check tests headers that are not the ones used, and a system SDL2/glslang older or newer than the submodule is an ABI mismatch nobody sees. That is a partial fallback to the submodules, which #400 asked to avoid. Suggested direction: route those paths through one variable or target per package (e.g. link Vulkan::Headers/SPIRV-Headers::SPIRV-Headers, or set ANYPS5_*_INCLUDE_DIR in one place to either the submodule or the system path). Then a build with those submodules deinitialised can prove nothing reads them.
  • Shader cache key (core/shader/recompiler/CMakeLists.txt:185-203): with the flag ON, the submodules section of the manifest is empty and there are no stamps, so upgrading the system glslang/SPIRV-Headers/SPIRV-Tools leaves the cache version unchanged and old cached shaders get reused. Adding the found package versions (glslang_VERSION, SPIRV-Headers_VERSION, SPIRV-Tools-opt_VERSION, Vulkan-Headers) to shaderCacheExtra when the flag is ON would cover it.
  • cmake/SystemDeps.cmake:1-8,15-16,57-59: CONTRIBUTING allows no code comments except technical debt. The rationale already lives in docs/dev/BUILD.md, so those comments can go.

@011010

011010 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and applied all three points.

  • Include routing. cmake/SystemDeps.cmake now defines ANYPS5_VULKAN_HEADERS_INCLUDE_DIR, ANYPS5_SPIRV_HEADERS_INCLUDE_DIR, ANYPS5_SDL2_INCLUDE_DIR and ANYPS5_GLSLANG_INCLUDE_DIRS: the submodule directories by default, and with ANYPS5_USE_SYSTEM_DEPS=ON the INTERFACE_INCLUDE_DIRECTORIES of Vulkan::Headers, SPIRV-Headers::SPIRV-Headers, SDL2::SDL2 and the glslang public/SPIRV roots, with a fatal error when a package exposes none. Every hard-coded 3rdparty/Vulkan-Headers/include, 3rdparty/SPIRV-Headers/include, 3rdparty/SDL2/include and 3rdparty/glslang include dir is replaced by the variables (libSceAgcDriver, libSceVideoOut, libSceAudioOut, libSceAudioIn, libScePad, libSceMouse, libSceKeyboard, shader recompiler), and the include_directories(SYSTEM ...) block is gone, so a build with the flag ON compiles against the headers of the package it links. The maintenance8 check tests the routed directory, the same one the targets use. References that stay with the bundled packages (stb, VulkanMemoryAllocator, ffmpeg-core, libjpeg-turbo, LibAtrac9) are unchanged.
  • Shader cache key. With the flag ON, shaderCacheExtra carries system-deps=VulkanHeaders=<ver> SPIRV-Headers=<ver> glslang=<ver>, and SPIRV-Tools-opt=<ver> when ANYPS5_ENABLE_SPIRV_TOOLS is on, taken from the found config packages' *_VERSION, unknown when a package does not expose one. Upgrading the system glslang or SPIRV-Headers now invalidates the cached shaders.
  • Comments. Removed from cmake/SystemDeps.cmake; the rationale is in docs/dev/BUILD.md.

Tested (Linux container, gcc 13, cmake 4, x86-64):

  • Default configure is unchanged.
  • ANYPS5_USE_SYSTEM_DEPS=ON configure succeeds with Vulkan-Headers and SPIRV-Headers installed under /usr/local from this repository's own submodules (real CMake config packages, 1.4.335, the maintenance8 check passes) plus system libsdl2-dev, libfreetype-dev, glslang-dev/glslang-tools.
  • cmake --build --target agc_driver_wave_uniform_tests with the flag ON completes (298 steps, links libSceAgcDriver.prx), and ldd of the test binary resolves libSDL2-2.0.so.0 from the system.
  • Nothing reads the bundled headers: compile_commands.json under ON has zero 3rdparty/Vulkan-Headers, 3rdparty/SPIRV-Headers, 3rdparty/glslang and 3rdparty/SDL2 include references (OFF: 413/378/434/590 of 1511 entries; ON: 0 of 1209), and build.ninja under ON repeats the same.

Not tested on Windows (no supported MinGW-w64 toolchain here). AI-assisted: yes.

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, all three earlier points are addressed. The default build is unchanged: merged onto current main, full ctest is green here (400/400). Tried -DANYPS5_USE_SYSTEM_DEPS=ON -DBUILD_TESTING=ON on Arch (sdl2-compat 2.32.72, freetype 2.14.3, glslang/SPIRV-Tools 1.4.357, Vulkan-Headers 1.4.335). It configures, and all + libs build, but:

  • ctest is red with the system SDL2 (2 of 400). Arch and Fedora now ship SDL2 as sdl2-compat (SDL3 underneath):

    • pad_sdl fails: its SDL_config.h doesn't define SDL_JOYSTICK_HIDAPI (core/libs/prx/libSceVideoOut/tests/PadSdl.cpp:6).
    • audio_out_mix_level_pad_spk aborts: the disk driver opens the output as channels=2, and with the bundled SDL2 the same test passes.

    Either reject sdl2-compat at configure time with a named error, like the VK_KHR_maintenance8 check, or make both tests pass with it.

  • ANYPS5_ENABLE_SPIRV_TOOLS=ON doesn't configure on Arch (cmake/SystemDeps.cmake:80). SPIRV-Tools only exports SPIRV-Tools-static when it is built with SPIRV_TOOLS_BUILD_STATIC=ON (source/CMakeLists.txt); otherwise there is only SPIRV-Tools (shared on Arch) plus SPIRV-Tools-shared. Falling back to SPIRV-Tools when SPIRV-Tools-static is missing would cover both layouts.

  • docs/dev/BUILD.md:48 says the forced SDL/FreeType settings can't be overridden. With ON they don't apply at all: the system SDL2 comes with whatever its distro enabled (e.g. HIDAPI). Worth one sentence next to the new paragraph.

FYI, #1048 touches the line next to yours in core/libs/prx/libSceVideoOut/CMakeLists.txt:30, so whichever PR lands second needs a trivial rebase.

@011010

011010 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Second round applied; rebased on current main.

  • SDL2 without HIDAPI. ANYPS5_USE_SYSTEM_DEPS=ON now runs the same kind of compile check as the maintenance8 one: the system SDL2's SDL_config.h must define SDL_JOYSTICK_HIDAPI, and the configure fails with a named error otherwise. sdl2-compat ships no such macro (its headers only carry SDL_JOYSTICK_LINUX), so it is rejected here, which also covers the disk-audio failure. On Ubuntu 24.04 with the distribution SDL2 2.30.0 (its SDL_config.h is an indirection to _real_SDL_config.h, which defines the macro) the ON configure, pad_sdl and audio_out_mix_level_pad_spk are all green; a stub SDL2 whose header carries no HIDAPI define is rejected with the new error. The default build is unchanged.
  • SPIRV-Tools. When ANYPS5_ENABLE_SPIRV_TOOLS=ON and the config package provides SPIRV-Tools-opt but not SPIRV-Tools-static, a SPIRV-Tools-static INTERFACE target is aliased to SPIRV-Tools, so a shared Arch-style build configures. Verified with a stub SPIRV-Tools-optConfig.cmake that defines SPIRV-Tools only; the real Arch environment is yours to confirm.
  • BUILD.md. The paragraph now says the forced SDL and FreeType settings do not apply under ON and why HIDAPI is required.

#1048 touches the line next to ours in libSceVideoOut/CMakeLists.txt; whichever lands second rebases, and the conflict is that one line. AI-assisted: yes.

@011010
011010 force-pushed the feat/cmake-use-system-deps branch from 260c83f to a70bc5c Compare October 8, 2026 15:52
@011010

011010 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Conventions job fixed; rebased on current main.

  • Comments. The SDL2 probe was a multi-line CMake string, and the check reads the diff one line at a time, so its #ifndef / #error / #endif lines were reported. It is a single-line string with \n escapes now, like the maintenance8 check.
  • System dependencies. The check rejects find_package for third-party code, but (Build system improvement) Add optional CMake feature flag to prefer/search Linux system dependencies instead of bundled #400 settled that ANYPS5_USE_SYSTEM_DEPS=ON resolves SDL2, freetype, Vulkan-Headers, SPIRV-Headers, glslang and SPIRV-Tools with find_package/pkg-config. I kept the rule and narrowed it for that opt-in: tools/check_conventions.py skips cmake/SystemDeps.cmake, the single file that resolves them, and CONTRIBUTING.md says so. Everything else is still rejected; say the word if you would rather carry that change another way.
  • New main. The rebase brought two 3rdparty/Vulkan-Headers/include includes that landed while this was open (agc_subgroup_clock_tests, agc_recorder_kept_bytes_tests); they go through ANYPS5_VULKAN_HEADERS_INCLUDE_DIR too, and no hard-coded package include is left.

Verified: tools/check_conventions.py reports no findings for this branch; with ANYPS5_USE_SYSTEM_DEPS=ON the configure passes and pad_sdl and audio_out_mix_level_pad_spk are green (Ubuntu SDL2 2.30.0), a header without SDL_JOYSTICK_HIDAPI is rejected with the named error, and the default configure is unchanged with pad_sdl green. AI-assisted: yes.

@011010
011010 requested a review from adriadam10 October 8, 2026 16:08
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed labels Oct 8, 2026
@StarMrGamer

Copy link
Copy Markdown
Contributor

Confirming the point the earlier review left as "the real Arch environment is yours to confirm", on current Arch (CachyOS, x86-64), branch a70bc5c8, packages as installed today: spirv-tools 1:1.4.363.0-1.1, glslang 1:1.4.363.0-1.1, spirv-headers 1:1.4.363.0-1, vulkan-headers 1:1.4.363.0-1, freetype2 2.14.3-1.1, sdl2-compat 2.32.74-1.1.

The configure fails on Arch as designed, with the new message. cmake -S . -B build -DANYPS5_USE_SYSTEM_DEPS=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON, no submodules initialised:

-- Performing Test ANYPS5_SDL2_HAS_HIDAPI
-- Performing Test ANYPS5_SDL2_HAS_HIDAPI - Failed
CMake Error at cmake/SystemDeps.cmake:31 (message):
  ANYPS5_USE_SYSTEM_DEPS: the system SDL2 does not define
  SDL_JOYSTICK_HIDAPI, ...
Call Stack (most recent call first):
  CMakeLists.txt:30 (include)

SDL_JOYSTICK_HIDAPI is not defined for Linux: /usr/include/SDL2/SDL_config.h only dispatches to SDL_config_unix.h, which does not define it (the macro appears in the windows/macos/android headers). The probe is right and nothing falls back.

Everything after the SDL2 probe passes on Arch. With a stub SDL2 package whose SDL_config.h defines SDL_JOYSTICK_HIDAPI (the same technique used for the SPIRV-Tools-opt stub earlier), the rest of SystemDeps.cmake runs unchanged and the configure stops only at the uninitialised bundled submodules:

-- Performing Test ANYPS5_SDL2_HAS_HIDAPI - Success
-- Found Freetype: /usr/lib/libfreetype.so (found version "2.14.3")
-- Performing Test ANYPS5_VULKAN_HAS_MAINTENANCE8
-- Performing Test ANYPS5_VULKAN_HAS_MAINTENANCE8 - Success
CMake Error at CMakeLists.txt:76 (add_subdirectory): 3rdparty/ffmpeg-core
CMake Error at .../ExternalProject: libjpeg-turbo

No SystemDeps.cmake error and no target-name warning anywhere in that log, so SPIRV-Headers, glslang, Freetype, VulkanHeaders (including the VK_KHR_maintenance8 probe) and SPIRV-Tools-opt all resolve, and ensure_agc_glslang() returns early on its three targets.

The glslang layout. Arch exports only namespaced targets — glslang::glslang, glslang::SPIRV, glslang::glslang-default-resource-limits — with no bare glslang/SPIRV and no glslang-standalone. A probe running exactly the three find_package calls in SystemDeps.cmake reports:

PROBE target glslang::glslang: PRESENT
PROBE target glslang::SPIRV: PRESENT
PROBE target glslang: missing
PROBE target glslang-standalone: missing
PROBE target SPIRV-Tools: PRESENT
PROBE target SPIRV-Tools-static: missing
PROBE target SPIRV-Tools-opt: PRESENT

The header checks hold (/usr/include/glslang/Public/ShaderLang.h, /usr/include/glslang/SPIRV/GlslangToSpv.h) and find_program(NAMES glslang glslangValidator) finds /usr/bin/glslang, so the imported glslang-standalone target is real.

The SPIRV-Tools fallback is the branch that is actually taken. Arch installs /usr/lib/cmake/SPIRV-Tools-opt/SPIRV-Tools-optConfig.cmake, and its first line is find_dependency(SPIRV-Tools), so find_package(SPIRV-Tools-opt CONFIG REQUIRED) defines the bare SPIRV-Tools target as a side effect. Arch defines no SPIRV-Tools-static target anywhere (grep -r "add_library(SPIRV-Tools-static" /usr/lib/cmake finds nothing), so if(NOT TARGET SPIRV-Tools-static) → if(TARGET SPIRV-Tools) is exactly the path taken. A find_package(SPIRV-Tools-static) would not have worked here: Arch ships no such config even though libSPIRV-Tools-opt.so is installed — keying off SPIRV-Tools-opt and its find_dependency chain is what makes Arch work.

One consequence worth a sentence in BUILD.md: Arch and Fedora ship sdl2-compat as their sdl2 package, so the HIDAPI probe means ANYPS5_USE_SYSTEM_DEPS=ON cannot be enabled at all on those distributions. The new paragraph says sdl2-compat is rejected but not that it makes the flag Debian/Ubuntu-only in practice. If that is the intended state, saying it explicitly saves the next Arch user the investigation.

Not tested: a complete configure and build (the bundled ffmpeg-core, libjpeg-turbo, stb, VulkanMemoryAllocator and LibAtrac9 submodules are not initialised in this checkout), and Windows.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this head against current upstream main (d70b8998). The existing Linux and Windows Build results are green for a70bc5c8, but git merge-tree upstream/main upstream/pr-921 reports content conflicts in CMakeLists.txt, core/libs/prx/libSceAgcDriver/CMakeLists.txt, and core/libs/prx/libSceVideoOut/CMakeLists.txt. CONTRIBUTING asks PR branches to stay current with main; please rebase/resolve those files and rerun the checks on the rebased head. The current green results do not cover that merge result.

@011010
011010 force-pushed the feat/cmake-use-system-deps branch from a70bc5c to a236308 Compare October 9, 2026 16:25
@011010

011010 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@MarcZX100 Rebased onto current main (d70b8998) and resolved the three conflicts you listed. Head is now a236308a; git merge-tree against main is clean and the checks re-ran on it.

  • CMakeLists.txt: kept main's new APS5_ENABLE_TIMING_LOG description and added the ANYPS5_USE_SYSTEM_DEPS option.
  • libSceAgcDriver / libSceVideoOut: kept the core/shader/recompiler and Vulkan/SPIRV include dirs main had added and routed them through the ANYPS5_*_INCLUDE_DIR variables.
  • The rebase also surfaced main re-adding hard-coded bundled includes to agc_driver_tests, agc_shader_device_profile_tests and agc_shader_fusion_tests; those now go through the variables too, so the ON build still reads no bundled headers.

One note: the Conventions job now runs the trusted base script (0ab2a04d), so the system-dependency rule flags the find_package(...) calls in cmake/SystemDeps.cmake; the exemption has to land in main first. AI-assisted: yes.

@011010

011010 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@StarMrGamer Thanks for the Arch confirmation. The head moved to a236308a (rebased onto main d70b8998, conflicts resolved). Your sdl2-compat/HIDAPI reading stands: the probe rejects it by design, so ANYPS5_USE_SYSTEM_DEPS=ON is effectively Debian/Ubuntu-only for now. AI-assisted: yes.

@StarMrGamer

Copy link
Copy Markdown
Contributor

@011010 thanks — re-verified on the new head a236308a with the same method as before. cmake/SystemDeps.cmake is byte-identical between a70bc5c8 and a236308a (git diff --stat over that path is empty), so only the include routing moved:

  • Real Arch configure, -DANYPS5_USE_SYSTEM_DEPS=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON: still fails at cmake/SystemDeps.cmake:31 with the named HIDAPI error.
  • With the stub SDL2: ANYPS5_SDL2_HAS_HIDAPI Success, Found Freetype: /usr/lib/libfreetype.so (found version "2.14.3"), ANYPS5_VULKAN_HAS_MAINTENANCE8 Success, and the configure runs past SystemDeps.cmake to CMakeLists.txt:80 (the uninitialised ffmpeg-core submodule).

So glslang, SPIRV-Headers, Vulkan-Headers and the SPIRV-Tools-static → SPIRV-Tools alias all still resolve on Arch after your rebase, and the sdl2-compat rejection is unchanged.

Nothing further needed from me. For the record on the remaining blocker: I checked and there is no open pull request adding the check_conventions.py exemption for cmake/SystemDeps.cmake, so that still has to land in main before this can go green.

@011010

011010 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@StarMrGamer thanks for the re-verification. Opened #2373 against main with the check_conventions.py exemption for cmake/SystemDeps.cmake. Once it merges I'll rebase #921 and drop the now-redundant checker copy.

@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 9, 2026

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. Before this can go in:

  • Conflicts with main. CMakeLists.txt conflicts, and main has added more hard-coded bundled include dirs since the last rebase (e.g. core/libs/prx/libSceAgcDriver/CMakeLists.txt, agc_buffer_pool_tests and the other 3rdparty/Vulkan-Headers/include / 3rdparty/SPIRV-Headers/include / 3rdparty/SDL2/include entries). Please rebase and route every remaining one through the ANYPS5_*_INCLUDE_DIR variables (git grep '3rdparty/\(Vulkan-Headers\|SPIRV-Headers\|SDL2/include\|glslang\)' -- '*CMakeLists.txt' should only match cmake/SystemDeps.cmake and the default-path add_subdirectory calls).
  • Conventions job is red. The tools/check_conventions.py exemption is also in #2373. Keep it in only one of the two: once #2373 is merged, rebase and drop the hunk here.
  • After the rebase, rerun the ANYPS5_USE_SYSTEM_DEPS=ON configure plus libs build to confirm nothing else slipped past.

The approach itself matches what was agreed in #400.

@011010
011010 force-pushed the feat/cmake-use-system-deps branch from a236308 to 6dadeb3 Compare October 9, 2026 23:39
@011010

011010 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@adriadam10 pushed the rebase onto current main (6dadeb38). The CMakeLists.txt conflict was main's new ftver.rc freetype filter; it now sits inside the if(NOT ANYPS5_USE_SYSTEM_DEPS) guard.

Routing: the only remaining hard-coded include was agc_buffer_pool_tests; the two set() literals in the recompiler (SPIRV-Headers_SOURCE_DIR, shaderCacheSubmodules) moved into ANYPS5_*_SOURCE_DIR defaults in cmake/SystemDeps.cmake. The grep now matches only the default-path add_subdirectory calls.

Reran -DANYPS5_USE_SYSTEM_DEPS=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON on Ubuntu 24.04: configure passes (ANYPS5_SDL2_HAS_HIDAPI and ANYPS5_VULKAN_HAS_MAINTENANCE8 both success) and libs builds 820/820. compile_commands.json has no 3rdparty/{Vulkan-Headers,SPIRV-Headers,SDL2/include,glslang} include; it uses /usr/include/{SDL2,glslang,freetype2}.

The tools/check_conventions.py exemption stays in #2373; I'll drop the hunk here and rebase once it merges. Conventions stays red until then.

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked on current main: the default build (flag OFF) configures and builds, and the full ctest passes (565/565). All the include-routing and rebase points from the earlier reviews are addressed, and the two remaining glslang add_subdirectory calls are guarded by if(TARGET glslang).

Two things before this can land:

Not verified on our side: the ANYPS5_USE_SYSTEM_DEPS=ON path (Arch's sdl2-compat is rejected by design) and Windows; StarMrGamer's Arch run covers the rejection message.

@011010

011010 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@adriadam10 thanks. On the duplicate: I'll land #2373 first, then rebase #921 and drop the hunk here, so the exemption lives only in #2373.

On the ANYPS5_USE_SYSTEM_DEPS=ON path you flagged as unverified on your side: I ran it in an Ubuntu 24.04 container with system SDL2 2.30.0 (HIDAPI), freetype 2.13.2, glslang 15.1.0, Vulkan-Headers, SPIRV-Headers and SPIRV-Tools. Configure passes (ANYPS5_SDL2_HAS_HIDAPI and ANYPS5_VULKAN_HAS_MAINTENANCE8 both success) and libs builds 820/820. compile_commands.json has no 3rdparty/{Vulkan-Headers,SPIRV-Headers,SDL2/include,glslang} include and uses /usr/include/{SDL2,glslang,freetype2}, so the ON build reads only system headers. Windows is still untested.

@boykopovar on the rule change: the opt-in is off by default (the default build never reads the system), the resolution is confined to cmake/SystemDeps.cmake, and the CONTRIBUTING paragraph documents the exception next to the rule it relaxes. Happy to reword it if you prefer.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 10, 2026
@github-actions github-actions Bot mentioned this pull request Oct 10, 2026
9 tasks done
@011010
011010 force-pushed the feat/cmake-use-system-deps branch from 6dadeb3 to f99c761 Compare October 10, 2026 04:41
@011010

011010 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (c72d5ce1) and dropped the duplicated tools/check_conventions.py hunk; the exemption now lives only in #2373, as requested. CONTRIBUTING.md keeps the wording here because it documents the flag this PR adds. Head is f99c761e.

The ANYPS5_USE_SYSTEM_DEPS=ON configure + libs build was not re-run after this rebase (it only replayed already-reviewed commits onto main); Windows is still untested.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 10, 2026
@Mouhand-Kaddo

Copy link
Copy Markdown
Contributor

Additional platform validation on standalone PR head f99c761e50ec79908591cf8aca988d1a9518d6b4:

Windows: passed — Windows 11, supported WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja.

Release / BUILD_TESTING=ON: built the selected test targets; 1 CTest cases, 0 failures, 0 CTest skips.

Tests: pad_sdl.

Reproduce after building the test targets: ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^pad_sdl$".

Default bundled-dependency mode passed. ANYPS5_USE_SYSTEM_DEPS=ON also passed with separately installed real packages built from the pinned dependency sources: 4/4 tests (pad_sdl, audio_out_mix_level_pad_spk, agc_shader_device_profile, agc_driver_graphics), zero skips. Checked project compile commands use installed dependency headers. Missing SDL2 is rejected cleanly at configure time.

Integration limitation: a local merge against main 948a526c2 has source conflicts; these results validate the standalone PR head, not a resolved merge.

011010 and others added 5 commits October 11, 2026 10:18
Resolve SDL2, freetype, Vulkan-Headers, SPIRV-Headers, glslang and
SPIRV-Tools from the system instead of the bundled submodules when the
option is ON. It is OFF by default, so the bundled build is unchanged.

Every package is required: a missing one, or Vulkan-Headers older than
1.4.310 (the agc driver uses VK_KHR_maintenance8), fails the configure
with an error and nothing falls back to the submodule. The system
packages are exposed under the same target names the bundled path uses,
so the rest of the CMake is untouched.

SDL2 is linked from the system as a shared library because the prx
libraries are shared objects and distribution static SDL2 is usually not
PIC. ffmpeg-core, libjpeg-turbo, stb, VulkanMemoryAllocator and LibAtrac9
stay bundled.
A system SDL2 that does not define SDL_JOYSTICK_HIDAPI (sdl2-compat over
SDL3 ships no such macro, and neither does a build with the driver
disabled) fails pad_sdl and makes the disk audio driver open the port
with a different channel count, so ANYPS5_USE_SYSTEM_DEPS=ON now rejects
it with a named error, like the VK_KHR_maintenance8 check. Ubuntu's real
SDL2 defines the macro through its SDL_config.h indirection and is
unaffected.

SPIRV-Tools only exports SPIRV-Tools-static when built with
SPIRV_TOOLS_BUILD_STATIC=ON; distributions that ship it shared expose
SPIRV-Tools instead, so a shared target is aliased to the static name.
…se through ANYPS5_VULKAN_HEADERS_INCLUDE_DIR

Co-Authored-By: Claude <noreply@anthropic.com>
@adriadam10
adriadam10 force-pushed the feat/cmake-use-system-deps branch from f99c761 to abcfa7c Compare October 11, 2026 08:26

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased onto current main (it conflicted in docs/dev/BUILD.md and libSceAgcDriver/CMakeLists.txt) and added one commit:

  • Routed the four 3rdparty/Vulkan-Headers/include entries that main added to AgcDriver tests since the last rebase through ANYPS5_VULKAN_HEADERS_INCLUDE_DIR.

Checked on the rebased head: default build (flag OFF) configures, builds, full ctest passes (795/795); git grep for hard-coded bundled include dirs only matches cmake/SystemDeps.cmake and the default-path glslang add_subdirectory calls. The ANYPS5_USE_SYSTEM_DEPS=ON path relies on the Ubuntu 24.04 and Windows runs above (this host's SDL2 is sdl2-compat, which the check rejects by design).

The conventions job is red only because the exemption lives in #2373; merging after it.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 11, 2026
@adriadam10
adriadam10 merged commit 04ab4a8 into boykopovar:main Oct 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants