-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Default triplet #70
Conversation
Hi @AlZie, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! 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)}; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
- if a default triplet is given with "--triplet" explicitly this value will be taken.
- else the environment variable VCPKG_DEFAULT_TRIPLET is being evaluated.
- 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.
# Conflicts: # toolsrc/include/vcpkg_cmd_arguments.h # toolsrc/src/commands_installation.cpp # toolsrc/src/vcpkg_cmd_arguments.cpp
Thanks for the solid work here! |
Added 32bits compilation configuration for msvc
[qt5-base] Add Patch to replace std::result_of with decltype
Allow to set a user defined default triplet via the environment variable "VCPKG_DEFAULT_TRIPLET".
resolves #53