mcgoo / cargo-vcpkg

Get external dependencies in one step by specifying vcpkg details in Cargo.toml
Apache License 2.0
38 stars 6 forks source link

Add ability to enable features on vcpkg packages? #16

Open griffi-gh opened 1 year ago

griffi-gh commented 1 year ago

For example I need to enable x11 feature on sdl2 to make it compile on Linux, but I can't find a way to do it.

waych commented 1 year ago

You should already be able to list explicit vcpkg dependencies via Cargo.toml by including them in square brackets. E.g:

[package.metadata.vcpkg]
dependencies = ["sdl2[x11]"]

This may not be what you are looking for however. In my experience, the sdl2 vcpkg port is not a hermetic build, and is reliant on the backends' development headers to be properly installed on the build host. Current microsoft/vcpkg seems to build and work with x11 just fine for me without specifying the feature directly. To make it work, I have to install the following packages (on Debian) as prep for the build:

apt install libfreetype-dev libxext-dev libxxf86vm-dev libgl-dev pkg-config

Note that the developer dependency on libxxf86vm-dev seemed rather new to me.