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

Default triplet #70

Merged
merged 6 commits into from
Sep 23, 2016
Merged

Conversation

albertziegenhagel
Copy link
Contributor

Allow to set a user defined default triplet via the environment variable "VCPKG_DEFAULT_TRIPLET".

resolves #53

@msftclas
Copy link

Hi @AlZie, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
We will now validate the agreement and then real humans will evaluate your PR.

TTYL, MSBOT;

const auto vcpkg_default_triplet_env = System::wdupenv_str(L"VCPKG_DEFAULT_TRIPLET");
if(!vcpkg_default_triplet_env.empty())
{
default_target_triplet = {Strings::utf16_to_utf8(vcpkg_default_triplet_env)};
Copy link
Contributor

Choose a reason for hiding this comment

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

We should restructure this with the code below so that we trigger the sanitization code on line https://github.com/alzie/vcpkg/blob/4a818b6a3e86514af27381fe16dcf311a5c28ffb/toolsrc/src/main.cpp#L87. This gives users a nice message if they specify a bad triplet instead of failing later on in an uglier way.

Copy link
Contributor Author

@albertziegenhagel albertziegenhagel Sep 23, 2016

Choose a reason for hiding this comment

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

I've updated the pull request as suggested and additionally added a validation of the triplet when given on a per-package basis.

Some notes on the current implementation:

The default triplet will be determined in 3 stages:

  1. if a default triplet is given with "--triplet" explicitly this value will be taken.
  2. else the environment variable VCPKG_DEFAULT_TRIPLET is being evaluated.
  3. else the default triplet is "x86-windows".

The outcome of those tree stages is then being validated against the files in the triplet directory. This means that "--triplet" always hides whatever is given in VCPKG_DEFAULT_TRIPLET, even if the environment variable has an invalid value.

Additionally I added the same validation to triplets that are given per-package. But this validation is performed independently of what is set as default triplet. This means an invalid value for "--triplet" or set in VCPKG_DEFAULT_TRIPLET will trigger an error, even if it is not used for any package.

EDIT: I disabled the per-package validation again, since I realized that it breaks other commands as "vcpkg create". The reason for this, is that "vcpkg create" first tries to parse all command arguments as package specs, but then discards all but the first one. Now, if one of the command arguments includes a colon (just like any URL starting with http://) it would try to parse (and validate) the second half after the colon as triplet. This is related to issue #79. The validation can be re-enabled after issue #79 is fixed.

@ras0219-msft ras0219-msft merged commit 082eb36 into microsoft:master Sep 23, 2016
ras0219-msft added a commit that referenced this pull request Sep 23, 2016
@ras0219-msft
Copy link
Contributor

Thanks for the solid work here!

@albertziegenhagel albertziegenhagel deleted the default_triplet branch August 10, 2017 21:40
strega-nil pushed a commit to strega-nil/vcpkg that referenced this pull request May 5, 2021
dempo93 pushed a commit to dempo93/vcpkg that referenced this pull request Aug 23, 2022
Added 32bits compilation configuration for msvc
fwcd pushed a commit to fwcd/vcpkg that referenced this pull request May 20, 2023
[qt5-base] Add Patch to replace std::result_of with decltype
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change default triplet
3 participants