Port visualisations to ProjectM 4.x C API - #7438
Conversation
09a4e12 to
889406a
Compare
|
I think it's probably fine to remove the vendored projectm if it works without on common Linux distros. |
|
Usually we try to compile support for everything in CI to prove it all works. Presumably projectm4 isn't packaged for most of these distros? |
|
Would be great to see projectM being updated in Clementine, as the vendored version was a copy of a really old release (2.x) or projectM. For the Windows build, make sure to call |
Ubuntu packages 2.1.0 @hatstand I guess the best solution is replace vendored v2.x with v4.1.6 in this PR, and configure CMake to build using that if a v4.x system dependency is not available? This would allow it to be built and tested in CI and work around the old dependencies packaged on most common OS targets. |
|
After vendoring ProjectM 4.1.6, I'm running into a couple of problems:
|
Focal is probably old enough to drop, yep. |
|
I see you're already on it. 🍻 I think we'll need to merge these two PRs, then I'll rebase to try again: |
|
Still getting some GLEW error, I think it needs the file |
|
Yeah, there's a few things to fix bumping the mingw build. I think glew is actually fine as we do produce |
|
Adding |
Now we're getting: I'm pretty far out of my depth here with only a vague understanding of how GL components interact, but my instinct would be to either bump the GLEW version or wait for projectM 4.2, what do you think? |
|
As the error says, I think that's just about incorrect order of inclusion. The |
|
My bad, I thought this was an error from the vendored projectM source rather than from Clementine source. Pushed again! |
|
AI figured out the last issue (@kblaschke might be worth upstreaming?):
|
|
Thanks! |
|
I'll also release libprojectM v4.1.7 with the static linking fix shortly. Great work! |
|
@kblaschke thanks! Would 775956d be something for upstreaming as well? Not sure the best way to handle that. |
Yes, that'd make it way easier to use it as a submodule. I remember others asking for this a while ago, but I never actually fixed it. Apart from those variables, there might be others in more hidden places, where the "wrong" (non-project) variables are used, but I can't recall any from the back of my head right now. Guess if it works with these changes, it's good. Feel free to open a PR for the master branch - and for the |
Looks like this was already fixed on I'll update projectM in Alpine once 4.2.0 is released! |
I'm a package maintainer from Alpine Linux trying to update the ProjectM package to v4.1.6. This fails due to the Clementine dependency on the older ProjectM API, so I tried using Claude AI to update the Clementine to use the new version. This seems to have been successful - I am able to build against locally built and installed upstream ProjectM 4.1.6 and view visualizations on Ubuntu 25.10.
It would now make sense to unvendor the old ProjectM from the
3rdpartydir since this is dead code, but I thought it would be better to wait for guidance from Clementine maintainers on how to handle this, since ProjectM itself also vendors some deps, making this a maintenance burden.Resolves #7307, ping @kblaschke as author of libprojectm for review. I'm curious to hear your opinion on the code quality, feel free to use this as a starting point if it needs more work or tell me if it's complete junk and I'll close the PR ;)
Claude AI comments on this PR follow below the snip
Summary
Replaces the bundled projectM 2.x library and its C++ API with the projectM 4 system library and its stable C API.
Changes
Source
projectmvisualisation.cpp/.h: fully ported to the projectM 4 C API (projectm_create,projectm_opengl_render_frame,projectm_pcm_add_int16, etc.). Playlist management now uses the separatelibprojectM-playlistlibrary.projectmpresetmodel.cpp,visualisationselector.cpp: removed dead#ifdef USE_SYSTEM_PROJECTM/projectM.hppinclude blocks.Build
CMakeLists.txt: replacedpkg_check_modules(LIBPROJECTM …)andadd_subdirectory(3rdparty/libprojectm)withfind_package(projectM4)/find_package(projectM4Playlist). Visualisations gracefully auto-disable if projectM 4 is not found.BUNDLE_PROJECTM_PRESETScmake option (it only controlled the now-deleted bundled copy).clementine-config.h.in: removedUSE_SYSTEM_PROJECTMdefine.Removed
3rdparty/libprojectm/—the entire bundled projectM 2.x source tree is removed.Dependency
Visualisations now require projectM ≥ 4.0 with the playlist component (
libprojectM+libprojectM-playlist). If not found at configure time, visualisations are silently disabled (no build failure). Preset files (.milk) are loaded from the system preset directory (e.g. install theprojectm-datapackage on Debian/Ubuntu).CI impact
Existing CI containers (Debian, Ubuntu, Fedora) do not have projectM 4 packaged, so those builds will continue to compile without visualisations — identical to the previous behaviour on those platforms. No CI changes are required.
Testing
Built and tested on Ubuntu 24.04 with projectM 4.1.6 built from source. Visualisations menu enabled, preset list populated, rendering confirmed working.