Skip to content

Commit

Permalink
boost: add Boost.URL
Browse files Browse the repository at this point in the history
  • Loading branch information
sanblch committed Jan 1, 2023
1 parent 7e07692 commit 84fd046
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 1 deletion.
6 changes: 5 additions & 1 deletion 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":
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
8 changes: 8 additions & 0 deletions recipes/boost/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ if(NOT HEADER_ONLY)
target_include_directories(numpy_exe PRIVATE ${PYTHON_INCLUDE_DIRS})
target_link_libraries(numpy_exe PRIVATE Boost::numpy${PYTHON_COMPONENT_SUFFIX} ${PYTHON_LIBRARIES})
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)
endif()

endif()

# Test header-only target
Expand Down
3 changes: 3 additions & 0 deletions recipes/boost/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def generate(self):
tc.variables["WITH_STACKTRACE"] = not self.dependencies["boost"].options.without_stacktrace
tc.variables["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available
tc.variables["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False)
tc.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.variables['BOOST_NAMESPACE'] = self.dependencies["boost"].options.namespace
tc.generate()
Expand Down Expand Up @@ -99,3 +100,5 @@ def test(self):
self.run(os.path.join(bindir, "stacktrace_basic_exe"), env="conanrun")
if self._boost_option("with_stacktrace_backtrace", False):
self.run(os.path.join(bindir, "stacktrace_backtrace_exe"), env="conanrun")
if not self._boost_option("without_url", True):
self.run(os.path.join(bindir, "url_exe"), 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 (alandefreitas@gmail.com)
//
// 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;
}
3 changes: 3 additions & 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 Expand Up @@ -87,3 +88,5 @@ def test(self):
self.run(os.path.join("bin", "stacktrace_basic_exe"), run_environment=True)
if self._boost_option("with_stacktrace_backtrace", False):
self.run(os.path.join("bin", "stacktrace_backtrace_exe"), run_environment=True)
if not self._boost_option("without_url", True):
self.run(os.path.join("bin", "url_exe"), run_environment=True)

0 comments on commit 84fd046

Please sign in to comment.