-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Feature request] SDL2 and SDL3 cannot be built together in the same vcpkg build #11920
Comments
@madebr, is there something we can do here? |
Is this an issue about incompatible Lines 3456 to 3459 in 9a83fa0
I added this protection to avoid a project linking to |
Thanks for your quick replies. 🙂
I believe that's what's happening. This is the error message from the vcpkg build when trying to build ImGui with both the sdl2 and sdl3 backend features enabled:
Is there an alternative way to make this work, given that vcpkg requires port features to be non-mutually exclusive? Otherwise, the only other way I can think of would be to create a separate vcpkg port of ImGui that only provides the SDL3 and SDL3GPU backends. However, I suspect that the vcpkg maintainers wouldn't accept such a more or less hack. 🤔 |
Does sdl2-compat help here? |
Indeed, that message is caused by the
You can't link SDL2 and SDL3 together. add_library(imgui STATIC imgui.cpp imgui.h)
target_include_directories(imgui_sdl2 PUBLIC "include")
add_library(imgui_sdl2 STATIC backends/imgui_sdl2.cpp)
target_link_libraries(imgui_sdl2 PUBLIC imgui SDL2::SDL2)
add_library(imgui_sdl2_renderer STATIC backends/imgui_sdl2_renderer.cpp)
target_link_libraries(imgui_sdl2_renderer PUBLIC imgui_sdl2)
add_library(imgui_sdl3 STATIC backends/imgui_sdl3.cpp)
target_link_libraries(imgui_sdl3 PUBLIC imgui SDL3::SDL3)
add_library(imgui_sdl3_renderer STATIC backends/imgui_sdl3_renderer.cpp)
target_link_libraries(imgui_sdl3_renderer PUBLIC imgui_sdl3)
add_library(imgui_sdl3_gpu STATIC backends/imgui_sdl3_gpu.cpp)
target_link_libraries(imgui_sdl3_gpu PUBLIC imgui_sdl3)
add_library(imgui_glfw3 STATIC backends/imgui_glfw3.cpp)
target_link_libraries(imgui_glfw3 PUBLIC imgui glfw3)
add_library(imgui_allegro5 STATIC backends/imgui_allegro5.cpp)
target_link_libraries(imgui_allegro5 PUBLIC imgui allegro5) Or a variation on this.
That's a no-go. This does not scale. |
Thank you! I'll have a look at that.
I suspected as much. It was a stupid idea born out of frustration. 😅 |
I'm not sure if the following is a feature request per se, but here goes.
With the release of SDL3 approaching, ImGui has already implemented backends for SDL3 in general and the new GPU API.
While trying to update the vcpkg port of ImGui to expose these new backends, one of the vcpkg maintainers encountered the issue of it being impossible to build SDL2 and SDL3 in the same vcpkg build. Many of the variables set in the CMakeLists of SDL2 and SDL3 share the same name, and the build thus fails.
Usually, users won't build SDL2 and SDL3 simultaneously. But, with vcpkg automatically including required dependencies, there are strict rules for ports being able to be built without interfering with each other and, in particular, that features exposed by a port, in this case, ImGui, are not to be mutually exclusive.
See here for the whole discussion: microsoft/vcpkg#42850
Thus, is it feasible to modify the CMake scripts of SDL3 so that it can be built alongside SDL2 in the same build process?
The text was updated successfully, but these errors were encountered: