Skip to content

boost: add Boost.URL #15011

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

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 6 additions & 2 deletions recipes/boost/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"thread",
"timer",
"type_erasure",
"url",
"wave",
)

Expand Down Expand Up @@ -275,17 +276,20 @@ def config_options(self):
self.options.without_fiber = True
self.options.without_nowide = True
self.options.without_json = True
self.options.without_url = True
else:
version_cxx11_standard_json = self._min_compiler_version_default_cxx11
if version_cxx11_standard_json:
if Version(self.settings.compiler.version) < version_cxx11_standard_json:
self.options.without_fiber = True
self.options.without_json = True
self.options.without_nowide = True
self.options.without_url = True
else:
self.options.without_fiber = True
self.options.without_json = True
self.options.without_nowide = True
self.options.without_url = True

# iconv is off by default on Windows and Solaris
if self._is_windows_platform or self.settings.os == "SunOS":
Expand Down Expand Up @@ -434,7 +438,7 @@ def layout(self):

@property
def _cxx11_boost_libraries(self):
libraries = ["fiber", "json", "nowide"]
libraries = ["fiber", "json", "nowide", "url"]
if Version(self.version) >= "1.76.0":
libraries.append("math")
if Version(self.version) >= "1.79.0":
Comment on lines +441 to 444

Choose a reason for hiding this comment

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

Shouldn't the "url" go under the if Version(self.version) >= "1.81.'":?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would also be correct. But this is a set of c++11 libraries. Libraries that not always c++11 are applied by version. From that point "url" is always c++11. Its appearance in 1.81 is set by dependencies/dependencies-1.81.0.yml.

Expand Down Expand Up @@ -561,7 +565,7 @@ def package_id(self):

def build_requirements(self):
if not self.options.header_only:
self.tool_requires("b2/4.9.2")
self.tool_requires("b2/4.9.3")

def source(self):
get(self, **self.conan_data["sources"][self.version],
Expand Down
5 changes: 5 additions & 0 deletions recipes/boost/all/dependencies/dependencies-1.81.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ configure_options:
- thread
- timer
- type_erasure
- url
- wave
dependencies:
atomic: []
Expand Down Expand Up @@ -149,6 +150,8 @@ dependencies:
- prg_exec_monitor
- test
- test_exec_monitor
url:
- system
wave:
- filesystem
- serialization
Expand Down Expand Up @@ -250,6 +253,8 @@ libs:
- boost_type_erasure
unit_test_framework:
- boost_unit_test_framework
url:
- boost_url
wave:
- boost_wave
wserialization:
Expand Down
1 change: 1 addition & 0 deletions recipes/boost/all/rebuild-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"thread",
"timer",
"type_erasure",
"url",
"wave",
)

Expand Down
9 changes: 9 additions & 0 deletions recipes/boost/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ if(NOT HEADER_ONLY)
add_test(NAME boost_numpy COMMAND numpy_exe)
set_property(TEST boost_numpy PROPERTY ENVIRONMENT "PYTHONPATH=${Python_SITELIB}")
endif()

if(WITH_URL)
find_package(Boost COMPONENTS url REQUIRED)
add_executable(url_exe url.cpp)
target_link_libraries(url_exe PRIVATE Boost::url)
set_property(TARGET url_exe PROPERTY CXX_STANDARD 11)
add_test(NAME boost_url COMMAND url_exe)
endif()

endif()

# Test header-only target
Expand Down
2 changes: 1 addition & 1 deletion recipes/boost/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def generate(self):
tc.cache_variables["WITH_STACKTRACE"] = not self.dependencies["boost"].options.without_stacktrace
tc.cache_variables["WITH_STACKTRACE_ADDR2LINE"] = self.dependencies["boost"].conf_info.get("user.boost:stacktrace_addr2line_available")
tc.cache_variables["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False)
tc.cache_variables["WITH_URL"] = not self._boost_option("without_url", True)
if self.dependencies["boost"].options.namespace != 'boost' and not self.dependencies["boost"].options.namespace_alias:
tc.cache_variables['BOOST_NAMESPACE'] = self.dependencies["boost"].options.namespace
tc.generate()
Expand All @@ -59,4 +60,3 @@ def test(self):
return
with chdir(self, self.folders.build_folder):
self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun")

14 changes: 14 additions & 0 deletions recipes/boost/all/test_package/url.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Copyright (c) 2022 alandefreitas ([email protected])
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
//

#include <boost/url/url.hpp>
#include <cassert>

int main() {
assert(sizeof(boost::urls::url) > 0);
return 0;
}
1 change: 1 addition & 0 deletions recipes/boost/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def build(self):
cmake.definitions["WITH_STACKTRACE"] = not self.options["boost"].without_stacktrace
cmake.definitions["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available
cmake.definitions["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False)
cmake.definitions["WITH_URL"] = not self._boost_option("without_url", True)
if self.options["boost"].namespace != 'boost' and not self.options["boost"].namespace_alias:
cmake.definitions['BOOST_NAMESPACE'] = self.options["boost"].namespace
cmake.configure()
Expand Down