Print Out SDL2 Include Directory in sdl2-sys Build Script #968
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In order to facilitate using the includes provided/found by
sdl2-sys
in other*-sys
crates, I have added print statements which set the "include" key to the path to the include folder that has either been provided or found.This can be accessed through the environment variable
DEP_SDL2_INCLUDE
in all crate build scripts which directly depend onsdl2-sys
, transitives are not affected.If there are multiple include directories, they are separated by a
:
.A use case can be found here where I must pass the header directory to
cc
to build c++ code which depends on SDL2.I have tried to make as few changes as possible to the build script, however I did make two changes that shouldn't affect the usability of it at all:
generate_bindings
to no longer be generic, as every single instance was being called withS = String
. This started because I wanted to use.join(":")
on the slice, but that requires something that isBorrow<str>
notAsRef<str>
. As borrow is a newer feature, I didn't know your minimum rustc version, and all invocations were withString
, I just went ahead and removed the generic.All of the particulars about the PR can be changed if needed to fit style, usability, etc. I have verified that my own fork works as expected for downstream crates.
It might be worthwhile to add this to documentation as well, though I don't know if that is deserving of its own PR.
Closes #967