(Build system improvement) Add optional CMake feature flag to prefer/search Linux system dependencies instead of bundled #400

Closed
opened 2026-10-02 18:21:41 +00:00 by hardBSDk · 6 comments
hardBSDk commented 2026-10-02 18:21:41 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by hardBSDk on 2026-10-02T18:21:41Z.


No description provided.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5681570413 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/400). Originally posted by [hardBSDk](https://github.com/hardBSDk) on 2026-10-02T18:21:41Z. --- _No description provided._
arreina commented 2026-10-03 18:36:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by arreina on 2026-10-03T18:36:07Z.


I could take this on, but would like to check the scope first, since it touches the root CMake.

From the submodules, only some have usable system packages on common distributions:

  • SDL2, freetype, Vulkan-Headers, glslang and SPIRV-Tools are packaged (e.g. libsdl2-dev, libfreetype-dev, libvulkan-dev, glslang-dev, spirv-tools on Ubuntu).
  • ffmpeg-core carries ffmpeg.patch, so a system FFmpeg would not match it.
  • LibAtrac9 and stb are not packaged.

A single opt-in option (e.g. ANYPS5_USE_SYSTEM_DEPS, off by default) that switches the first group to find_package/pkg-config and keeps the rest bundled would leave the default build unchanged. The static-linking setup would also need a look, since system packages are shared libraries.

@boykopovar is that a direction you'd accept, or would you rather keep all dependencies bundled?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5972236129 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/400#issuecomment-5972236129). Originally posted by [arreina](https://github.com/arreina) on 2026-10-03T18:36:07Z. --- I could take this on, but would like to check the scope first, since it touches the root CMake. From the submodules, only some have usable system packages on common distributions: - SDL2, freetype, Vulkan-Headers, glslang and SPIRV-Tools are packaged (e.g. `libsdl2-dev`, `libfreetype-dev`, `libvulkan-dev`, `glslang-dev`, `spirv-tools` on Ubuntu). - ffmpeg-core carries `ffmpeg.patch`, so a system FFmpeg would not match it. - LibAtrac9 and stb are not packaged. A single opt-in option (e.g. `ANYPS5_USE_SYSTEM_DEPS`, off by default) that switches the first group to `find_package`/`pkg-config` and keeps the rest bundled would leave the default build unchanged. The static-linking setup would also need a look, since system packages are shared libraries. @boykopovar is that a direction you'd accept, or would you rather keep all dependencies bundled?
hardBSDk commented 2026-10-04 11:43:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by hardBSDk on 2026-10-04T11:43:16Z.


@arreina This hybrid approach is good.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5979571347 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/400#issuecomment-5979571347). Originally posted by [hardBSDk](https://github.com/hardBSDk) on 2026-10-04T11:43:16Z. --- @arreina This hybrid approach is good.
boykopovar commented 2026-10-06 05:07:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-06T05:07:54Z.


I could take this on, but would like to check the scope first, since it touches the root CMake.

From the submodules, only some have usable system packages on common distributions:

  • SDL2, freetype, Vulkan-Headers, glslang and SPIRV-Tools are packaged (e.g. libsdl2-dev, libfreetype-dev, libvulkan-dev, glslang-dev, spirv-tools on Ubuntu).
  • ffmpeg-core carries ffmpeg.patch, so a system FFmpeg would not match it.
  • LibAtrac9 and stb are not packaged.

A single opt-in option (e.g. ANYPS5_USE_SYSTEM_DEPS, off by default) that switches the first group to find_package/pkg-config and keeps the rest bundled would leave the default build unchanged. The static-linking setup would also need a look, since system packages are shared libraries.

@boykopovar is that a direction you'd accept, or would you rather keep all dependencies bundled?

Sorry for the long wait. I don't mind the ANYPS5_USE_SYSTEM_DEPS flag, which is disabled by default. If this flag is enabled and the package can't be found, I want it to fail with an error during the CMake reload or build process, not during runtime, and there should be no automatic switch to building from source. Are you planning on making this flag Linux-only, or can you make it work the same way on Windows?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6009745421 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/400#issuecomment-6009745421). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-06T05:07:54Z. --- > I could take this on, but would like to check the scope first, since it touches the root CMake. > > From the submodules, only some have usable system packages on common distributions: > > * SDL2, freetype, Vulkan-Headers, glslang and SPIRV-Tools are packaged (e.g. `libsdl2-dev`, `libfreetype-dev`, `libvulkan-dev`, `glslang-dev`, `spirv-tools` on Ubuntu). > * ffmpeg-core carries `ffmpeg.patch`, so a system FFmpeg would not match it. > * LibAtrac9 and stb are not packaged. > > A single opt-in option (e.g. `ANYPS5_USE_SYSTEM_DEPS`, off by default) that switches the first group to `find_package`/`pkg-config` and keeps the rest bundled would leave the default build unchanged. The static-linking setup would also need a look, since system packages are shared libraries. > > [@boykopovar](https://github.com/boykopovar) is that a direction you'd accept, or would you rather keep all dependencies bundled? Sorry for the long wait. I don't mind the ANYPS5_USE_SYSTEM_DEPS flag, which is disabled by default. If this flag is enabled and the package can't be found, I want it to fail with an error during the CMake reload or build process, not during runtime, and there should be no automatic switch to building from source. Are you planning on making this flag Linux-only, or can you make it work the same way on Windows?
011010 commented 2026-10-06 16:13:55 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-06T16:13:55Z.


If @arreina is not already on it, I can take this.

On your second question (Linux-only, or the same on Windows): I would keep it platform-neutral. Each package would be resolved with find_package(... CONFIG) and, on Linux, pkg_check_modules for the ones that ship a .pc; with the flag on, a missing package fails at configure time and never falls back to the bundled copy. The same flag then works on Windows against a config-mode provider (e.g. vcpkg), which is what a non-distro build there would use anyway. If you would rather keep it Linux-only for a first cut, that is a smaller change, but I do not see a reason to make the interface itself platform-specific.

Scope, from what the tree uses today:

  • Resolvable from the system: SDL2 (the top level links SDL2-static), freetype, Vulkan-Headers and SPIRV-Headers (header-only include dirs), glslang, and SPIRV-Tools (only built under ANYPS5_ENABLE_SPIRV_TOOLS).
  • Keep bundled: ffmpeg-core (carries ffmpeg.patch), libjpeg-turbo (built through its own prefix), LibAtrac9 and stb (no system packages).

One catch worth deciding up front: ensure_agc_glslang() in core/libs/prx/libSceAgcDriver/CMakeLists.txt requires the targets glslang, SPIRV and glslang-standalone. A distro glslang package generally does not export those, and usually has no glslang-standalone, so with the flag on the configure has to fail there with a clear message instead of falling through. That is the exact behaviour you asked for, so I would add that check explicitly and name the missing target.

Default is unchanged: flag off, bundled submodules, same result as today.

@arreina if you are already on it, say so and I will stay out.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6020482003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/400#issuecomment-6020482003). Originally posted by [011010](https://github.com/011010) on 2026-10-06T16:13:55Z. --- If @arreina is not already on it, I can take this. On your second question (Linux-only, or the same on Windows): I would keep it platform-neutral. Each package would be resolved with `find_package(... CONFIG)` and, on Linux, `pkg_check_modules` for the ones that ship a `.pc`; with the flag on, a missing package fails at configure time and never falls back to the bundled copy. The same flag then works on Windows against a config-mode provider (e.g. vcpkg), which is what a non-distro build there would use anyway. If you would rather keep it Linux-only for a first cut, that is a smaller change, but I do not see a reason to make the interface itself platform-specific. Scope, from what the tree uses today: - Resolvable from the system: `SDL2` (the top level links `SDL2-static`), `freetype`, `Vulkan-Headers` and `SPIRV-Headers` (header-only include dirs), `glslang`, and `SPIRV-Tools` (only built under `ANYPS5_ENABLE_SPIRV_TOOLS`). - Keep bundled: `ffmpeg-core` (carries `ffmpeg.patch`), `libjpeg-turbo` (built through its own prefix), `LibAtrac9` and `stb` (no system packages). One catch worth deciding up front: `ensure_agc_glslang()` in `core/libs/prx/libSceAgcDriver/CMakeLists.txt` requires the targets `glslang`, `SPIRV` and `glslang-standalone`. A distro `glslang` package generally does not export those, and usually has no `glslang-standalone`, so with the flag on the configure has to fail there with a clear message instead of falling through. That is the exact behaviour you asked for, so I would add that check explicitly and name the missing target. Default is unchanged: flag off, bundled submodules, same result as today. @arreina if you are already on it, say so and I will stay out.
arreina commented 2026-10-06 16:40:21 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by arreina on 2026-10-06T16:40:21Z.


@011010 Please go ahead. I'm swamped with work right now and won't have time to take this on, and your scoping, including the glslang target check, is more thorough than mine anyway. Thanks for offering.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6020939467 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/400#issuecomment-6020939467). Originally posted by [arreina](https://github.com/arreina) on 2026-10-06T16:40:21Z. --- @011010 Please go ahead. I'm swamped with work right now and won't have time to take this on, and your scoping, including the glslang target check, is more thorough than mine anyway. Thanks for offering.
oneandonlydean commented 2026-10-11 23:25:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:25:14Z.


Closing: #921 added ANYPS5_USE_SYSTEM_DEPS (off by default), and #2373 exempts cmake/SystemDeps.cmake from the conventions check.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115082624 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/400#issuecomment-6115082624). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T23:25:14Z. --- Closing: #921 added `ANYPS5_USE_SYSTEM_DEPS` (off by default), and #2373 exempts `cmake/SystemDeps.cmake` from the conventions check.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#400
No description provided.