-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add cpprestsdk options for underlying implementation #1930
Add cpprestsdk options for underlying implementation #1930
Conversation
…iables, CPPREST_PPLX_IMPL, CPPREST_HTTP_CLIENT_IMPL, CPPREST_HTTP_LISTENER_IMPL, which support different values on the Windows platform
All green in build 1 (
|
@@ -40,6 +46,10 @@ def _build_subfolder(self): | |||
def config_options(self): | |||
if self.settings.os == "Windows": | |||
del self.options.fPIC | |||
else: |
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.
Since the default values above only apply on Windows, would it be better to remove "pplx_impl": "win"
, etc. from default_options
and in config_options
replace the else
with the following code under the if self.settings.os == "Windows":
branch?
if self.options.get_safe("pplx_impl") == None:
self.options["pplx_impl"] = "win"
if self.options.get_safe("http_client_impl") == None:
self.options["http_client_impl"] = "winhttp"
if self.options.get_safe("http_listener_impl") == None:
self.options["http_listener_impl"] = "httpsys"
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 can't remove default options, Conan will break when building.
It can be improved:
if self.options.get_safe("http_listener_impl") == None:
self.options["http_listener_impl"] = "httpsys"
if not self.options.get_safe("http_listener_impl"):
self.options["http_listener_impl"] = "httpsys"
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 can't remove default options, Conan will break when building.
I read this: https://docs.conan.io/en/latest/reference/conanfile/attributes.html#default-options which says "You can also set the options conditionally to a final value with config_options()
instead of using default_options
". I was asking if that would be more appropriate here?
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 can remove self.options, not self.default_options.
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.
Almost good, only simplify cmake definitions
if self.options.get_safe("pplx_impl"): | ||
self._cmake.definitions["CPPREST_PPLX_IMPL"] = self.options.pplx_impl | ||
if self.options.get_safe("http_client_impl"): | ||
self._cmake.definitions["CPPREST_HTTP_CLIENT_IMPL"] = self.options.http_client_impl | ||
if self.options.get_safe("http_listener_impl"): | ||
self._cmake.definitions["CPPREST_HTTP_LISTENER_IMPL"] = self.options.http_listener_impl |
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.
if self.options.get_safe("pplx_impl"): | |
self._cmake.definitions["CPPREST_PPLX_IMPL"] = self.options.pplx_impl | |
if self.options.get_safe("http_client_impl"): | |
self._cmake.definitions["CPPREST_HTTP_CLIENT_IMPL"] = self.options.http_client_impl | |
if self.options.get_safe("http_listener_impl"): | |
self._cmake.definitions["CPPREST_HTTP_LISTENER_IMPL"] = self.options.http_listener_impl | |
self._cmake.definitions["CPPREST_PPLX_IMPL"] = self.options.get_safe("pplx_impl", False) | |
self._cmake.definitions["CPPREST_HTTP_CLIENT_IMPL"] = self.options.get_safe("http_client_impl", False) | |
self._cmake.definitions["CPPREST_HTTP_LISTENER_IMPL"] = self.options.get_safe("http_listener_impl", False) |
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 don't think that has the same effect? I don't want to set the CMake definitions if the Conan option is not specified.
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.
Same effect, but simplified. Setting to False is not a problem, if you are following the correct default options.
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.
@uilianries
These options are no bools
Add Conan options for C++ REST SDK, equivalent to its CMake cache variables,
CPPREST_PPLX_IMPL
,CPPREST_HTTP_CLIENT_IMPL
,CPPREST_HTTP_LISTENER_IMPL
, which each support two different values on the Windows platform.I studied the documentation for
config_options
and read related issues such as conan-io/conan#3519, since I originally planned to only add these options for some platforms (so that other platforms report exception) and/or add platform-specific default values inconfig_options
, but that didn't seem to work as I expected, so I followed the doc example of removing the options on other platforms instead.conan-center hook activated.