Skip to content
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

Initial VCPkg integration #4226

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
217ad69
Initial implementation of vcpkg builder
Feb 26, 2022
cccb361
Respect --silent in vcpkg spew and support a --vcpkg-debug flag
Feb 27, 2022
d3e983b
Fix break caused by reading old-style CONTROL files. Tweak output for…
Feb 28, 2022
b5f070c
Avoid re-downloading vcpkg.exe from GitHub when we have the correct v…
Mar 1, 2022
52de2a6
Merge branch 'master' into vcpkg
Aug 7, 2022
282785e
Enable enumeration of package contents in SConstruct file, via Packag…
Aug 9, 2022
12d1fdd
Fix faulty use of AppendUnique
Aug 9, 2022
705be7b
Updates to VCPkg documentation and tests
Aug 14, 2022
16b87e6
Merge remote-tracking branch 'upstream/master'
Sep 9, 2022
a8fecc5
Merge branch 'master' into vcpkg
Sep 9, 2022
a7d5fd8
Significantly expanded unit tests
Sep 11, 2022
a560ee0
Added CHANGES.txt entry
Sep 11, 2022
7ce7088
Updated description in CHANGES.txt and replicated in RELEASE.txt
Sep 12, 2022
2f3c24f
Updated file headers to match current templates.
Sep 18, 2022
70fef43
Only init vcpkg tool on supported platforms (Win/MacOS/Linux)
Sep 18, 2022
20ce478
Fix code review feedback and add tests for package contents
Sep 19, 2022
2ffe5d4
Fix a flaw in enumerating package contents, in which packages reachab…
Sep 19, 2022
076d2d9
Add disabled test for the list-of-packages case
Sep 19, 2022
4ec11b5
Fix multi-package case. Update documentation.
Sep 19, 2022
8e22ef5
Add missing XML xlink namespace
Sep 24, 2022
93630d3
Fix missed variable rename
Sep 24, 2022
93233b0
Convert VCPkgBuilder to its own class overriding __eq__, in order to …
Sep 24, 2022
9147eab
Fix naming of cv- link
Sep 24, 2022
7e7727f
Fix doc generation
Sep 25, 2022
3b89b13
Merge remote-tracking branch 'upstream/master' into vcpkg
Dec 13, 2022
ce40138
Merge remote-tracking branch 'upstream/master' into vcpkg
Jan 16, 2023
a7f5858
Update xml traversal limit
Jan 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Added -fsanitize support to ParseFlags(). This will propagate to CCFLAGS and LINKFLAGS.

From Ryan Saunders:
- Added VCPkg() builder, enabling cross-platform acquisition and building of 3rd party C/C++
jediry marked this conversation as resolved.
Show resolved Hide resolved
libraries.
- Fixed runtest.py failure on Windows caused by excessive escaping of the path to python.exe.

RELEASE 4.4.0 - Sat, 30 Jul 2022 14:08:29 -0700
Expand Down
528 changes: 528 additions & 0 deletions SCons/Tool/VCPkgTests.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions SCons/Tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,8 @@ def tool_list(platform, env):
'tar', 'zip',
# File builders (text)
'textfile',
# Package management
'vcpkg',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should be a win32 only thing? Or does it work on all platforms?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like win, linux, and macos. So it shouldn't be in default list. (BSD's not supported?, hpux, solaris, aix, other evil remnants of the past which are still in use(that's not referring to BSDs, but rather the others.. ;)

Copy link
Contributor

@bdbaddog bdbaddog Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

further review looks like your implementation is win32 only, so should be only in that platforms default tool list above. under other_plat_tools

Copy link
Author

@jediry jediry Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My implementation is not Win32-only. I've tested on Ubuntu and Windows, and it should work on Mac as well, though I don't have the ability to test Mac, as I don't own one.

OK, so if I'm understanding correctly, I should conditionally add this to other_plat_tools on platforms where it's supported.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. add it to other_plat_tools for each supported platform. Also I'd add a note which platforms it's supported on in the docs and CHANGES/RELEASE files.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ummm...how do I detect "linux"? It seems like tools such as m4 and rpm are being added simply based on "not win32". Is there a positive test I can do to detect a linux system?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ummm...how do I detect "linux"? It seems like tools such as m4 and rpm are being added simply based on "not win32". Is there a positive test I can do to detect a linux system?

Eh, that's a little complex. Depending on where you're asking... a simple way is to check sys.platform for linux. However, the name of the Platform module is actually posix, which is shared with some of the other choices (that originally comes from the value of os.name).

], env)

tools = [
Expand Down
2 changes: 1 addition & 1 deletion SCons/Tool/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ are selected if their respective conditions are met:
&t-link-jar;, &t-link-javac;, &t-link-javah;, &t-link-rmic;,
&t-link-dvipdf;, &t-link-dvips;, &t-link-gs;,
&t-link-tex;, &t-link-latex;, &t-link-pdflatex;, &t-link-pdftex;,
&t-link-tar;, &t-link-zip;, &t-link-textfile;.
&t-link-tar;, &t-link-zip;, &t-link-textfile; &t-link-vcpkg;.
</para>

<para>
Expand Down
613 changes: 613 additions & 0 deletions SCons/Tool/vcpkg.py

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions SCons/Tool/vcpkg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?xml version="1.0"?>
<!--
__COPYRIGHT__

This file is processed by the bin/SConsDoc.py module.
See its __doc__ string for a discussion of the format.
-->

<!DOCTYPE sconsdoc [
<!ENTITY % scons SYSTEM '../../doc/scons.mod'>
%scons;
<!ENTITY % builders-mod SYSTEM '../../doc/generated/builders.mod'>
%builders-mod;
<!ENTITY % functions-mod SYSTEM '../../doc/generated/functions.mod'>
%functions-mod;
<!ENTITY % tools-mod SYSTEM '../../doc/generated/tools.mod'>
%tools-mod;
<!ENTITY % variables-mod SYSTEM '../../doc/generated/variables.mod'>
%variables-mod;
]>

<sconsdoc xmlns="http://www.scons.org/dbxsd/v1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">

<tool name="vcpkg">
<summary>
<para>
Sets construction variables for the &vcpkg; package manager
Copy link
Collaborator

@mwichmann mwichmann Sep 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated entities for a tool named vcpkg will be &t-vcpkg; and &t-link-vcpgk; - thus this entity reference generated an error.

 ERROR: SCons/Tool/vcpkg.xml fails to parse:
Entity 'vcpkg' not defined, line 29, column 60 (vcpkg.xml, line 29)

</para>
</summary>
<uses>
<item>VCPKGROOT</item>
<item>VCPKGDEBUG</item>
</uses>
</tool>

<builder name="VCPkg">
<summary>
<para>
Downloads and builds one or more software packages (plus any dependencies of those packages) via the
&vcpkg; package manager, making the built artifcats available for other builders.
</para>

<example_commands>
# Install FreeImage, plus any of its dependencies
env.VCPkg('freeimage')
</example_commands>

<para>
&vcpkg; is distributed as a Git repository, containing the &vcpkg; executable (or a script to build it)
and a "snapshot" of the current versions of all available packages. A typical usage pattern is for your
project to incorporate &vcpkg; as a Git submodule underneath your project (run 'git submodule --help'),
though system-wide installation is also supported.
</para>

<para>
Packages built with &vcpkg; may produce header files, static libraries and shared libraries
(<filename>.dll</filename>/<filename>.so</filename> files). The &vcpkg;-internal directores
containing these built artifacts are added to &cv-link-CPPPATH; and &cv-link-LIBPATH; and
&cv-link-PATH;, respectively.
</para>

</summary>
</builder>

<cvar name="VCPKGROOT">
<summary>
<para>
Specifies the path to the root directory of the &vcpkg; installation. This must be set in the
SConstruct/SConscript file, and must point to an existing &vcpkg; installation. Often, this directory
will be a Git sub-module of your project, in which case VCPKGROOT will be specified relative to the
project root.
</para>

<example_commands>
# vcpkg is a submodule located in the 'vcpkg' directory underneath the project root
env['VCPKGROOT'] = '#/vcpkg'
</example_commands>
</summary>
</cvar>

<cvar name="VCPKGDEBUG">
<summary>
<para>
Specifies whether &vcpkg; should build debug or optimized versions of packages. If True, then "debug"
packages will be built, with full debugging information and most optimizations disabled. If False (or
unset), then packages will be built using optimized settings.
</para>
<para>
Note that, while you may choose to set this to match the optimization settings of your project's build,
this is not required: it's perfectly fine to use optimized packages with a "debug" build of your project.
</para>
</summary>
</cvar>

</sconsdoc>
1 change: 1 addition & 0 deletions bin/files
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
./SCons/Tool/tar.py
./SCons/Tool/tex.py
./SCons/Tool/tlib.py
./SCons/Tool/vcpkg.py
./SCons/Tool/yacc.py
./SCons/Util.py
./SCons/Warnings.py
Expand Down
2 changes: 2 additions & 0 deletions doc/generated/tools.mod
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
<!ENTITY t-tex "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>tex</literal>">
<!ENTITY t-textfile "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>textfile</literal>">
<!ENTITY t-tlib "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>tlib</literal>">
<!ENTITY t-vcpkg "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>vcpkg</literal>">
<!ENTITY t-xgettext "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>xgettext</literal>">
<!ENTITY t-yacc "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>yacc</literal>">
<!ENTITY t-zip "<literal xmlns='http://www.scons.org/dbxsd/v1.0'>zip</literal>">
Expand Down Expand Up @@ -210,6 +211,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT.
<!ENTITY t-link-tex "<link linkend='t-tex' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>tex</literal></link>">
<!ENTITY t-link-textfile "<link linkend='t-textfile' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>textfile</literal></link>">
<!ENTITY t-link-tlib "<link linkend='t-tlib' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>tlib</literal></link>">
<!ENTITY t-link-vcpkg "<link linkend='t-vcpkg' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>vcpkg</literal></link>">
<!ENTITY t-link-xgettext "<link linkend='t-xgettext' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>xgettext</literal></link>">
<!ENTITY t-link-yacc "<link linkend='t-yacc' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>yacc</literal></link>">
<!ENTITY t-link-zip "<link linkend='t-zip' xmlns='http://www.scons.org/dbxsd/v1.0'><literal>zip</literal></link>">