-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from grisumbras/conan-recipe
Added Conan recipe
- Loading branch information
Showing
3 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
diff --git a/include/boost/scope/unique_resource.hpp b/include/boost/scope/unique_resource.hpp | ||
index 08f4fc6..c97e3b1 100644 | ||
--- a/include/boost/scope/unique_resource.hpp | ||
+++ b/include/boost/scope/unique_resource.hpp | ||
@@ -16,7 +16,7 @@ | ||
|
||
#include <type_traits> | ||
#include <boost/core/addressof.hpp> | ||
-#include <boost/core/invoke_swap.hpp> | ||
+#include <boost/core/swap.hpp> | ||
#include <boost/scope/unique_resource_fwd.hpp> | ||
#include <boost/scope/detail/config.hpp> | ||
#include <boost/scope/detail/compact_storage.hpp> | ||
@@ -615,8 +615,8 @@ private: | ||
|
||
void swap_impl(unique_resource_data& that, std::true_type, std::true_type) noexcept | ||
{ | ||
- boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource()); | ||
- boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter()); | ||
+ boost::swap(get_internal_resource(), that.get_internal_resource()); | ||
+ boost::swap(get_internal_deleter(), that.get_internal_deleter()); | ||
|
||
const bool allocated = m_allocated; | ||
m_allocated = that.m_allocated; | ||
@@ -625,14 +625,14 @@ private: | ||
|
||
void swap_impl(unique_resource_data& that, std::true_type, std::false_type) | ||
{ | ||
- boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource()); | ||
+ boost::swap(get_internal_resource(), that.get_internal_resource()); | ||
try | ||
{ | ||
- boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter()); | ||
+ boost::swap(get_internal_deleter(), that.get_internal_deleter()); | ||
} | ||
catch (...) | ||
{ | ||
- boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource()); | ||
+ boost::swap(get_internal_resource(), that.get_internal_resource()); | ||
throw; | ||
} | ||
|
||
@@ -643,14 +643,14 @@ private: | ||
|
||
void swap_impl(unique_resource_data& that, std::false_type, std::false_type) | ||
{ | ||
- boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter()); | ||
+ boost::swap(get_internal_deleter(), that.get_internal_deleter()); | ||
try | ||
{ | ||
- boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource()); | ||
+ boost::swap(get_internal_resource(), that.get_internal_resource()); | ||
} | ||
catch (...) | ||
{ | ||
- boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter()); | ||
+ boost::swap(get_internal_deleter(), that.get_internal_deleter()); | ||
throw; | ||
} | ||
|
||
@@ -896,34 +896,34 @@ private: | ||
|
||
void swap_impl(unique_resource_data& that, std::true_type, std::true_type) noexcept | ||
{ | ||
- boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource()); | ||
- boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter()); | ||
+ boost::swap(get_internal_resource(), that.get_internal_resource()); | ||
+ boost::swap(get_internal_deleter(), that.get_internal_deleter()); | ||
} | ||
|
||
void swap_impl(unique_resource_data& that, std::true_type, std::false_type) | ||
{ | ||
- boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource()); | ||
+ boost::swap(get_internal_resource(), that.get_internal_resource()); | ||
try | ||
{ | ||
- boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter()); | ||
+ boost::swap(get_internal_deleter(), that.get_internal_deleter()); | ||
} | ||
catch (...) | ||
{ | ||
- boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource()); | ||
+ boost::swap(get_internal_resource(), that.get_internal_resource()); | ||
throw; | ||
} | ||
} | ||
|
||
void swap_impl(unique_resource_data& that, std::false_type, std::false_type) | ||
{ | ||
- boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter()); | ||
+ boost::swap(get_internal_deleter(), that.get_internal_deleter()); | ||
try | ||
{ | ||
- boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource()); | ||
+ boost::swap(get_internal_resource(), that.get_internal_resource()); | ||
} | ||
catch (...) | ||
{ | ||
- boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter()); | ||
+ boost::swap(get_internal_deleter(), that.get_internal_deleter()); | ||
throw; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Copyright 2023 Dmitry Arkhipov (grisumbras@yandex.ru) | ||
# | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE_1_0.txt or copy at | ||
# https://www.boost.org/LICENSE_1_0.txt) | ||
|
||
from conan import ConanFile | ||
from conan.errors import ( | ||
ConanException, | ||
ConanInvalidConfiguration, | ||
) | ||
from conan.tools.files import ( | ||
copy, | ||
patch, | ||
) | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.cmake import ( | ||
cmake_layout, | ||
) | ||
from conan.tools.scm import Version | ||
|
||
import os | ||
|
||
required_conan_version = ">=1.53.0" | ||
|
||
class ScopeConan(ConanFile): | ||
name = "boost_scope" | ||
version = "1.0.0" | ||
description = ( | ||
"Boost.Scope provides a number of scope guard utilities described " + | ||
"in C++ Extensions for Library Fundamentals, Version 3") | ||
|
||
url = "https://github.com/Lastique/scope" | ||
homepage = "https://github.com/Lastique/scope" | ||
license = "BSL-1.0" | ||
topics = "cpp" | ||
|
||
settings = "compiler", "build_type" | ||
|
||
requires = "boost/[>=1.83.0]" | ||
|
||
@property | ||
def _min_compiler_version_default_cxx11(self): | ||
# Minimum compiler version having c++ standard >= 11 by default | ||
return { | ||
"apple-clang": 99, # assume apple-clang will default to c++11 in the distant future | ||
"gcc": 6, | ||
"clang": 6, | ||
"Visual Studio": 14, # guess | ||
"msvc": 190, # guess | ||
}.get(str(self.settings.compiler)) | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, 11) | ||
else: | ||
version_cxx11_standard_json = self._min_compiler_version_default_cxx11 | ||
if not version_cxx11_standard_json: | ||
self.output.warning("Assuming the compiler supports c++11 by default") | ||
elif Version(self.settings.compiler.version) < version_cxx11_standard_json: | ||
raise ConanInvalidConfiguration("Boost.Scope requires C++11") | ||
|
||
def export_sources(self): | ||
src = os.path.join(self.recipe_folder, "..") | ||
copy(self, "LICENSE", src, self.export_sources_folder) | ||
copy(self, "include*", src, self.export_sources_folder) | ||
copy(self, "conan/1.83_compat.patch", src, self.export_sources_folder) | ||
|
||
def build(self): | ||
patch_file = os.path.join(self.source_folder, "conan/1.83_compat.patch") | ||
patch(self, patch_file=patch_file) | ||
|
||
def package(self): | ||
copy(self, "include/*", self.source_folder, self.package_folder) | ||
copy(self, "LICENSE", self.source_folder, self.package_folder) | ||
|
||
def package_id(self): | ||
self.info.clear() |