[Scons-dev] Adding SCons support for VCPkg
Ryan Saunders
jediry at outlook.com
Sat Mar 16 17:38:23 EDT 2019
Hi SCons developers!
I am working on a SCons tool integrating the new VCPkg package manager from Microsoft (https://github.com/Microsoft/vcpkg). VCPkg makes it pretty straightforward to acquire 3rd party libraries and header files…”vcpkg install boost” is basically equivalent to “apt-get install boost-devel” on Ubuntu. Personally, I’m excited about this, as acquiring and configuring development libraries on Windows has been painful, historically. VCPkg works on Windows, Linux and MacOS (though I've only tried it on Windows so far.)
(Note: I work for Microsoft, but not on anything related to VCPkg or Visual Studio…this is strictly a side project for me.)
I envision it working something like this:
env = Environment(tools = [‘default’, ‘vcpkg’])
env.Replace( VCPKGROOT = ‘#/some/path/vcpkg’ ) # Override default root directory of #/vcpkg
…
env.VCPkg( ‘boost-smart-ptr’ )
env.VCPkg( ‘FreeImagePlus’ )
…possibly with some as-yet-unspecified integration with the Configure context, so that packages can be auto-installed if not found.
Basically, my goal is to be able to “git clone” a project onto a machine with just Git, VS and Python installed, and then to build successfully (including acquiring all necessary libraries) simply by running “scons”.
Some questions I have:
* Is this something that would be acceptable/desirable as part of SCons core, or should I be thinking of this as a tool that lives in its own repo?
* It occurs to me that, while this does work on Linux/MacOS, these systems have their own native package management solutions for acquiring development libs. So, perhaps this would be better as a sort of “meta-package-manager” tool that uses VCPkg on Windows, and something native-ish on other systems. On the other hand, those tools usually require root access to use, so maybe that’s not a good idea. Thoughts?
* In my current prototype, if VCPkg is not found, then I’m downloading it and building it via its “bootstrap” script. However, I’m not sure where the best place to do this is…I could do it in my tool’s generate() function, which seems logical, but this appears to be called immediately upon loading the tool, before the SConscript has an opportunity to override VCPKGROOT. What do you recommend?
* I’m having difficulty deciding what “source” and “target” should be for my Builder.
* Based on scouring the ‘net, it seems that I want to use a Value() as my “source”…probably just the string name of the package to be installed. Does that sound right?
* For “target”, would it be better to exhaustively enumerate all the outputs of “vcpkg install <pkg>” and list these as “targets”, or should I find some single file that gets produced by installing a package (e.g., the package manifest), and use this as a “sentinel” for the whole package? The latter is clearly simpler, but could this result in an incomplete incremental rebuild after upgrading to a newer version of the package?
Any advice you can provide would be appreciated!
Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20190316/9b75dd69/attachment.html>
More information about the Scons-dev
mailing list