From 2ec819600679951e06d81fac26754bac9c10ed50 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 17 Jul 2021 10:57:08 +0200 Subject: [PATCH 01/13] add shared option --- recipes/abseil/all/conanfile.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index 770bb400c5e0b..6972e5abe8d0b 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -22,8 +22,14 @@ class ConanRecipe(ConanFile): short_paths = True settings = "os", "arch", "compiler", "build_type" - options = {"fPIC": [True, False]} - default_options = {"fPIC": True} + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } _cmake = None @@ -35,6 +41,10 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def configure(self): + if self.options.shared: + del self.options.fPIC + def configure(self): if self.settings.compiler.cppstd: tools.check_min_cppstd(self, 11) From 2f070cb1c901ce9558695fbc1373e1c71171920b Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 17 Jul 2021 11:00:13 +0200 Subject: [PATCH 02/13] system libs for FreeBSD and iOS/tvOS/watchOS --- recipes/abseil/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index 6972e5abe8d0b..39bbfa58cb293 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -110,7 +110,7 @@ def _create_components_file_from_cmake_target_file(self, absl_target_file_path): if dependency.startswith("absl::"): # abseil targets components[potential_lib_name].setdefault("requires", []).append(dependency.replace("absl::", "absl_")) else: # system libs or frameworks - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: if dependency == "Threads::Threads": components[potential_lib_name].setdefault("system_libs", []).append("pthread") elif "-lrt" in dependency: @@ -119,7 +119,7 @@ def _create_components_file_from_cmake_target_file(self, absl_target_file_path): for system_lib in ["bcrypt", "advapi32", "dbghelp"]: if system_lib in dependency: components[potential_lib_name].setdefault("system_libs", []).append(system_lib) - elif self.settings.os == "Macos": + elif tools.is_apple_os(self.settings.os): for framework in ["CoreFoundation"]: if framework in dependency: components[potential_lib_name].setdefault("frameworks", []).append(framework) From 85bff757d294a7cfc5587629a84e5353cf32fa2e Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 17 Jul 2021 11:04:27 +0200 Subject: [PATCH 03/13] move checks to validate() --- recipes/abseil/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index 39bbfa58cb293..8d3447aadbb61 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -45,7 +45,7 @@ def configure(self): if self.options.shared: del self.options.fPIC - def configure(self): + def validate(self): if self.settings.compiler.cppstd: tools.check_min_cppstd(self, 11) From 0ef60dfa447340230b9f4dfedf258cb2cb4295c6 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 17 Jul 2021 12:47:56 +0200 Subject: [PATCH 04/13] stop maintenance of unofficial version 20200205 --- recipes/abseil/all/conandata.yml | 6 ------ recipes/abseil/config.yml | 2 -- 2 files changed, 8 deletions(-) diff --git a/recipes/abseil/all/conandata.yml b/recipes/abseil/all/conandata.yml index 7ee36595dbdd9..8a57bbeabf5cb 100644 --- a/recipes/abseil/all/conandata.yml +++ b/recipes/abseil/all/conandata.yml @@ -1,7 +1,4 @@ sources: - "20200205": - sha256: 3c554df4909c5c55a6d251f6eadc2c78ff20db5ad4471fd9cbf8085c51b76797 - url: https://github.com/abseil/abseil-cpp/archive/08a7e7bf972c8451855a5022f2faf3d3655db015.tar.gz "20200225.2": url: "https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz" sha256: "f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111" @@ -30,9 +27,6 @@ sources: url: "https://github.com/abseil/abseil-cpp/archive/20210324.2.tar.gz" sha256: "59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f" patches: - "20200205": - - patch_file: "patches/cmake-install.patch" - base_path: "source_subfolder" "20200225.2": - patch_file: "patches/cmake-install.patch" base_path: "source_subfolder" diff --git a/recipes/abseil/config.yml b/recipes/abseil/config.yml index c13c83cdb564b..f22c1f45b86fc 100644 --- a/recipes/abseil/config.yml +++ b/recipes/abseil/config.yml @@ -1,6 +1,4 @@ versions: - "20200205": - folder: all "20200225.2": folder: all "20200225.3": From e90f361a87750e4ad611ba0d1771d8585f51e64b Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 17 Jul 2021 12:53:14 +0200 Subject: [PATCH 05/13] fix abseil_dll component for windows shared build --- recipes/abseil/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index 8d3447aadbb61..92bcb8e676508 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -99,7 +99,7 @@ def _create_components_file_from_cmake_target_file(self, absl_target_file_path): if cmake_function_name == "add_library": cmake_imported_target_type = cmake_function_args[1] if cmake_imported_target_type in ["STATIC", "SHARED"]: - components[potential_lib_name]["libs"] = [potential_lib_name] + components[potential_lib_name]["libs"] = [potential_lib_name] if cmake_target_nonamespace != "abseil_dll" else [] elif cmake_function_name == "set_target_properties": target_properties = re.findall(r"(?PINTERFACE_COMPILE_DEFINITIONS|INTERFACE_INCLUDE_DIRECTORIES|INTERFACE_LINK_LIBRARIES)[\n|\s]+(?P.+)", cmake_function_args[2]) for target_property in target_properties: From 66f6bfa327a7b3c320edf667f231122ed8381d42 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 23 Oct 2021 21:30:58 +0200 Subject: [PATCH 06/13] stop maintenance of unofficial version 20200205 --- recipes/abseil/all/conandata.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/recipes/abseil/all/conandata.yml b/recipes/abseil/all/conandata.yml index c597d3d0192bb..ba10ca683c283 100644 --- a/recipes/abseil/all/conandata.yml +++ b/recipes/abseil/all/conandata.yml @@ -26,9 +26,6 @@ sources: "20200225.2": url: "https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz" sha256: "f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111" - "20200205": - url: "https://github.com/abseil/abseil-cpp/archive/08a7e7bf972c8451855a5022f2faf3d3655db015.tar.gz" - sha256: "3c554df4909c5c55a6d251f6eadc2c78ff20db5ad4471fd9cbf8085c51b76797" patches: "20200923.2": - patch_file: "patches/20200205-missing-numeric_limits.h.patch" @@ -49,8 +46,3 @@ patches: base_path: "source_subfolder" - patch_file: "patches/20200205-missing-numeric_limits.h.patch" base_path: "source_subfolder" - "20200205": - - patch_file: "patches/20200205-cmake-install.patch" - base_path: "source_subfolder" - - patch_file: "patches/20200205-missing-numeric_limits.h.patch" - base_path: "source_subfolder" From 4a0129cc64c7bf0a489e8255579fee2b25dd606b Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 23 Oct 2021 21:33:04 +0200 Subject: [PATCH 07/13] finer grained export of patches --- recipes/abseil/all/conanfile.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index 0a82b527bcbed..c91ae1b5ece38 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -8,19 +8,12 @@ class ConanRecipe(ConanFile): name = "abseil" - description = "Abseil Common Libraries (C++) from Google" topics = ("algorithm", "container", "google", "common", "utility") - homepage = "https://github.com/abseil/abseil-cpp" url = "https://github.com/conan-io/conan-center-index" - license = "Apache-2.0" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - short_paths = True - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,8 +24,15 @@ class ConanRecipe(ConanFile): "fPIC": True, } + short_paths = True + generators = "cmake" _cmake = None + def export_sources(self): + self.copy("CMakeLists.txt") + for patch in self.conan_data.get("patches", {}).get(self.version, []): + self.copy(patch["patch_file"]) + @property def _source_subfolder(self): return "source_subfolder" From 63ac68e0b23ccc7a2795490c0879fca84181f2af Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 23 Jan 2022 22:05:03 +0100 Subject: [PATCH 08/13] drop 20200205 in config.yml as well --- recipes/abseil/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/abseil/config.yml b/recipes/abseil/config.yml index 617e80f886174..1524d08523e05 100644 --- a/recipes/abseil/config.yml +++ b/recipes/abseil/config.yml @@ -19,5 +19,3 @@ versions: folder: all "20200225.2": folder: all - "20200205": - folder: all From 3c86b1203206b832776b01c7b85fdaa3d9e59347 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 23 Jan 2022 22:12:39 +0100 Subject: [PATCH 09/13] modernize --- recipes/abseil/all/CMakeLists.txt | 4 ++ recipes/abseil/all/conanfile.py | 55 ++++++++++--------- .../abseil/all/test_package/CMakeLists.txt | 4 +- recipes/abseil/all/test_package/conanfile.py | 5 +- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/recipes/abseil/all/CMakeLists.txt b/recipes/abseil/all/CMakeLists.txt index 03fdb0b1843a0..c165188ca17e8 100644 --- a/recipes/abseil/all/CMakeLists.txt +++ b/recipes/abseil/all/CMakeLists.txt @@ -8,4 +8,8 @@ if(MSVC) add_definitions("-D_HAS_DEPRECATED_RESULT_OF") endif() +if(NOT CMAKE_SYSTEM_PROCESSOR) + set(CMAKE_SYSTEM_PROCESSOR ${CONAN_ABSEIL_SYSTEM_PROCESSOR}) +endif() + add_subdirectory(source_subfolder) diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index 790272383e5c9..5a5a47daec463 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -3,10 +3,10 @@ import os import re -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.43.0" -class ConanRecipe(ConanFile): +class AbseilRecipe(ConanFile): name = "abseil" description = "Abseil Common Libraries (C++) from Google" topics = ("algorithm", "container", "google", "common", "utility") @@ -28,15 +28,19 @@ class ConanRecipe(ConanFile): generators = "cmake" _cmake = None + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _is_msvc(self): + return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def export_sources(self): self.copy("CMakeLists.txt") for patch in self.conan_data.get("patches", {}).get(self.version, []): self.copy(patch["patch_file"]) - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -62,7 +66,7 @@ def _configure_cmake(self): self._cmake.definitions["ABSL_ENABLE_INSTALL"] = True self._cmake.definitions["BUILD_TESTING"] = False if tools.cross_building(self): - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = str(self.settings.arch) + self._cmake.definitions["CONAN_ABSEIL_SYSTEM_PROCESSOR"] = str(self.settings.arch) self._cmake.configure() return self._cmake @@ -169,23 +173,24 @@ def _components_helper_filepath(self): return os.path.join(self.package_folder, "lib", "components.json") def package_info(self): + self.cpp_info.set_property("cmake_file_name", "absl") + + components_json_file = tools.load(self._components_helper_filepath) + abseil_components = json.loads(components_json_file) + for pkgconfig_name, values in abseil_components.items(): + cmake_target = values["cmake_target"] + self.cpp_info.components[pkgconfig_name].set_property("cmake_target_name", "absl::{}".format(cmake_target)) + self.cpp_info.components[pkgconfig_name].set_property("pkg_config_name", pkgconfig_name) + self.cpp_info.components[pkgconfig_name].libs = values.get("libs", []) + self.cpp_info.components[pkgconfig_name].defines = values.get("defines", []) + self.cpp_info.components[pkgconfig_name].system_libs = values.get("system_libs", []) + self.cpp_info.components[pkgconfig_name].frameworks = values.get("frameworks", []) + self.cpp_info.components[pkgconfig_name].requires = values.get("requires", []) + if self._is_msvc and self.settings.compiler.get_safe("cppstd") == "20": + self.cpp_info.components[pkgconfig_name].defines.extend(["_HAS_DEPRECATED_RESULT_OF", "_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING"]) + + self.cpp_info.components[pkgconfig_name].names["cmake_find_package"] = cmake_target + self.cpp_info.components[pkgconfig_name].names["cmake_find_package_multi"] = cmake_target + self.cpp_info.names["cmake_find_package"] = "absl" self.cpp_info.names["cmake_find_package_multi"] = "absl" - - def _register_components(): - components_json_file = tools.load(self._components_helper_filepath) - abseil_components = json.loads(components_json_file) - for pkgconfig_name, values in abseil_components.items(): - cmake_target = values["cmake_target"] - self.cpp_info.components[pkgconfig_name].names["cmake_find_package"] = cmake_target - self.cpp_info.components[pkgconfig_name].names["cmake_find_package_multi"] = cmake_target - self.cpp_info.components[pkgconfig_name].names["pkg_config"] = pkgconfig_name - self.cpp_info.components[pkgconfig_name].libs = values.get("libs", []) - self.cpp_info.components[pkgconfig_name].defines = values.get("defines", []) - self.cpp_info.components[pkgconfig_name].system_libs = values.get("system_libs", []) - self.cpp_info.components[pkgconfig_name].frameworks = values.get("frameworks", []) - self.cpp_info.components[pkgconfig_name].requires = values.get("requires", []) - if self.settings.compiler == "Visual Studio" and self.settings.get_safe("compiler.cppstd") == "20": - self.cpp_info.components[pkgconfig_name].defines.extend(["_HAS_DEPRECATED_RESULT_OF", "_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING"]) - - _register_components() diff --git a/recipes/abseil/all/test_package/CMakeLists.txt b/recipes/abseil/all/test_package/CMakeLists.txt index 70141238e3d24..f051b68e83829 100644 --- a/recipes/abseil/all/test_package/CMakeLists.txt +++ b/recipes/abseil/all/test_package/CMakeLists.txt @@ -1,11 +1,11 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.8) project(test_package CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) # Test components -find_package(absl REQUIRED) +find_package(absl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} absl::strings absl::flat_hash_map absl::flat_hash_set absl::int128 absl::time) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/abseil/all/test_package/conanfile.py b/recipes/abseil/all/test_package/conanfile.py index 517a673f756cc..00b2c11fd6381 100644 --- a/recipes/abseil/all/test_package/conanfile.py +++ b/recipes/abseil/all/test_package/conanfile.py @@ -1,9 +1,10 @@ from conans import ConanFile, CMake, tools import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) From 8205af4da60312e549155482cb0f026f7f9df4d4 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 23 Jan 2022 23:35:31 +0100 Subject: [PATCH 10/13] absl-string may link to libm --- recipes/abseil/all/conandata.yml | 39 +++++++++++++++---- recipes/abseil/all/conanfile.py | 2 + ...install.patch => 0001-cmake-install.patch} | 0 ...ch => 0002-missing-numeric_limits.h.patch} | 0 .../all/patches/0003-absl-string-libm.patch | 15 +++++++ 5 files changed, 49 insertions(+), 7 deletions(-) rename recipes/abseil/all/patches/{20200205-cmake-install.patch => 0001-cmake-install.patch} (100%) rename recipes/abseil/all/patches/{20200205-missing-numeric_limits.h.patch => 0002-missing-numeric_limits.h.patch} (100%) create mode 100644 recipes/abseil/all/patches/0003-absl-string-libm.patch diff --git a/recipes/abseil/all/conandata.yml b/recipes/abseil/all/conandata.yml index 448f2addc0272..c4a7a95ec91d0 100644 --- a/recipes/abseil/all/conandata.yml +++ b/recipes/abseil/all/conandata.yml @@ -30,22 +30,47 @@ sources: url: "https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz" sha256: "f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111" patches: + "20211102.0": + - patch_file: "patches/0003-absl-string-libm.patch" + base_path: "source_subfolder" + "20210324.2": + - patch_file: "patches/0003-absl-string-libm.patch" + base_path: "source_subfolder" + "20210324.1": + - patch_file: "patches/0003-absl-string-libm.patch" + base_path: "source_subfolder" + "20210324.0": + - patch_file: "patches/0003-absl-string-libm.patch" + base_path: "source_subfolder" + "20200923.3": + - patch_file: "patches/0003-absl-string-libm.patch" + base_path: "source_subfolder" "20200923.2": - - patch_file: "patches/20200205-missing-numeric_limits.h.patch" + - patch_file: "patches/0002-missing-numeric_limits.h.patch" + base_path: "source_subfolder" + - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" "20200923.1": - - patch_file: "patches/20200205-missing-numeric_limits.h.patch" + - patch_file: "patches/0002-missing-numeric_limits.h.patch" + base_path: "source_subfolder" + - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" "20200923": - - patch_file: "patches/20200205-missing-numeric_limits.h.patch" + - patch_file: "patches/0002-missing-numeric_limits.h.patch" + base_path: "source_subfolder" + - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" "20200225.3": - - patch_file: "patches/20200205-cmake-install.patch" + - patch_file: "patches/0001-cmake-install.patch" + base_path: "source_subfolder" + - patch_file: "patches/0002-missing-numeric_limits.h.patch" base_path: "source_subfolder" - - patch_file: "patches/20200205-missing-numeric_limits.h.patch" + - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" "20200225.2": - - patch_file: "patches/20200205-cmake-install.patch" + - patch_file: "patches/0001-cmake-install.patch" + base_path: "source_subfolder" + - patch_file: "patches/0002-missing-numeric_limits.h.patch" base_path: "source_subfolder" - - patch_file: "patches/20200205-missing-numeric_limits.h.patch" + - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index 5a5a47daec463..daa68f298a5a1 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -149,6 +149,8 @@ def _create_components_file_from_cmake_target_file(self, absl_target_file_path): if self.settings.os in ["Linux", "FreeBSD"]: if dependency == "Threads::Threads": components[potential_lib_name].setdefault("system_libs", []).append("pthread") + elif "-lm" in dependency: + components[potential_lib_name].setdefault("system_libs", []).append("m") elif "-lrt" in dependency: components[potential_lib_name].setdefault("system_libs", []).append("rt") elif self.settings.os == "Windows": diff --git a/recipes/abseil/all/patches/20200205-cmake-install.patch b/recipes/abseil/all/patches/0001-cmake-install.patch similarity index 100% rename from recipes/abseil/all/patches/20200205-cmake-install.patch rename to recipes/abseil/all/patches/0001-cmake-install.patch diff --git a/recipes/abseil/all/patches/20200205-missing-numeric_limits.h.patch b/recipes/abseil/all/patches/0002-missing-numeric_limits.h.patch similarity index 100% rename from recipes/abseil/all/patches/20200205-missing-numeric_limits.h.patch rename to recipes/abseil/all/patches/0002-missing-numeric_limits.h.patch diff --git a/recipes/abseil/all/patches/0003-absl-string-libm.patch b/recipes/abseil/all/patches/0003-absl-string-libm.patch new file mode 100644 index 0000000000000..8c69d423c871f --- /dev/null +++ b/recipes/abseil/all/patches/0003-absl-string-libm.patch @@ -0,0 +1,15 @@ +--- a/absl/strings/CMakeLists.txt ++++ b/absl/strings/CMakeLists.txt +@@ -14,9 +14,12 @@ + # limitations under the License. + # + ++find_library(LIBM m) + absl_cc_library( + NAME + strings ++ LINKOPTS ++ $<$:-lm> + HDRS + "ascii.h" + "charconv.h" From 666ff47d9428ffbd209303dc08ca243277755564 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 23 Jan 2022 23:38:24 +0100 Subject: [PATCH 11/13] drop maintenance of several patch versions keep last patch of each "major" version --- recipes/abseil/all/conandata.yml | 46 -------------------------------- recipes/abseil/config.yml | 12 --------- 2 files changed, 58 deletions(-) diff --git a/recipes/abseil/all/conandata.yml b/recipes/abseil/all/conandata.yml index c4a7a95ec91d0..cb672f4ca4a73 100644 --- a/recipes/abseil/all/conandata.yml +++ b/recipes/abseil/all/conandata.yml @@ -5,30 +5,12 @@ sources: "20210324.2": url: "https://github.com/abseil/abseil-cpp/archive/20210324.2.tar.gz" sha256: "59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f" - "20210324.1": - url: "https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.1.tar.gz" - sha256: "441db7c09a0565376ecacf0085b2d4c2bbedde6115d7773551bc116212c2a8d6" - "20210324.0": - url: "https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.0.tar.gz" - sha256: "dd7db6815204c2a62a2160e32c55e97113b0a0178b2f090d6bab5ce36111db4b" "20200923.3": url: "https://github.com/abseil/abseil-cpp/archive/20200923.3.tar.gz" sha256: "ebe2ad1480d27383e4bf4211e2ca2ef312d5e6a09eba869fd2e8a5c5d553ded2" - "20200923.2": - url: "https://github.com/abseil/abseil-cpp/archive/20200923.2.tar.gz" - sha256: "bf3f13b13a0095d926b25640e060f7e13881bd8a792705dd9e161f3c2b9aa976" - "20200923.1": - url: "https://github.com/abseil/abseil-cpp/archive/20200923.1.tar.gz" - sha256: "808350c4d7238315717749bab0067a1acd208023d41eaf0c7360f29cc8bc8f21" - "20200923": - url: "https://github.com/abseil/abseil-cpp/archive/20200923.tar.gz" - sha256: "b3744a4f7a249d5eaf2309daad597631ce77ea62e0fc6abffbab4b4c3dc0fc08" "20200225.3": url: "https://github.com/abseil/abseil-cpp/archive/20200225.3.tar.gz" sha256: "66d4d009050f39c104b03f79bdca9d930c4964016f74bf24867a43fbdbd00d23" - "20200225.2": - url: "https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz" - sha256: "f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111" patches: "20211102.0": - patch_file: "patches/0003-absl-string-libm.patch" @@ -36,30 +18,9 @@ patches: "20210324.2": - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" - "20210324.1": - - patch_file: "patches/0003-absl-string-libm.patch" - base_path: "source_subfolder" - "20210324.0": - - patch_file: "patches/0003-absl-string-libm.patch" - base_path: "source_subfolder" "20200923.3": - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" - "20200923.2": - - patch_file: "patches/0002-missing-numeric_limits.h.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-absl-string-libm.patch" - base_path: "source_subfolder" - "20200923.1": - - patch_file: "patches/0002-missing-numeric_limits.h.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-absl-string-libm.patch" - base_path: "source_subfolder" - "20200923": - - patch_file: "patches/0002-missing-numeric_limits.h.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-absl-string-libm.patch" - base_path: "source_subfolder" "20200225.3": - patch_file: "patches/0001-cmake-install.patch" base_path: "source_subfolder" @@ -67,10 +28,3 @@ patches: base_path: "source_subfolder" - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" - "20200225.2": - - patch_file: "patches/0001-cmake-install.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-missing-numeric_limits.h.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-absl-string-libm.patch" - base_path: "source_subfolder" diff --git a/recipes/abseil/config.yml b/recipes/abseil/config.yml index 1524d08523e05..5ff0645f7c4f5 100644 --- a/recipes/abseil/config.yml +++ b/recipes/abseil/config.yml @@ -3,19 +3,7 @@ versions: folder: all "20210324.2": folder: all - "20210324.1": - folder: all - "20210324.0": - folder: all "20200923.3": folder: all - "20200923.2": - folder: all - "20200923.1": - folder: all - "20200923": - folder: all "20200225.3": folder: all - "20200225.2": - folder: all From e5c4fb05b424e0f4c7280a8bfab956c83b5089ae Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 23 Jan 2022 23:51:00 +0100 Subject: [PATCH 12/13] drop shared with msvc for the moment --- recipes/abseil/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index daa68f298a5a1..e38ccbbdb2c6b 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration import json import os import re @@ -52,6 +53,9 @@ def configure(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, 11) + if self.options.shared and self._is_msvc: + # upstream tries its best to export symbols, but it's broken for the moment + raise ConanInvalidConfiguration("abseil shared not availabe for Visual Studio (yet)") def source(self): tools.get(**self.conan_data["sources"][self.version], From f336e83cdf870bf1563cd5cd4c14afa10878e2c0 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Jan 2022 03:11:03 +0100 Subject: [PATCH 13/13] ensure C++ standard consistency revert https://github.com/conan-io/conan-center-index/pull/7443 it's almost impossible to predict if those headers are available. abseil has a mechanism to detect these headers, trust it. Since we are trying very hard to inject at build time the default C++ standard of the compiler or the one given in profile, it should be fine. --- recipes/abseil/all/CMakeLists.txt | 2 +- recipes/abseil/all/conandata.yml | 6 ++++ recipes/abseil/all/conanfile.py | 35 ++----------------- .../patches/0004-cpp-standard-20200225.patch | 15 ++++++++ .../patches/0004-cpp-standard-20200923.patch | 15 ++++++++ .../patches/0004-cpp-standard-20210324.patch | 15 ++++++++ 6 files changed, 54 insertions(+), 34 deletions(-) create mode 100644 recipes/abseil/all/patches/0004-cpp-standard-20200225.patch create mode 100644 recipes/abseil/all/patches/0004-cpp-standard-20200923.patch create mode 100644 recipes/abseil/all/patches/0004-cpp-standard-20210324.patch diff --git a/recipes/abseil/all/CMakeLists.txt b/recipes/abseil/all/CMakeLists.txt index c165188ca17e8..dcb8b54e025d5 100644 --- a/recipes/abseil/all/CMakeLists.txt +++ b/recipes/abseil/all/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.8) project(cmake_wrapper) include(conanbuildinfo.cmake) diff --git a/recipes/abseil/all/conandata.yml b/recipes/abseil/all/conandata.yml index cb672f4ca4a73..1518f93711da7 100644 --- a/recipes/abseil/all/conandata.yml +++ b/recipes/abseil/all/conandata.yml @@ -18,9 +18,13 @@ patches: "20210324.2": - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" + - patch_file: "patches/0004-cpp-standard-20210324.patch" + base_path: "source_subfolder" "20200923.3": - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" + - patch_file: "patches/0004-cpp-standard-20200923.patch" + base_path: "source_subfolder" "20200225.3": - patch_file: "patches/0001-cmake-install.patch" base_path: "source_subfolder" @@ -28,3 +32,5 @@ patches: base_path: "source_subfolder" - patch_file: "patches/0003-absl-string-libm.patch" base_path: "source_subfolder" + - patch_file: "patches/0004-cpp-standard-20200225.patch" + base_path: "source_subfolder" diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index e38ccbbdb2c6b..75e74934bdf59 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -7,7 +7,7 @@ required_conan_version = ">=1.43.0" -class AbseilRecipe(ConanFile): +class AbseilConan(ConanFile): name = "abseil" description = "Abseil Common Libraries (C++) from Google" topics = ("algorithm", "container", "google", "common", "utility") @@ -65,48 +65,17 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) - if not tools.valid_min_cppstd(self, 11): - self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 self._cmake.definitions["ABSL_ENABLE_INSTALL"] = True + self._cmake.definitions["ABSL_PROPAGATE_CXX_STD"] = True self._cmake.definitions["BUILD_TESTING"] = False if tools.cross_building(self): self._cmake.definitions["CONAN_ABSEIL_SYSTEM_PROCESSOR"] = str(self.settings.arch) self._cmake.configure() return self._cmake - @property - def _abseil_abi_macros(self): - return [ - "ABSL_OPTION_USE_STD_ANY", - "ABSL_OPTION_USE_STD_OPTIONAL", - "ABSL_OPTION_USE_STD_STRING_VIEW", - "ABSL_OPTION_USE_STD_VARIANT", - ] - - def _abseil_abi_config(self): - """Determine the Abseil ABI for polyfills (absl::any, absl::optional, absl::string_view, and absl::variant)""" - if self.settings.compiler.get_safe("cppstd"): - if self.settings.compiler.get_safe("cppstd") >= "17": - return "1" - return "0" - # As-of 2021-09-27 only GCC-11 defaults to C++17. - if ( - self.settings.compiler == "gcc" - and tools.Version(self.settings.compiler.version) >= "11" - ): - return "1" - return "0" - def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) - absl_option = self._abseil_abi_config() - for macro in self._abseil_abi_macros: - tools.replace_in_file( - os.path.join(self._source_subfolder, "absl", "base", "options.h"), - "#define {} 2".format(macro), - "#define {} {}".format(macro, absl_option), - ) cmake = self._configure_cmake() cmake.build() diff --git a/recipes/abseil/all/patches/0004-cpp-standard-20200225.patch b/recipes/abseil/all/patches/0004-cpp-standard-20200225.patch new file mode 100644 index 0000000000000..00042089d1476 --- /dev/null +++ b/recipes/abseil/all/patches/0004-cpp-standard-20200225.patch @@ -0,0 +1,15 @@ +--- a/CMake/AbseilHelpers.cmake ++++ b/CMake/AbseilHelpers.cmake +@@ -204,8 +204,12 @@ function(absl_cc_library) + endif() + + # INTERFACE libraries can't have the CXX_STANDARD property set ++ if(ABSL_PROPAGATE_CXX_STD) ++ target_compile_features(${_NAME} PUBLIC cxx_std_11) ++ else() + set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD ${ABSL_CXX_STANDARD}) + set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) ++ endif() + + # When being installed, we lose the absl_ prefix. We want to put it back + # to have properly named lib files. This is a no-op when we are not being diff --git a/recipes/abseil/all/patches/0004-cpp-standard-20200923.patch b/recipes/abseil/all/patches/0004-cpp-standard-20200923.patch new file mode 100644 index 0000000000000..cabbdbc8eaa57 --- /dev/null +++ b/recipes/abseil/all/patches/0004-cpp-standard-20200923.patch @@ -0,0 +1,15 @@ +--- a/CMake/AbseilHelpers.cmake ++++ b/CMake/AbseilHelpers.cmake +@@ -206,8 +206,12 @@ function(absl_cc_library) + endif() + + # INTERFACE libraries can't have the CXX_STANDARD property set ++ if(ABSL_PROPAGATE_CXX_STD) ++ target_compile_features(${_NAME} PUBLIC cxx_std_11) ++ else() + set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD ${ABSL_CXX_STANDARD}) + set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) ++ endif() + + # When being installed, we lose the absl_ prefix. We want to put it back + # to have properly named lib files. This is a no-op when we are not being diff --git a/recipes/abseil/all/patches/0004-cpp-standard-20210324.patch b/recipes/abseil/all/patches/0004-cpp-standard-20210324.patch new file mode 100644 index 0000000000000..fab934c4ee8b8 --- /dev/null +++ b/recipes/abseil/all/patches/0004-cpp-standard-20210324.patch @@ -0,0 +1,15 @@ +--- a/CMake/AbseilHelpers.cmake ++++ b/CMake/AbseilHelpers.cmake +@@ -254,8 +254,12 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n") + endif() + + # INTERFACE libraries can't have the CXX_STANDARD property set ++ if(ABSL_PROPAGATE_CXX_STD) ++ target_compile_features(${_NAME} PUBLIC cxx_std_11) ++ else() + set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD ${ABSL_CXX_STANDARD}) + set_property(TARGET ${_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) ++ endif() + + # When being installed, we lose the absl_ prefix. We want to put it back + # to have properly named lib files. This is a no-op when we are not being