-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[vcpkg_check_features] Set output variable explicitly and allow reverse-logic check #7558
[vcpkg_check_features] Set output variable explicitly and allow reverse-logic check #7558
Conversation
Is there a simple reason why
and should be put somewhere before the portfile is included. vcpkg_check_features() thus looks superflous and there is no benefit of having it. I still have to do the mapping from feature to cmake option and it might even be more obvious using the syntax: |
The main motivation behind this PR is to get rid of automatically-set variables. We strive to design portfile functions with zero or minimal side-effects. Although, sometimes it is not possible (e.g.: The same is true for Using the vcpkg_check_feature(
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
"feature" LIBRARY_SPECIFIC_OPTION
"feature2" LIBRARY_SPECIFIC_OPTION2
) |
that just referes to undocumented behavior. If the variables are documented there is no issue with that. The function just is documented and thus it seems like less behind-the-scenes "magic". The same could be said about all the Netherless you probably want to add an optional APPEND option and an optional NEGATE option instead of an INVERTED_FEATURES list. APPEND to append to OUT_FEATURE_OPTIONS which allows chaining of multiple vcpkg_check_feature calls into one OUT_FEATURE_OPTIONS variable which is probably necessary if you do not want to have big duplicated features checks for different build targets. |
We did consider a I really like the idea of |
…cpkg-check-features-refactor
…cpkg-check-features-refactor
@@ -19,5 +19,5 @@ Feature: weights-train | |||
Description: Download pre-built weights for training | |||
|
|||
Feature: opencv-cuda | |||
Build-Depends: opencv[ffmpeg], opencv[cuda] | |||
Build-Depends: darknet[opencv], darknet[cuda] |
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.
This is different from the previous meaning!!!
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.
You're right, it was a mistake on my part.
Unfortunately, this means that this port cannot use vcpkg_check_features()
now.
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.
Ok, no problem, the right dependencies are more important
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.
Unfortunately, this means that this port cannot use vcpkg_check_features() now.
Why? Shouldn't the feature list now contain cuda, opencv and opencv-cuda?
I assume the correct line should read darknet[opencv], darknet[cuda], opencv[cuda]
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.
No.
Darknet[cuda] enables cuda for darknet, darknet[opencv-cuda] requires a cuda-enabled opencv. They are independent features. If you want both, you have to ask for darknet[cuda,opencv-cuda]
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.
Ah I see
Build-Depends: darknet[opencv], darknet[cuda], opencv[cuda]
resolves to
Build-Depends: opencv[ffmpeg], cuda, opencv[cuda]
but you want to have:
Build-Depends: darknet[opencv], opencv[cuda]
resolving to
Build-Depends: opencv[ffmpeg], opencv[cuda]
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’d just revert them the way they were originally. I also had another pr floating, for the cudnn feature. I think I will just restore features there merging with master, then wait for merging.
The aim of these PR is to make the following changes to
vcpkg_check_features()
:Require an output variable to be explicitly set
The current implementation silently sets the variable
FEATURE_OPTIONS
, this breaks the pattern used in other functions likevcpkg_from_github()
orvcpkg_extract_source_archive_ex()
, where out variables are set explicitly. A new parameterOUT_FEATURE_OPTIONS
is added to replace theFEATURE_OPTIONS
variable.Do not create variables for each feature
Stop creating output variables for each feature, this makes it so that
OUT_FEATURE_OPTIONS
is the only output variable produced by this function.Allow inverted-logic features.
Allow features that have opt-out behavior in their build-systems, e.g.:
cpprestsdk[websockets,brotli]
, to usevcpkg_check_features()
with inverted logic.In order to accommodate these changes the usage of the function has been changed to:
Ports already using
vcpkg_check_features()
need to be updated to follow this new usage:czmq
darknet
librdkafka
mimalloc
mongo-c-driver
oniguruma
opencv4
paho-mqttpp3
pcl
xsimd
xtensor
zeromq