From 4b0ce139a0683fcb388884516638ad29b8aace6c Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 24 Jan 2023 22:17:44 +0900 Subject: [PATCH 1/3] plf_colony: add version 7.06, support apple-clang 14 --- recipes/plf_colony/all/conandata.yml | 3 +++ recipes/plf_colony/all/conanfile.py | 13 ++++++++++--- .../plf_colony/all/test_v1_package/CMakeLists.txt | 8 +++----- recipes/plf_colony/config.yml | 2 ++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/recipes/plf_colony/all/conandata.yml b/recipes/plf_colony/all/conandata.yml index 273a9af551ece..7d60e4b496f97 100644 --- a/recipes/plf_colony/all/conandata.yml +++ b/recipes/plf_colony/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "7.06": + url: "https://github.com/mattreecebentley/plf_colony/archive/348174f0da2ea65b7a561b08412e81ce1f5e6161.tar.gz" + sha256: "c6a34d08d4946f0ce54a9836b564b329afffc7ce173720282c7e2b0b57cbc484" "7.03": url: "https://github.com/mattreecebentley/plf_colony/archive/f182529ea6f125fc9cee5ca57f499284c777cecb.tar.gz" sha256: "8fa98993283a158779596f0de17217bd7ef2923fbfc116861172f4ba20f4bc81" diff --git a/recipes/plf_colony/all/conanfile.py b/recipes/plf_colony/all/conanfile.py index 85f4d597b18e9..bcab6ba01451c 100644 --- a/recipes/plf_colony/all/conanfile.py +++ b/recipes/plf_colony/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile -from conan.tools.files import copy, get +from conan.tools.files import copy, get, replace_in_file from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os required_conan_version = ">=1.50.0" @@ -11,7 +12,7 @@ class PlfcolonyConan(ConanFile): description = "An unordered data container providing fast iteration/insertion/erasure " \ "while maintaining pointer/iterator/reference validity to non-erased elements." license = "Zlib" - topics = ("plf_colony", "container", "bucket", "unordered") + topics = ("container", "bucket", "unordered", "header-only") homepage = "https://github.com/mattreecebentley/plf_colony" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" @@ -28,7 +29,13 @@ def source(self): destination=self.source_folder, strip_root=True) def build(self): - pass + # apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little + # https://www.reddit.com/r/cpp/comments/v6ydea/xcode_now_defaults_to_c20/ + if Version(self.version) >= "7.00": + replace_in_file(self, os.path.join(self.source_folder, "plf_colony.h"), + "if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__)))", + "if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && (!defined(__APPLE_CC__) && (defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__)))" + ) def package(self): copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) diff --git a/recipes/plf_colony/all/test_v1_package/CMakeLists.txt b/recipes/plf_colony/all/test_v1_package/CMakeLists.txt index 481e5ac100c65..925ecbe19e448 100644 --- a/recipes/plf_colony/all/test_v1_package/CMakeLists.txt +++ b/recipes/plf_colony/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(plf_colony REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE plf_colony::plf_colony) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/plf_colony/config.yml b/recipes/plf_colony/config.yml index 934e8ec85091c..d7dde26d155d4 100644 --- a/recipes/plf_colony/config.yml +++ b/recipes/plf_colony/config.yml @@ -1,4 +1,6 @@ versions: + "7.06": + folder: all "7.03": folder: all "7.00": From 748342373dea074addfb3cf2182a9de889cd21dd Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 24 Jan 2023 23:45:35 +0900 Subject: [PATCH 2/3] remove no_copy_source --- recipes/plf_colony/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/plf_colony/all/conanfile.py b/recipes/plf_colony/all/conanfile.py index bcab6ba01451c..3d132484bc9bc 100644 --- a/recipes/plf_colony/all/conanfile.py +++ b/recipes/plf_colony/all/conanfile.py @@ -16,7 +16,6 @@ class PlfcolonyConan(ConanFile): homepage = "https://github.com/mattreecebentley/plf_colony" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True def package_id(self): self.info.clear() From 9b0d3c6abc75aa9a96e4078ad1db0c12bf11ff54 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 25 Jan 2023 02:20:54 +0900 Subject: [PATCH 3/3] create patch files for apple-clang 14 --- recipes/plf_colony/all/conandata.yml | 13 +++++++++++++ recipes/plf_colony/all/conanfile.py | 14 +++++--------- ....00-0001-disable-cxx20-from-apple-clang14.patch | 13 +++++++++++++ ....06-0001-disable-cxx20-from-apple-clang14.patch | 13 +++++++++++++ 4 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 recipes/plf_colony/all/patches/7.00-0001-disable-cxx20-from-apple-clang14.patch create mode 100644 recipes/plf_colony/all/patches/7.06-0001-disable-cxx20-from-apple-clang14.patch diff --git a/recipes/plf_colony/all/conandata.yml b/recipes/plf_colony/all/conandata.yml index 7d60e4b496f97..7d323fe98a8c9 100644 --- a/recipes/plf_colony/all/conandata.yml +++ b/recipes/plf_colony/all/conandata.yml @@ -11,3 +11,16 @@ sources: "6.25": url: "https://github.com/mattreecebentley/plf_colony/archive/848305c2f83fbd5407e6e3fdb9c3e3e8dcfa2ea6.tar.gz" sha256: "4d298dbd9266201be9733ef276046e9a55d7f35a8c16378fc1dcb687ca8ab4ad" +patches: + "7.06": + - patch_file: "patches/7.06-0001-disable-cxx20-from-apple-clang14.patch" + patch_description: "apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little" + patch_type: "portability" + "7.03": + - patch_file: "patches/7.00-0001-disable-cxx20-from-apple-clang14.patch" + patch_description: "apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little" + patch_type: "portability" + "7.00": + - patch_file: "patches/7.00-0001-disable-cxx20-from-apple-clang14.patch" + patch_description: "apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little" + patch_type: "portability" diff --git a/recipes/plf_colony/all/conanfile.py b/recipes/plf_colony/all/conanfile.py index 3d132484bc9bc..888ed08055ad9 100644 --- a/recipes/plf_colony/all/conanfile.py +++ b/recipes/plf_colony/all/conanfile.py @@ -1,7 +1,6 @@ from conan import ConanFile -from conan.tools.files import copy, get, replace_in_file +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches from conan.tools.layout import basic_layout -from conan.tools.scm import Version import os required_conan_version = ">=1.50.0" @@ -17,6 +16,9 @@ class PlfcolonyConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" + def export_sources(self): + export_conandata_patches(self) + def package_id(self): self.info.clear() @@ -28,13 +30,7 @@ def source(self): destination=self.source_folder, strip_root=True) def build(self): - # apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little - # https://www.reddit.com/r/cpp/comments/v6ydea/xcode_now_defaults_to_c20/ - if Version(self.version) >= "7.00": - replace_in_file(self, os.path.join(self.source_folder, "plf_colony.h"), - "if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__)))", - "if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && (!defined(__APPLE_CC__) && (defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__)))" - ) + apply_conandata_patches(self) def package(self): copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) diff --git a/recipes/plf_colony/all/patches/7.00-0001-disable-cxx20-from-apple-clang14.patch b/recipes/plf_colony/all/patches/7.00-0001-disable-cxx20-from-apple-clang14.patch new file mode 100644 index 0000000000000..cba605fff0fbf --- /dev/null +++ b/recipes/plf_colony/all/patches/7.00-0001-disable-cxx20-from-apple-clang14.patch @@ -0,0 +1,13 @@ +diff --git a/plf_colony.h b/plf_colony.h +index a9911f3..c707edc 100644 +--- a/plf_colony.h ++++ b/plf_colony.h +@@ -165,7 +165,7 @@ + #define PLF_CONSTEXPR constexpr + #endif + +- #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) ++ #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((!defined(__APPLE_CC__) && defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) + #define PLF_CPP20_SUPPORT + #undef PLF_CONSTFUNC + #define PLF_CONSTFUNC constexpr diff --git a/recipes/plf_colony/all/patches/7.06-0001-disable-cxx20-from-apple-clang14.patch b/recipes/plf_colony/all/patches/7.06-0001-disable-cxx20-from-apple-clang14.patch new file mode 100644 index 0000000000000..3992b1b8c3069 --- /dev/null +++ b/recipes/plf_colony/all/patches/7.06-0001-disable-cxx20-from-apple-clang14.patch @@ -0,0 +1,13 @@ +diff --git a/plf_colony.h b/plf_colony.h +index e789331..2e2005b 100644 +--- a/plf_colony.h ++++ b/plf_colony.h +@@ -176,7 +176,7 @@ + #define PLF_CONSTEXPR constexpr + #endif + +- #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) ++ #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((!defined(__APPLE_CC__) && defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) + #define PLF_CPP20_SUPPORT + #undef PLF_CONSTFUNC + #define PLF_CONSTFUNC constexpr