Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MixerX returns cryptic error when SDL2 is already included in the library #76

Open
knight-ryu12 opened this issue Apr 22, 2024 · 5 comments

Comments

@knight-ryu12
Copy link
Contributor

knight-ryu12 commented Apr 22, 2024

Seems that when FetchContent_Declare is defined for SDL2 FIRST, then MixerX was Declared, MixerX tries to install SDL2 no matter what.

Error is

CMake Error: The INTERFACE_SDL2_SHARED property of "SDL2" does
not agree with the value of SDL2_SHARED already determined
for "sdl2_vulkan".

CMake Error: install(EXPORT "SDL2MixerExtStaticTargets" ...) includes target "SDL2_mixer_ext_Static" which requires target "SDL2" that is not in any export set.

I'd suggest check for SDL2_DISABLE_INSTALL is enabled or not to prevent double install.

@Wohlstand
Copy link
Member

Actually, I never used the FetchContent way, and I more prefer the ExternalProject as it gives me a full control on what to configure and how to install, and what content is to take. You may want to check out this example on how to use the MixerX and dependent libraries from the AudioCodec set: https://github.com/TheXTech/TheXTech/blob/main/cmake/library_SDLMixerX.cmake
(Note: In this example, AudioCodecs and MixerX are submodules of the project, and they gets used by local way, i.e. reuse the same source directory without the clonning/updating the whole repo - this results a time waste while debugging because it also tries to sync the repo and rebuild the library when it's not needed).

@Wohlstand
Copy link
Member

MixerX tries to install SDL2 no matter what.

As I remember, by default build it attempts to find the nearest available in-system SDL2, and it does downloading and installing of extra things if enable the separate AudioCodecs downloading 🤔
Here is also a flag that tells to use system SDL2 in any way, and therefore SDL2 from AudioCodecs will not being used and system-wide will be preferred.

@knight-ryu12
Copy link
Contributor Author

Seems that if SDL is being add_subdirectory'd into project, you can't install any target that depends into SDL, because SDL isn't itself scheduled to be installed by the project

If you then add_subdirectory MixerX, it tries to install itself (which depends on SDL), which breaks

@Wohlstand
Copy link
Member

If you want to use the MixerX in your CMake project, here is a working simple example:
https://github.com/Wohlstand/MixerXDemoPlayer

@Wohlstand
Copy link
Member

By the way, about MixerX: it uses the find_package() when it runs in system libraries mode to find the SDL2 installed in the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants