-
Notifications
You must be signed in to change notification settings - Fork 2k
cassandra-cpp-driver: add version 2.16.2, support conan v2 #14509
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
conan-center-bot
merged 9 commits into
conan-io:master
from
toge:cassandra-cpp-driver-2.16.2
Aug 19, 2023
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3da99bb
cassandra-cpp-driver: add version 2.16.2, support conan v2
toge 2eb6aad
fix library name, specify C++11
toge ffbde49
add transitive_headers=True
toge 5a4e387
update dependencies
toge 31f0373
fix compilation error on msvc
toge 2af1597
update dependencies, improve patch file
toge a8fc6b2
enable C++11, include type_traits
toge 928da4a
Merge branch 'master' into cassandra-cpp-driver-2.16.2
toge ea0030c
Merge branch 'master' into cassandra-cpp-driver-2.16.2
uilianries File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
---|---|---|
@@ -1,10 +1,34 @@ | ||
sources: | ||
"2.16.2": | ||
url: "https://github.com/datastax/cpp-driver/archive/2.16.2.tar.gz" | ||
sha256: "de60751bd575b5364c2c5a17a24a40f3058264ea2ee6fef19de126ae550febc9" | ||
"2.15.3": | ||
url: "https://github.com/datastax/cpp-driver/archive/2.15.3.zip" | ||
sha256: "494b35418f1eaa86d80572a4254b7fae88a1341dcda83788ed038ce4f39117cb" | ||
url: "https://github.com/datastax/cpp-driver/archive/2.15.3.tar.gz" | ||
sha256: "eccb53c5151621c3b647fc83781a542cfb93e76687b4178ebce418fc4c817293" | ||
patches: | ||
"2.16.2": | ||
- patch_file: "patches/2.16.2/fix-cmake.patch" | ||
patch_description: "use cci package" | ||
patch_type: "conan" | ||
- patch_file: "patches/2.15.3/fix-rapidjson.patch" | ||
patch_description: "fix include path for cci package" | ||
patch_type: "conan" | ||
- patch_file: "patches/2.15.3/fix-atomic.patch" | ||
patch_description: "add static_cast for atomic enum" | ||
patch_type: "portability" | ||
- patch_file: "patches/2.15.3/remove-attribute-for-msvc.patch" | ||
patch_description: "remove attribute for msvc" | ||
patch_type: "portability" | ||
"2.15.3": | ||
- base_path: "source_subfolder" | ||
patch_file: "patches/2.15.3/fix-cmake.patch" | ||
- base_path: "source_subfolder" | ||
patch_file: "patches/2.15.3/fix-rapidjson.patch" | ||
- patch_file: "patches/2.15.3/fix-cmake.patch" | ||
patch_description: "use cci package" | ||
patch_type: "conan" | ||
- patch_file: "patches/2.15.3/fix-rapidjson.patch" | ||
patch_description: "fix include path for cci package" | ||
patch_type: "conan" | ||
- patch_file: "patches/2.15.3/fix-atomic.patch" | ||
patch_description: "add static_cast for atomic enum" | ||
patch_type: "portability" | ||
- patch_file: "patches/2.15.3/remove-attribute-for-msvc.patch" | ||
patch_description: "remove attribute for msvc" | ||
patch_type: "portability" |
This file contains hidden or 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 | ||||
---|---|---|---|---|---|---|
@@ -1,19 +1,20 @@ | ||||||
from conans import ConanFile, CMake, tools | ||||||
from conans.errors import ConanInvalidConfiguration | ||||||
from conan import ConanFile | ||||||
from conan.errors import ConanInvalidConfiguration | ||||||
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, replace_in_file, rm | ||||||
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout | ||||||
from conan.tools.build import check_min_cppstd | ||||||
import os | ||||||
|
||||||
required_conan_version = ">=1.33.0" | ||||||
|
||||||
required_conan_version = ">=1.53.0" | ||||||
|
||||||
class CassandraCppDriverConan(ConanFile): | ||||||
name = "cassandra-cpp-driver" | ||||||
description = "DataStax C/C++ Driver for Apache Cassandra and DataStax Products" | ||||||
license = "Apache-2.0" | ||||||
url = "https://github.com/conan-io/conan-center-index" | ||||||
homepage = "https://docs.datastax.com/en/developer/cpp-driver/" | ||||||
description = "DataStax C/C++ Driver for Apache Cassandra and DataStax Products" | ||||||
topics = ("cassandra", "cpp-driver", "database", "conan-recipe") | ||||||
|
||||||
settings = "os", "compiler", "build_type", "arch" | ||||||
topics = ("cassandra", "cpp-driver", "database",) | ||||||
settings = "os", "arch", "compiler", "build_type" | ||||||
options = { | ||||||
"shared": [True, False], | ||||||
"fPIC": [True, False], | ||||||
|
@@ -34,19 +35,14 @@ class CassandraCppDriverConan(ConanFile): | |||||
"with_kerberos": False, | ||||||
"use_timerfd": True, | ||||||
} | ||||||
|
||||||
short_paths = True | ||||||
generators = "cmake" | ||||||
exports_sources = [ | ||||||
"CMakeLists.txt", | ||||||
"patches/*" | ||||||
] | ||||||
|
||||||
_cmake = None | ||||||
|
||||||
@property | ||||||
def _source_subfolder(self): | ||||||
return "source_subfolder" | ||||||
def _min_cppstd(self): | ||||||
return 11 | ||||||
|
||||||
def export_sources(self): | ||||||
export_conandata_patches(self) | ||||||
|
||||||
def config_options(self): | ||||||
if self.settings.os == "Windows": | ||||||
|
@@ -55,24 +51,30 @@ def config_options(self): | |||||
|
||||||
def configure(self): | ||||||
if self.options.shared: | ||||||
del self.options.fPIC | ||||||
self.options.rm_safe("fPIC") | ||||||
|
||||||
def layout(self): | ||||||
cmake_layout(self, src_folder="src") | ||||||
|
||||||
def requirements(self): | ||||||
self.requires("libuv/1.44.1") | ||||||
self.requires("libuv/1.44.2") | ||||||
self.requires("http_parser/2.9.4") | ||||||
self.requires("rapidjson/cci.20211112") | ||||||
self.requires("rapidjson/cci.20220822") | ||||||
|
||||||
if self.options.with_openssl: | ||||||
self.requires("openssl/1.1.1q") | ||||||
self.requires("openssl/[>=1.1 <4]") | ||||||
|
||||||
if self.options.with_zlib: | ||||||
self.requires("minizip/1.2.12") | ||||||
self.requires("zlib/1.2.12") | ||||||
self.requires("minizip/1.2.13") | ||||||
self.requires("zlib/1.2.13") | ||||||
|
||||||
if self.options.use_atomic == "boost": | ||||||
self.requires("boost/1.79.0") | ||||||
self.requires("boost/1.81.0") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Is it possible to use Boost 1.82.0, or is there a conflict? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No reason. |
||||||
|
||||||
def validate(self): | ||||||
if self.info.settings.compiler.cppstd: | ||||||
check_min_cppstd(self, self._min_cppstd) | ||||||
|
||||||
if self.options.use_atomic == "boost": | ||||||
# Compilation error on Linux | ||||||
if self.settings.os == "Linux": | ||||||
|
@@ -84,69 +86,69 @@ def validate(self): | |||||
"Kerberos is not supported at the moment") | ||||||
|
||||||
def source(self): | ||||||
tools.get(**self.conan_data["sources"][self.version], | ||||||
destination=self._source_subfolder, strip_root=True) | ||||||
|
||||||
def _patch_sources(self): | ||||||
for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||||||
tools.patch(**patch) | ||||||
tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), | ||||||
"\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\"", | ||||||
"\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"AppleClang\"") | ||||||
|
||||||
def _configure_cmake(self): | ||||||
if self._cmake: | ||||||
return self._cmake | ||||||
|
||||||
self._cmake = CMake(self) | ||||||
self._cmake.definitions["VERSION"] = self.version | ||||||
self._cmake.definitions["CASS_BUILD_EXAMPLES"] = False | ||||||
self._cmake.definitions["CASS_BUILD_INTEGRATION_TESTS"] = False | ||||||
self._cmake.definitions["CASS_BUILD_SHARED"] = self.options.shared | ||||||
self._cmake.definitions["CASS_BUILD_STATIC"] = not self.options.shared | ||||||
self._cmake.definitions["CASS_BUILD_TESTS"] = False | ||||||
self._cmake.definitions["CASS_BUILD_UNIT_TESTS"] = False | ||||||
self._cmake.definitions["CASS_DEBUG_CUSTOM_ALLOC"] = False | ||||||
self._cmake.definitions["CASS_INSTALL_HEADER_IN_SUBDIR"] = self.options.install_header_in_subdir | ||||||
self._cmake.definitions["CASS_INSTALL_PKG_CONFIG"] = False | ||||||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||||||
|
||||||
def generate(self): | ||||||
tc = CMakeToolchain(self) | ||||||
tc.variables["VERSION"] = self.version | ||||||
tc.variables["CASS_BUILD_EXAMPLES"] = False | ||||||
tc.variables["CASS_BUILD_INTEGRATION_TESTS"] = False | ||||||
tc.variables["CASS_BUILD_SHARED"] = self.options.shared | ||||||
tc.variables["CASS_BUILD_STATIC"] = not self.options.shared | ||||||
tc.variables["CASS_BUILD_TESTS"] = False | ||||||
tc.variables["CASS_BUILD_UNIT_TESTS"] = False | ||||||
tc.variables["CASS_DEBUG_CUSTOM_ALLOC"] = False | ||||||
tc.variables["CASS_INSTALL_HEADER_IN_SUBDIR"] = self.options.install_header_in_subdir | ||||||
tc.variables["CASS_INSTALL_PKG_CONFIG"] = False | ||||||
|
||||||
if self.options.use_atomic == "boost": | ||||||
self._cmake.definitions["CASS_USE_BOOST_ATOMIC"] = True | ||||||
self._cmake.definitions["CASS_USE_STD_ATOMIC"] = False | ||||||
tc.variables["CASS_USE_BOOST_ATOMIC"] = True | ||||||
tc.variables["CASS_USE_STD_ATOMIC"] = False | ||||||
|
||||||
elif self.options.use_atomic == "std": | ||||||
self._cmake.definitions["CASS_USE_BOOST_ATOMIC"] = False | ||||||
self._cmake.definitions["CASS_USE_STD_ATOMIC"] = True | ||||||
tc.variables["CASS_USE_BOOST_ATOMIC"] = False | ||||||
tc.variables["CASS_USE_STD_ATOMIC"] = True | ||||||
else: | ||||||
self._cmake.definitions["CASS_USE_BOOST_ATOMIC"] = False | ||||||
self._cmake.definitions["CASS_USE_STD_ATOMIC"] = False | ||||||
tc.variables["CASS_USE_BOOST_ATOMIC"] = False | ||||||
tc.variables["CASS_USE_STD_ATOMIC"] = False | ||||||
|
||||||
self._cmake.definitions["CASS_USE_OPENSSL"] = self.options.with_openssl | ||||||
self._cmake.definitions["CASS_USE_STATIC_LIBS"] = False | ||||||
self._cmake.definitions["CASS_USE_ZLIB"] = self.options.with_zlib | ||||||
self._cmake.definitions["CASS_USE_LIBSSH2"] = False | ||||||
tc.variables["CASS_USE_OPENSSL"] = self.options.with_openssl | ||||||
tc.variables["CASS_USE_STATIC_LIBS"] = False | ||||||
tc.variables["CASS_USE_ZLIB"] = self.options.with_zlib | ||||||
tc.variables["CASS_USE_LIBSSH2"] = False | ||||||
|
||||||
# FIXME: To use kerberos, its conan package is needed. Uncomment this when kerberos conan package is ready. | ||||||
# self._cmake.definitions["CASS_USE_KERBEROS"] = self.options.with_kerberos | ||||||
# tc.variables["CASS_USE_KERBEROS"] = self.options.with_kerberos | ||||||
|
||||||
if self.settings.os == "Linux": | ||||||
self._cmake.definitions["CASS_USE_TIMERFD"] = self.options.use_timerfd | ||||||
tc.variables["CASS_USE_TIMERFD"] = self.options.use_timerfd | ||||||
tc.generate() | ||||||
|
||||||
self._cmake.configure() | ||||||
return self._cmake | ||||||
deps = CMakeDeps(self) | ||||||
deps.generate() | ||||||
|
||||||
def _patch_sources(self): | ||||||
apply_conandata_patches(self) | ||||||
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), | ||||||
"\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\"", | ||||||
"\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"AppleClang\"") | ||||||
rm(self, "Findlibssh2.cmake", os.path.join(self.source_folder, "cmake")) | ||||||
rm(self, "Findlibuv.cmake", os.path.join(self.source_folder, "cmake")) | ||||||
rm(self, "FindOpenSSL.cmake", os.path.join(self.source_folder, "cmake")) | ||||||
|
||||||
def build(self): | ||||||
self._patch_sources() | ||||||
cmake = self._configure_cmake() | ||||||
cmake = CMake(self) | ||||||
cmake.configure() | ||||||
cmake.build() | ||||||
|
||||||
def package(self): | ||||||
self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) | ||||||
cmake = self._configure_cmake() | ||||||
copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||||||
cmake = CMake(self) | ||||||
cmake.install() | ||||||
|
||||||
def package_info(self): | ||||||
self.cpp_info.libs = tools.collect_libs(self) | ||||||
self.cpp_info.libs = ["cassandra" if self.options.shared else "cassandra_static"] | ||||||
|
||||||
if self.settings.os == "Windows": | ||||||
self.cpp_info.system_libs.extend(["iphlpapi", "psapi", "wsock32", | ||||||
|
23 changes: 23 additions & 0 deletions
23
recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-atomic.patch
This file contains hidden or 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,23 @@ | ||
diff --git a/src/atomic/atomic_std.hpp b/src/atomic/atomic_std.hpp | ||
index 2ad0103..f977bf9 100644 | ||
--- a/src/atomic/atomic_std.hpp | ||
+++ b/src/atomic/atomic_std.hpp | ||
@@ -22,12 +22,12 @@ | ||
namespace datastax { namespace internal { | ||
|
||
enum MemoryOrder { | ||
- MEMORY_ORDER_RELAXED = std::memory_order_relaxed, | ||
- MEMORY_ORDER_CONSUME = std::memory_order_consume, | ||
- MEMORY_ORDER_ACQUIRE = std::memory_order_acquire, | ||
- MEMORY_ORDER_RELEASE = std::memory_order_release, | ||
- MEMORY_ORDER_ACQ_REL = std::memory_order_acq_rel, | ||
- MEMORY_ORDER_SEQ_CST = std::memory_order_seq_cst | ||
+ MEMORY_ORDER_RELAXED = static_cast<int>(std::memory_order_relaxed), | ||
+ MEMORY_ORDER_CONSUME = static_cast<int>(std::memory_order_consume), | ||
+ MEMORY_ORDER_ACQUIRE = static_cast<int>(std::memory_order_acquire), | ||
+ MEMORY_ORDER_RELEASE = static_cast<int>(std::memory_order_release), | ||
+ MEMORY_ORDER_ACQ_REL = static_cast<int>(std::memory_order_acq_rel), | ||
+ MEMORY_ORDER_SEQ_CST = static_cast<int>(std::memory_order_seq_cst) | ||
}; | ||
|
||
template <class T> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you please use datastax/cpp-driver#533 instead?
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.
Thanks your advise!
I will update this recipe.