The bundled feature exists to allow building SDL2 from source on systems that do not provide the correct version of SDL2 (i.e. LTS systems with <= 2.0.5) [citation needed]
However, there are currently no guards in place to make sure building against a native SDL2 fails if versions don't match. Likely, the user will get a confusing linker error, and be none the wiser.
The pkg-config crate allows specifying a range of acceptable versions using the atleast_version, exactly_version, and range_version methods on Config.
This should be added to computer_include_paths and pkg_config_print.
If the pkg-config probe returns Error::Failure, we should print the message, and suggest to try using the bundled feature, noting that it will require cmake.
Additionally, note that the versions of SDL2_image, SDL2_ttf, SDL2_mixer, and SDL2_gfx are not linked to the version of SDL2. This means we need to either skip this check for them, or figure out which versions we are currently expecting.
Note about vcpkg
vcpkg currently does not support version selection. The vcpkg crate does not provide a way to query the found version, either. When the vcpkg sdl2 port eventually updates to 2.0.14, users may (but in theory, shouldn't?) run into build failures.
The bundled feature exists to allow building SDL2 from source on systems that do not provide the correct version of SDL2 (i.e. LTS systems with <= 2.0.5) [citation needed]
However, there are currently no guards in place to make sure building against a native SDL2 fails if versions don't match. Likely, the user will get a confusing linker error, and be none the wiser.
The
pkg-config
crate allows specifying a range of acceptable versions using theatleast_version
,exactly_version
, andrange_version
methods onConfig
.This should be added to
computer_include_paths
andpkg_config_print
.If the pkg-config probe returns
Error::Failure
, we should print the message, and suggest to try using thebundled
feature, noting that it will requirecmake
.Additionally, note that the versions of SDL2_image, SDL2_ttf, SDL2_mixer, and SDL2_gfx are not linked to the version of SDL2. This means we need to either skip this check for them, or figure out which versions we are currently expecting.
Note about vcpkg
vcpkg currently does not support version selection. The
vcpkg
crate does not provide a way to query the found version, either. When the vcpkgsdl2
port eventually updates to 2.0.14, users may (but in theory, shouldn't?) run into build failures.