From b1bfcc051969d635ac42a1b4a1e5e2d673cc3e23 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 17 Oct 2022 04:44:59 +0900 Subject: [PATCH 001/300] (#13528) minizip-ng: add version 3.0.7 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/minizip-ng/all/conandata.yml | 3 +++ recipes/minizip-ng/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/minizip-ng/all/conandata.yml b/recipes/minizip-ng/all/conandata.yml index 8f3820f91e16df..1cfd7b09340434 100644 --- a/recipes/minizip-ng/all/conandata.yml +++ b/recipes/minizip-ng/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.0.7": + url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.7.tar.gz" + sha256: "39981a0db1bb6da504909bce63d7493286c5e50825c056564544c990d15c55cf" "3.0.6": url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.6.tar.gz" sha256: "383fa1bdc28c482828a8a8db53f758dbd44291b641182724fda5df5b59cce543" diff --git a/recipes/minizip-ng/config.yml b/recipes/minizip-ng/config.yml index ab9b917838ae4d..60ae0e8c451f87 100644 --- a/recipes/minizip-ng/config.yml +++ b/recipes/minizip-ng/config.yml @@ -1,4 +1,6 @@ versions: + "3.0.7": + folder: all "3.0.6": folder: all "3.0.5": From db07471762a97a4bb778145061ff534034d05777 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 17 Oct 2022 10:24:32 +0900 Subject: [PATCH 002/300] (#13486) sole: add version 1.0.4 and support conan v2 * sole: add version 1.0.4 and support conan v2 * apply review --- recipes/sole/all/conandata.yml | 10 ++++ recipes/sole/all/conanfile.py | 57 ++++++++++++------- .../patches/1.0.4-0001-fix-clang-error.patch | 30 ++++++++++ recipes/sole/config.yml | 2 + 4 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 recipes/sole/all/patches/1.0.4-0001-fix-clang-error.patch diff --git a/recipes/sole/all/conandata.yml b/recipes/sole/all/conandata.yml index d08464479020ed..865e82c642edb5 100644 --- a/recipes/sole/all/conandata.yml +++ b/recipes/sole/all/conandata.yml @@ -1,7 +1,17 @@ sources: + "1.0.4": + url: "https://github.com/r-lyeh-archived/sole/archive/1.0.4.tar.gz" + sha256: "2801bd0d275903bfa1086901eb887cfde844bafe5beea6c2a57f28de4e0540cc" "1.0.2": url: "https://github.com/r-lyeh-archived/sole/archive/1.0.2.tar.gz" sha256: "ff82a1d6071cbc9c709864266210ddedecdb2b1e507ac5e7c4290ca6453e89b3" "1.0.1": sha256: 6b65a36df01b10079716288af530642cbe49abb2805ded1984c6564f471296bf url: https://github.com/r-lyeh-archived/sole/archive/refs/tags/1.0.1.tar.gz + +patches: + "1.0.4": + - patch_file: "patches/1.0.4-0001-fix-clang-error.patch" + patch_description: "fix compilation error on clang/apple-clang" + patch_type: "backport" + patch_source: "https://github.com/r-lyeh-archived/sole/issues/42" diff --git a/recipes/sole/all/conanfile.py b/recipes/sole/all/conanfile.py index 2c2c0d5498daba..e15d1c06c6dc19 100644 --- a/recipes/sole/all/conanfile.py +++ b/recipes/sole/all/conanfile.py @@ -1,39 +1,54 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout + import os +required_conan_version = ">=1.52.0" class SoleConan(ConanFile): name = "sole" - homepage = "https://github.com/r-lyeh-archived/sole" description = "Sole is a lightweight C++11 library to generate universally unique identificators (UUID), both v1 and v4." - topics = ("conan", "uuid", "header-only") - url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler" - no_copy_source = True license = "Zlib" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/r-lyeh-archived/sole" + topics = ("uuid", "header-only") + settings = "os", "arch", "compiler", "build_type" + + def export_sources(self): + export_conandata_patches(self) - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") - def configure(self): + def package_id(self): + self.info.clear() + + def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_name = "sole-" + self.version - os.rename(extracted_name, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + apply_conandata_patches(self) def package(self): - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", - src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs.append("rt") - - def package_id(self): - self.info.header_only() diff --git a/recipes/sole/all/patches/1.0.4-0001-fix-clang-error.patch b/recipes/sole/all/patches/1.0.4-0001-fix-clang-error.patch new file mode 100644 index 00000000000000..8e11dd3c1348b4 --- /dev/null +++ b/recipes/sole/all/patches/1.0.4-0001-fix-clang-error.patch @@ -0,0 +1,30 @@ +diff --git a/sole.hpp b/sole.hpp +index 8673774..35f2524 100644 +--- a/sole.hpp ++++ b/sole.hpp +@@ -201,6 +201,14 @@ namespace std { + # define $msvc $yes + #endif + ++#ifdef _MSC_VER ++# define $thread __declspec(thread) ++#elif defined __clang__ ++# define $thread thread_local ++#else ++# define $thread __thread ++#endif ++ + #if defined(__GNUC__) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 < 50100) + namespace std + { +@@ -665,8 +673,8 @@ namespace sole { + // UUID implementations + + inline uuid uuid4() { +- static $msvc(__declspec(thread)) $melse(__thread) std::random_device rd; +- static $msvc(__declspec(thread)) $melse(__thread) std::uniform_int_distribution dist(0, (uint64_t)(~0)); ++ static $thread std::random_device rd; ++ static $thread std::uniform_int_distribution dist(0, (uint64_t)(~0)); + + uuid my; + diff --git a/recipes/sole/config.yml b/recipes/sole/config.yml index 58d16eae7aa8ff..c97d810195d0fc 100644 --- a/recipes/sole/config.yml +++ b/recipes/sole/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.4": + folder: all "1.0.2": folder: all "1.0.1": From fbd4d02337b175826f861a3cf4a12b4d5dfe1484 Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Mon, 17 Oct 2022 10:26:07 +0300 Subject: [PATCH 003/300] (#13482) qt5: disable bitcode --- recipes/qt/5.x.x/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py index 8435569e0775df..2f862bb4502129 100644 --- a/recipes/qt/5.x.x/conanfile.py +++ b/recipes/qt/5.x.x/conanfile.py @@ -441,6 +441,7 @@ def source(self): "-ldbus-1d", "-ldbus-1" ) + open(os.path.join(self.source_folder, "qt5", "qtbase", "mkspecs", "features", "uikit", "bitcode.prf"), "w").close() def _make_program(self): if self._is_msvc: From bd0f0877bf27914ccef7aee5e89e0bad26ce6301 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 17 Oct 2022 16:44:59 +0900 Subject: [PATCH 004/300] (#13533) osmanip: add version 4.3.0 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/osmanip/all/conandata.yml | 3 +++ recipes/osmanip/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/osmanip/all/conandata.yml b/recipes/osmanip/all/conandata.yml index f7bfb55b130689..ed7a08d71f3445 100644 --- a/recipes/osmanip/all/conandata.yml +++ b/recipes/osmanip/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.3.0": + url: "https://github.com/JustWhit3/osmanip/archive/v4.3.0.tar.gz" + sha256: "e0d982d19792c3e438e3be99f789434b66788f9a7114f217b3c5f28d0121af7f" "4.2.2": url: "https://github.com/JustWhit3/osmanip/archive/v4.2.2.tar.gz" sha256: "841b76bb4f44b66d714858e62661cee75c4fef553300b6da2a6720509421a5fe" diff --git a/recipes/osmanip/config.yml b/recipes/osmanip/config.yml index 1d6418ec4bbcbb..7561eb3d936419 100644 --- a/recipes/osmanip/config.yml +++ b/recipes/osmanip/config.yml @@ -1,4 +1,6 @@ versions: + "4.3.0": + folder: all "4.2.2": folder: all "4.2.1": From e5fba9e6db4dd0869c2efef3fab70ee81e639189 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 17 Oct 2022 12:05:59 +0200 Subject: [PATCH 005/300] (#13536) [docs] Add Changelog October 17, 2022 Signed-off-by: Uilian Ries Signed-off-by: Uilian Ries --- docs/changelog.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 32eb65be6d78b2..020830e28edf79 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,17 @@ # Changelog +### 17-October-2022 - 10:33 CEST + +- [feature] Improve management of GitHub labels on pull requests. +- [feature] New EpochsSummary job to show epoch status for each reference. +- [feature] Save bot comments as labels as job artifacts for easier user feedback. +- [feature] Ability to wait for a job and merge bot messages from another pipeline: Allows to provide feedback to users in PRs from the Conan v2 pipeline in the future. +- [feature] Add timeout to AutomaticMerge job. +- [feature] Add note about Windows SDK on supported platforms documentation. +- [fix] Fix getting package IDs from Artifactory in the Conan v2 pipeline. +- [fix] Bump dependencies pull requests should only consider modified comments. +- [fix] ValidateInfrastructure job parameter for macos executors. + ### 20-September-2022 - 14:27 CEST - [feature] Handle scenarios where some files are removed. From 57f301540e6dcbad70249958b39badf49e0dd897 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 17 Oct 2022 19:45:13 +0900 Subject: [PATCH 006/300] (#13441) bzip3: add version 1.1.6 * bzip3: add version 1.1.6 * use export_conandata_patches * define BZIP3_DLL_EXPORT --- recipes/bzip3/all/CMakeLists.txt | 4 ++++ recipes/bzip3/all/conandata.yml | 3 +++ recipes/bzip3/all/conanfile.py | 12 +++++++----- recipes/bzip3/config.yml | 2 ++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/recipes/bzip3/all/CMakeLists.txt b/recipes/bzip3/all/CMakeLists.txt index 21fba747c07a05..62b301abbb58e6 100644 --- a/recipes/bzip3/all/CMakeLists.txt +++ b/recipes/bzip3/all/CMakeLists.txt @@ -30,6 +30,10 @@ set_target_properties(bzip3 PROPERTIES C_VISIBILITY_PRESET hidden C_EXTENSIONS OFF ) +if (VERSION VERSION_GREATER_EQUAL "1.1.6" AND (MSVC OR MSVC90 OR MSVC10) AND BUILD_SHARED_LIBS) + target_compile_definitions(bzip3 PRIVATE "BZIP3_DLL_EXPORT=1") +endif() + if (BZIP3_WITH_THREAD) find_package(Threads REQUIRED) target_link_libraries(bzip3 PRIVATE Threads::Threads) diff --git a/recipes/bzip3/all/conandata.yml b/recipes/bzip3/all/conandata.yml index 2a3f78f362c7a6..87478fcf26ffd4 100644 --- a/recipes/bzip3/all/conandata.yml +++ b/recipes/bzip3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.6": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.6/bzip3-1.1.6.tar.bz2" + sha256: "2bfd35dd57ab80b35b25e3ad628e0ff8f1f5e6dea02a8d472914823ea2e07e96" "1.1.5": url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.5/bzip3-1.1.5.tar.bz2" sha256: "2f5012b0004b6c23d5f606deed9191fdce44849234edbcf26e0316bf7856d114" diff --git a/recipes/bzip3/all/conanfile.py b/recipes/bzip3/all/conanfile.py index 196224b72dc65a..2d6313f87447bf 100644 --- a/recipes/bzip3/all/conanfile.py +++ b/recipes/bzip3/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class BZip3Conan(ConanFile): @@ -29,8 +29,7 @@ class BZip3Conan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,7 +42,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: del self.settings.compiler.libcxx except Exception: diff --git a/recipes/bzip3/config.yml b/recipes/bzip3/config.yml index 953d7e8cb96d82..fa8612a6d0ffa2 100644 --- a/recipes/bzip3/config.yml +++ b/recipes/bzip3/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.6": + folder: all "1.1.5": folder: all "1.1.4": From aeb40c6ec020f63fc749768541bf669839d5b53a Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 17 Oct 2022 12:04:57 +0100 Subject: [PATCH 007/300] (#13451) [freetype] update toolchain and add layout * [freetype] update test packages * [freetype] fix license folder copy * [freetype] apply review suggestions --- recipes/freetype/all/CMakeLists.txt | 7 - recipes/freetype/all/conanfile.py | 191 +++++++++--------- .../freetype/all/test_package/CMakeLists.txt | 7 +- .../freetype/all/test_package/conanfile.py | 19 +- .../all/test_v1_package/CMakeLists.txt | 10 + .../freetype/all/test_v1_package/conanfile.py | 18 ++ 6 files changed, 141 insertions(+), 111 deletions(-) delete mode 100644 recipes/freetype/all/CMakeLists.txt create mode 100644 recipes/freetype/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/freetype/all/test_v1_package/conanfile.py diff --git a/recipes/freetype/all/CMakeLists.txt b/recipes/freetype/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33fc..00000000000000 --- a/recipes/freetype/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/freetype/all/conanfile.py b/recipes/freetype/all/conanfile.py index 9008cfe2b91e2e..a9262f44540d70 100644 --- a/recipes/freetype/all/conanfile.py +++ b/recipes/freetype/all/conanfile.py @@ -1,12 +1,22 @@ from conan import ConanFile -from conan.tools import files, scm -from conans import CMake, tools +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps +from conan.tools.files import ( + collect_libs, + copy, + load, + get, + rename, + replace_in_file, + rmdir, + save +) +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os import re -import shutil import textwrap -required_conan_version = ">=1.50.2" +required_conan_version = ">=1.52.0" class FreetypeConan(ConanFile): @@ -37,21 +47,9 @@ class FreetypeConan(ConanFile): "subpixel": False } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _has_with_brotli_option(self): - return scm.Version(self.version) >= "2.10.2" + return Version(self.version) >= "2.10.2" def config_options(self): if self.settings.os == "Windows": @@ -75,93 +73,98 @@ def requirements(self): if self.options.get_safe("with_brotli"): self.requires("brotli/1.0.9") + def layout(self): + basic_layout(self, src_folder="src") + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + + cmake = CMakeToolchain(self) + if Version(self.version) >= "2.11.0": + cmake.variables["FT_REQUIRE_ZLIB"] = self.options.with_zlib + cmake.variables["FT_DISABLE_ZLIB"] = not self.options.with_zlib + cmake.variables["FT_REQUIRE_PNG"] = self.options.with_png + cmake.variables["FT_DISABLE_PNG"] = not self.options.with_png + cmake.variables["FT_REQUIRE_BZIP2"] = self.options.with_bzip2 + cmake.variables["FT_DISABLE_BZIP2"] = not self.options.with_bzip2 + # TODO: Harfbuzz can be added as an option as soon as it is available. + cmake.variables["FT_REQUIRE_HARFBUZZ"] = False + cmake.variables["FT_DISABLE_HARFBUZZ"] = True + if self._has_with_brotli_option: + cmake.variables["FT_REQUIRE_BROTLI"] = self.options.with_brotli + cmake.variables["FT_DISABLE_BROTLI"] = not self.options.with_brotli + else: + cmake.variables["FT_WITH_ZLIB"] = self.options.with_zlib + cmake.variables["FT_WITH_PNG"] = self.options.with_png + cmake.variables["FT_WITH_BZIP2"] = self.options.with_bzip2 + # TODO: Harfbuzz can be added as an option as soon as it is available. + cmake.variables["FT_WITH_HARFBUZZ"] = False + if self._has_with_brotli_option: + cmake.variables["FT_WITH_BROTLI"] = self.options.with_brotli + # Generate a relocatable shared lib on Macos + cmake.variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + + cmake.generate() + def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def _patch_sources(self): # Do not accidentally enable dependencies we have disabled - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - find_harfbuzz = "find_package(HarfBuzz {})".format("1.3.0" if scm.Version(self.version) < "2.10.2" else "${HARFBUZZ_MIN_VERSION}") - if_harfbuzz_found = "if ({})".format("HARFBUZZ_FOUND" if scm.Version(self.version) < "2.11.0" else "HarfBuzz_FOUND") - tools.replace_in_file(cmakelists, find_harfbuzz, "") - tools.replace_in_file(cmakelists, if_harfbuzz_found, "if(0)") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + find_harfbuzz = "find_package(HarfBuzz {})".format("1.3.0" if Version(self.version) < "2.10.2" else "${HARFBUZZ_MIN_VERSION}") + if_harfbuzz_found = "if ({})".format("HARFBUZZ_FOUND" if Version(self.version) < "2.11.0" else "HarfBuzz_FOUND") + replace_in_file(self, cmakelists, find_harfbuzz, "") + replace_in_file(self, cmakelists, if_harfbuzz_found, "if(0)") if not self.options.with_png: - tools.replace_in_file(cmakelists, "find_package(PNG)", "") - tools.replace_in_file(cmakelists, "if (PNG_FOUND)", "if(0)") + replace_in_file(self, cmakelists, "find_package(PNG)", "") + replace_in_file(self, cmakelists, "if (PNG_FOUND)", "if(0)") if not self.options.with_zlib: - tools.replace_in_file(cmakelists, "find_package(ZLIB)", "") - tools.replace_in_file(cmakelists, "if (ZLIB_FOUND)", "if(0)") + replace_in_file(self, cmakelists, "find_package(ZLIB)", "") + replace_in_file(self, cmakelists, "if (ZLIB_FOUND)", "if(0)") if not self.options.with_bzip2: - tools.replace_in_file(cmakelists, "find_package(BZip2)", "") - tools.replace_in_file(cmakelists, "if (BZIP2_FOUND)", "if(0)") + replace_in_file(self, cmakelists, "find_package(BZip2)", "") + replace_in_file(self, cmakelists, "if (BZIP2_FOUND)", "if(0)") if self._has_with_brotli_option: # the custom FindBrotliDec of upstream is too fragile - tools.replace_in_file(cmakelists, + replace_in_file(self, cmakelists, "find_package(BrotliDec REQUIRED)", "find_package(Brotli REQUIRED)\n" "set(BROTLIDEC_FOUND 1)\n" - "set(BROTLIDEC_LIBRARIES \"Brotli::Brotli\")") + "set(BROTLIDEC_LIBRARIES \"brotli::brotli\")") if not self.options.with_brotli: - tools.replace_in_file(cmakelists, "find_package(BrotliDec)", "") - tools.replace_in_file(cmakelists, "if (BROTLIDEC_FOUND)", "if(0)") + replace_in_file(self, cmakelists, "find_package(BrotliDec)", "") + replace_in_file(self, cmakelists, "if (BROTLIDEC_FOUND)", "if(0)") - config_h = os.path.join(self._source_subfolder, "include", "freetype", "config", "ftoption.h") + config_h = os.path.join(self.source_folder, "include", "freetype", "config", "ftoption.h") if self.options.subpixel: - tools.replace_in_file(config_h, "/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */", "#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if scm.Version(self.version) >= "2.11.0": - self._cmake.definitions["FT_REQUIRE_ZLIB"] = self.options.with_zlib - self._cmake.definitions["FT_DISABLE_ZLIB"] = not self.options.with_zlib - self._cmake.definitions["FT_REQUIRE_PNG"] = self.options.with_png - self._cmake.definitions["FT_DISABLE_PNG"] = not self.options.with_png - self._cmake.definitions["FT_REQUIRE_BZIP2"] = self.options.with_bzip2 - self._cmake.definitions["FT_DISABLE_BZIP2"] = not self.options.with_bzip2 - # TODO: Harfbuzz can be added as an option as soon as it is available. - self._cmake.definitions["FT_REQUIRE_HARFBUZZ"] = False - self._cmake.definitions["FT_DISABLE_HARFBUZZ"] = True - if self._has_with_brotli_option: - self._cmake.definitions["FT_REQUIRE_BROTLI"] = self.options.with_brotli - self._cmake.definitions["FT_DISABLE_BROTLI"] = not self.options.with_brotli - else: - self._cmake.definitions["FT_WITH_ZLIB"] = self.options.with_zlib - self._cmake.definitions["FT_WITH_PNG"] = self.options.with_png - self._cmake.definitions["FT_WITH_BZIP2"] = self.options.with_bzip2 - # TODO: Harfbuzz can be added as an option as soon as it is available. - self._cmake.definitions["FT_WITH_HARFBUZZ"] = False - if self._has_with_brotli_option: - self._cmake.definitions["FT_WITH_BROTLI"] = self.options.with_brotli - # Generate a relocatable shared lib on Macos - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - self._cmake.configure(build_dir=self._build_subfolder) - return self._cmake + replace_in_file(self,config_h, "/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */", "#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def _make_freetype_config(self, version): - freetype_config_in = os.path.join(self._source_subfolder, "builds", "unix", "freetype-config.in") + freetype_config_in = os.path.join(self.source_folder, "builds", "unix", "freetype-config.in") if not os.path.isdir(os.path.join(self.package_folder, "bin")): os.makedirs(os.path.join(self.package_folder, "bin")) freetype_config = os.path.join(self.package_folder, "bin", "freetype-config") - shutil.copy(freetype_config_in, freetype_config) + rename(self, freetype_config_in, freetype_config) libs = "-lfreetyped" if self.settings.build_type == "Debug" else "-lfreetype" staticlibs = f"-lm {libs}" if self.settings.os == "Linux" else libs - tools.replace_in_file(freetype_config, r"%PKG_CONFIG%", r"/bin/false") # never use pkg-config - tools.replace_in_file(freetype_config, r"%prefix%", r"$conan_prefix") - tools.replace_in_file(freetype_config, r"%exec_prefix%", r"$conan_exec_prefix") - tools.replace_in_file(freetype_config, r"%includedir%", r"$conan_includedir") - tools.replace_in_file(freetype_config, r"%libdir%", r"$conan_libdir") - tools.replace_in_file(freetype_config, r"%ft_version%", r"$conan_ftversion") - tools.replace_in_file(freetype_config, r"%LIBSSTATIC_CONFIG%", r"$conan_staticlibs") - tools.replace_in_file(freetype_config, r"-lfreetype", libs) - tools.replace_in_file(freetype_config, r"export LC_ALL", textwrap.dedent("""\ + replace_in_file(self, freetype_config, r"%PKG_CONFIG%", r"/bin/false") # never use pkg-config + replace_in_file(self, freetype_config, r"%prefix%", r"$conan_prefix") + replace_in_file(self, freetype_config, r"%exec_prefix%", r"$conan_exec_prefix") + replace_in_file(self, freetype_config, r"%includedir%", r"$conan_includedir") + replace_in_file(self, freetype_config, r"%libdir%", r"$conan_libdir") + replace_in_file(self, freetype_config, r"%ft_version%", r"$conan_ftversion") + replace_in_file(self, freetype_config, r"%LIBSSTATIC_CONFIG%", r"$conan_staticlibs") + replace_in_file(self, freetype_config, r"-lfreetype", libs) + replace_in_file(self, freetype_config, r"export LC_ALL", textwrap.dedent("""\ export LC_ALL BINDIR=$(dirname $0) conan_prefix=$(dirname $BINDIR) @@ -173,7 +176,7 @@ def _make_freetype_config(self, version): """).format(version=version, staticlibs=staticlibs)) def _extract_libtool_version(self): - conf_raw = tools.load(os.path.join(self._source_subfolder, "builds", "unix", "configure.raw")) + conf_raw = load(self, os.path.join(self.source_folder, "builds", "unix", "configure.raw")) return next(re.finditer(r"^version_info='([0-9:]+)'", conf_raw, flags=re.M)).group(1).replace(":", ".") @property @@ -181,19 +184,21 @@ def _libtool_version_txt(self): return os.path.join(self.package_folder, "res", "freetype-libtool-version.txt") def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() libtool_version = self._extract_libtool_version() - tools.save(self._libtool_version_txt, libtool_version) + save(self, self._libtool_version_txt, libtool_version) self._make_freetype_config(libtool_version) - self.copy("FTL.TXT", src=os.path.join(self._source_subfolder, "docs"), dst="licenses") - self.copy("GPLv2.TXT", src=os.path.join(self._source_subfolder, "docs"), dst="licenses") - self.copy("LICENSE.TXT", src=os.path.join(self._source_subfolder, "docs"), dst="licenses") + doc_folder = os.path.join(self.source_folder, "docs") + license_folder = os.path.join(self.package_folder, "licenses") + copy(self, "FTL.TXT", doc_folder, license_folder) + copy(self, "GPLv2.TXT", doc_folder, license_folder) + copy(self, "LICENSE.TXT", doc_folder, license_folder) - files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_vars_rel_path) ) @@ -202,8 +207,7 @@ def package(self): {"freetype": "Freetype::Freetype"} ) - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ if(DEFINED Freetype_FOUND) set(FREETYPE_FOUND ${Freetype_FOUND}) @@ -218,10 +222,9 @@ def _create_cmake_module_variables(module_file): set(FREETYPE_VERSION_STRING ${Freetype_VERSION}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -230,7 +233,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_subfolder(self): @@ -260,7 +263,7 @@ def package_info(self): self.cpp_info.builddirs.append(self._module_subfolder) self.cpp_info.set_property("cmake_build_modules", [self._module_vars_rel_path]) self.cpp_info.set_property("pkg_config_name", "freetype2") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") self.cpp_info.includedirs.append(os.path.join("include", "freetype2")) @@ -269,7 +272,7 @@ def package_info(self): self.env_info.FT2_CONFIG = freetype_config self._chmod_plus_x(freetype_config) - libtool_version = tools.load(self._libtool_version_txt).strip() + libtool_version = load(self, self._libtool_version_txt).strip() self.user_info.LIBTOOL_VERSION = libtool_version # FIXME: need to do override the pkg_config version (pkg_config_custom_content does not work) # self.cpp_info.version["pkg_config"] = pkg_config_version diff --git a/recipes/freetype/all/test_package/CMakeLists.txt b/recipes/freetype/all/test_package/CMakeLists.txt index 8fe0c73fa63371..d0f6e7db35f58e 100644 --- a/recipes/freetype/all/test_package/CMakeLists.txt +++ b/recipes/freetype/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(Freetype REQUIRED) +find_package(Freetype CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} Freetype::Freetype) +target_link_libraries(${PROJECT_NAME} PRIVATE freetype) diff --git a/recipes/freetype/all/test_package/conanfile.py b/recipes/freetype/all/test_package/conanfile.py index e301073d04822b..5da019d033eb1d 100644 --- a/recipes/freetype/all/test_package/conanfile.py +++ b/recipes/freetype/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") font_path = os.path.join(self.source_folder, "OpenSans-Bold.ttf") - self.run("{} {}".format(bin_path, font_path), run_environment=True) + self.run(f"{bin_path} {font_path}", env="conanrun") diff --git a/recipes/freetype/all/test_v1_package/CMakeLists.txt b/recipes/freetype/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..29099563ff9fb7 --- /dev/null +++ b/recipes/freetype/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Freetype REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Freetype::Freetype) diff --git a/recipes/freetype/all/test_v1_package/conanfile.py b/recipes/freetype/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..aed73943409ce6 --- /dev/null +++ b/recipes/freetype/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + font_path = os.path.join(self.source_folder, "..", "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {font_path}", run_environment=True) From d83019db3cc820e9d844cb89259d5785c9ea6551 Mon Sep 17 00:00:00 2001 From: Conan Center Index Bot <54393557+conan-center-bot@users.noreply.github.com> Date: Mon, 17 Oct 2022 13:31:04 +0200 Subject: [PATCH 008/300] (#13457) [bot] Add Access Request users (2022-10-13) --- .c3i/authorized_users.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index 393a65493cf883..94ef38e9a5f6a4 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -943,3 +943,14 @@ authorized_users: - "vince-cheung" - "mariopil" - "PikachuHyA" + - "System-Arch" + - "sorny92" + - "cubanpit" + - "winterz" + - "Kidsunbo" + - "antony-jr" + - "tankeco" + - "ElliotMugner" + - "jfaust" + - "morningstar1" + - "lrineau" From 0426ea12f2304e377d3df02963841a23b6adfb8a Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Mon, 17 Oct 2022 13:56:34 +0200 Subject: [PATCH 009/300] (#13461) Move myself to community --- .c3i/reviewers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.c3i/reviewers.yml b/.c3i/reviewers.yml index 68688a3dec35d3..9be2aca6c97940 100644 --- a/.c3i/reviewers.yml +++ b/.c3i/reviewers.yml @@ -10,8 +10,8 @@ reviewers: type: "team" request_reviews: false - user: "jgsogo" - type: "team" - request_reviews: true + type: "community" + request_reviews: false - user: "czoido" type: "team" request_reviews: false From 8c9e6336cbdd80d0592aebd7220046e56859661b Mon Sep 17 00:00:00 2001 From: Michael Keck Date: Mon, 17 Oct 2022 14:25:54 +0200 Subject: [PATCH 010/300] (#13491) cmake: add new versions + remove old ones + use official src downloads * cmake: add new versions + remove old ones + use official src downloads * add new versions * remove old versions * use official source downloads for all versions; some used the automated GitHub generated source archives * some additional tiny improvements * cmake: import errors from conan namespace * cmake: create identical `test_v1_package` to satisfy hooks * Use `env="conanrun"` Co-authored-by: Jordan Williams * Use f-string Co-authored-by: Jordan Williams * Use `generators = "VirtualRunEnv"` * Use `test_type = "explicit"` for v1 test_package Co-authored-by: Jordan Williams --- recipes/cmake/3.x.x/conandata.yml | 30 +++++++++---------- recipes/cmake/3.x.x/conanfile.py | 11 +++---- recipes/cmake/3.x.x/test_package/conanfile.py | 11 +++++-- .../cmake/3.x.x/test_v1_package/conanfile.py | 23 ++++++++++++++ recipes/cmake/config.yml | 4 +-- 5 files changed, 52 insertions(+), 27 deletions(-) create mode 100644 recipes/cmake/3.x.x/test_v1_package/conanfile.py diff --git a/recipes/cmake/3.x.x/conandata.yml b/recipes/cmake/3.x.x/conandata.yml index 80dda4779fb80c..57c64254de46ea 100644 --- a/recipes/cmake/3.x.x/conandata.yml +++ b/recipes/cmake/3.x.x/conandata.yml @@ -1,25 +1,25 @@ sources: "3.19.8": - sha256: 09b4fa4837aae55c75fb170f6a6e2b44818deba48335d1969deddfbb34e30369 url: https://github.com/Kitware/CMake/releases/download/v3.19.8/cmake-3.19.8.tar.gz + sha256: 09b4fa4837aae55c75fb170f6a6e2b44818deba48335d1969deddfbb34e30369 "3.20.6": - sha256: a0bd485e1a38dd13c0baec89d5f4adbf61c7fd32fddb38eabc69a75bc0b65d72 url: https://github.com/Kitware/CMake/releases/download/v3.20.6/cmake-3.20.6.tar.gz + sha256: a0bd485e1a38dd13c0baec89d5f4adbf61c7fd32fddb38eabc69a75bc0b65d72 "3.21.7": - sha256: 3523c4a5afc61ac3d7c92835301cdf092129c9b672a6ee17e68c92e928c1375a url: https://github.com/Kitware/CMake/releases/download/v3.21.7/cmake-3.21.7.tar.gz - "3.22.5": - sha256: d3987c3f7759fa0a401c5fcd5076be44a19613bfaa8baee1b5d1835750dc5375 - url: https://github.com/Kitware/CMake/releases/download/v3.22.5/cmake-3.22.5.tar.gz - "3.23.3": - url: "https://github.com/Kitware/CMake/archive/v3.23.3.tar.gz" - sha256: "013f688b7da463dcd1e7afde769081af21cb24365aefc246761cfb2e04cd2872" + sha256: 3523c4a5afc61ac3d7c92835301cdf092129c9b672a6ee17e68c92e928c1375a + "3.22.6": + url: https://github.com/Kitware/CMake/releases/download/v3.22.6/cmake-3.22.6.tar.gz + sha256: 73933163670ea4ea95c231549007b0c7243282293506a2cf4443714826ad5ec3 + "3.23.4": + url: "https://github.com/Kitware/CMake/releases/download/v3.23.4/cmake-3.23.4.tar.gz" + sha256: "aa8b6c17a5adf04de06e42c06adc7e25b21e4fe8378f44f703a861e5f6ac59c7" "3.24.0": - url: "https://github.com/Kitware/CMake/archive/v3.24.0.tar.gz" - sha256: "d71f48192a0747c0bd46e8f2128773adf3d650d3900a9b03bd2ee5058619bafd" + url: "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0.tar.gz" + sha256: "c2b61f7cdecb1576cad25f918a8f42b8685d88a832fd4b62b9e0fa32e915a658" "3.24.1": - url: "https://github.com/Kitware/CMake/archive/v3.24.1.tar.gz" - sha256: "fe7fd2eb0ecee1c0ad829bca77ac7b516fdb7a982e862fc47ef8df54e714dbc3" + url: "https://github.com/Kitware/CMake/releases/download/v3.24.1/cmake-3.24.1.tar.gz" + sha256: "4931e277a4db1a805f13baa7013a7757a0cbfe5b7932882925c7061d9d1fa82b" "3.24.2": - url: "https://github.com/Kitware/CMake/archive/v3.24.2.tar.gz" - sha256: "f4f0772b0a89f93be6d1153d5640b80cc8d64a3bda95cca1799673bc4d03f3b1" + url: "https://github.com/Kitware/CMake/releases/download/v3.24.2/cmake-3.24.2.tar.gz" + sha256: "0d9020f06f3ddf17fb537dc228e1a56c927ee506b486f55fe2dc19f69bf0c8db" diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index dcee83836341ac..6fa70380c571e5 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -3,9 +3,9 @@ from conan.tools.scm import Version from conan.tools.files import rmdir, get from conans import tools, AutoToolsBuildEnvironment, CMake -from conans.errors import ConanInvalidConfiguration, ConanException +from conan.errors import ConanInvalidConfiguration, ConanException -required_conan_version = ">=1.35.0" +required_conan_version = ">=1.49.0" class CMakeConan(ConanFile): name = "cmake" @@ -29,9 +29,6 @@ class CMakeConan(ConanFile): _source_subfolder = "source_subfolder" _cmake = None - def _minor_version(self): - return ".".join(str(self.version).split(".")[:2]) - def config_options(self): if self.settings.os == "Windows": self.options.with_openssl = False @@ -125,7 +122,7 @@ def package_id(self): del self.info.settings.compiler def package_info(self): - minor = self._minor_version() + module_version = "{}.{}".format(Version(self.version).major, Version(self.version).minor) bindir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bindir)) @@ -133,7 +130,7 @@ def package_info(self): self.buildenv_info.prepend_path("CMAKE_ROOT", self.package_folder) self.env_info.CMAKE_ROOT = self.package_folder - mod_path = os.path.join(self.package_folder, "share", "cmake-%s" % minor, "Modules") + mod_path = os.path.join(self.package_folder, "share", f"cmake-{module_version}", "Modules") self.buildenv_info.prepend_path("CMAKE_MODULE_PATH", mod_path) self.env_info.CMAKE_MODULE_PATH = mod_path if not os.path.exists(mod_path): diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index b36c2327f2da6b..0b0c4858e1c60e 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,15 +1,20 @@ import os from six import StringIO -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "arch" + generators = "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): + if can_run(self): output = StringIO() - self.run("cmake --version", output=output, run_environment=True) + self.run("cmake --version", env="conanrun", output=output) output_str = str(output.getvalue()) self.output.info("Installed version: {}".format(output_str)) require_version = str(self.deps_cpp_info["cmake"].version) diff --git a/recipes/cmake/3.x.x/test_v1_package/conanfile.py b/recipes/cmake/3.x.x/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..efb629f7d57250 --- /dev/null +++ b/recipes/cmake/3.x.x/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +import os +from six import StringIO +from conan import ConanFile +from conan.tools.build import can_run + + +class TestPackageConan(ConanFile): + settings = "os", "arch" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def test(self): + if can_run(self): + output = StringIO() + self.run("cmake --version", output=output, run_environment=True) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + require_version = str(self.deps_cpp_info["cmake"].version) + self.output.info("Expected version: {}".format(require_version)) + assert_cmake_version = "cmake version %s" % require_version + assert(assert_cmake_version in output_str) diff --git a/recipes/cmake/config.yml b/recipes/cmake/config.yml index f2af6f8eea1c42..df21a50793a9e1 100644 --- a/recipes/cmake/config.yml +++ b/recipes/cmake/config.yml @@ -5,9 +5,9 @@ versions: folder: "3.x.x" "3.21.7": folder: "3.x.x" - "3.22.5": + "3.22.6": folder: "3.x.x" - "3.23.3": + "3.23.4": folder: "3.x.x" "3.24.0": folder: "3.x.x" From 63292eb592b126c577cb6ead970c716883d58e1e Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 17 Oct 2022 21:45:06 +0900 Subject: [PATCH 011/300] (#13495) aws-c-http: change dependeant recipe version for aws-c-s3 * change dependeant recipe version for aws-c-s3 * fix condition --- recipes/aws-c-http/all/conanfile.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/aws-c-http/all/conanfile.py b/recipes/aws-c-http/all/conanfile.py index 71f435659cae7f..5f4b5242c4dbed 100644 --- a/recipes/aws-c-http/all/conanfile.py +++ b/recipes/aws-c-http/all/conanfile.py @@ -1,4 +1,5 @@ from conan import ConanFile +from conan.tools.scm import Version from conan.tools.files import get, copy, rmdir from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os @@ -47,7 +48,10 @@ def layout(self): def requirements(self): self.requires("aws-c-common/0.8.2") self.requires("aws-c-compression/0.2.15") - self.requires("aws-c-io/0.13.4") + if Version(self.version) < "0.6.22": + self.requires("aws-c-io/0.10.20") + else: + self.requires("aws-c-io/0.13.4") def source(self): get(self, **self.conan_data["sources"][self.version], From e236d41ae33dbcc0595dd3e907b4606e42f0575f Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 15:26:37 +0200 Subject: [PATCH 012/300] (#13498) libbacktrace: conan v2 support --- recipes/libbacktrace/all/conandata.yml | 2 - recipes/libbacktrace/all/conanfile.py | 152 +++++++++--------- .../all/test_package/CMakeLists.txt | 7 +- .../all/test_package/conanfile.py | 26 +-- .../all/test_v1_package/CMakeLists.txt | 10 ++ .../all/test_v1_package/conanfile.py | 17 ++ 6 files changed, 116 insertions(+), 98 deletions(-) create mode 100644 recipes/libbacktrace/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libbacktrace/all/test_v1_package/conanfile.py diff --git a/recipes/libbacktrace/all/conandata.yml b/recipes/libbacktrace/all/conandata.yml index 1357c342647ac1..56d79ce7402eb4 100644 --- a/recipes/libbacktrace/all/conandata.yml +++ b/recipes/libbacktrace/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "cci.20210118": - patch_file: "patches/0001-pointer-arithmetic.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-msvc-unistd-alternative.patch" - base_path: "source_subfolder" diff --git a/recipes/libbacktrace/all/conanfile.py b/recipes/libbacktrace/all/conanfile.py index 33119b46895be7..ca9c6497fea499 100644 --- a/recipes/libbacktrace/all/conanfile.py +++ b/recipes/libbacktrace/all/conanfile.py @@ -1,11 +1,15 @@ -from conan.tools.files import rename -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import contextlib -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class LibbacktraceConan(ConanFile): @@ -25,21 +29,16 @@ class LibbacktraceConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,82 +46,79 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.info.options.shared: raise ConanInvalidConfiguration("libbacktrace shared is not supported with Visual Studio") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self._is_msvc: - self.build_requires("automake/1.16.4") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - - @contextlib.contextmanager - def _build_context(self): - if self._is_msvc: - with tools.vcvars(self): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "LD": "{} link -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "AR": "{} lib".format(tools.unix_path(self._user_info_build["automake"].ar_lib)), - } - with tools.environment_append(env): - yield - else: - yield - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - if (self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12") or \ - str(self.settings.compiler) == "msvc": - autotools.flags.append("-FS") - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # relocatable shared lib on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/") + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + compile_wrapper = unix_path(self, self._user_info_build["automake"].compile) + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_libbacktrace_msvc") def build(self): - self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # see https://github.com/conan-io/conan/issues/12006 + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) lib_folder = os.path.join(self.package_folder, "lib") - if self._is_msvc: + rm(self, "*.la", lib_folder) + fix_apple_shared_install_name(self) + if is_msvc(self): rename(self, os.path.join(lib_folder, "libbacktrace.lib"), os.path.join(lib_folder, "backtrace.lib")) - tools.remove_files_by_mask(lib_folder, "*.la") def package_info(self): self.cpp_info.libs = ["backtrace"] diff --git a/recipes/libbacktrace/all/test_package/CMakeLists.txt b/recipes/libbacktrace/all/test_package/CMakeLists.txt index 5d15b4b693da09..81b50a3407418b 100644 --- a/recipes/libbacktrace/all/test_package/CMakeLists.txt +++ b/recipes/libbacktrace/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libbacktrace REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package libbacktrace::libbacktrace) +target_link_libraries(test_package PRIVATE libbacktrace::libbacktrace) diff --git a/recipes/libbacktrace/all/test_package/conanfile.py b/recipes/libbacktrace/all/test_package/conanfile.py index 5c8041d4e18279..0a6bc68712d901 100644 --- a/recipes/libbacktrace/all/test_package/conanfile.py +++ b/recipes/libbacktrace/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libbacktrace/all/test_v1_package/CMakeLists.txt b/recipes/libbacktrace/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..ee84a5e8430255 --- /dev/null +++ b/recipes/libbacktrace/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libbacktrace REQUIRED CONFIG) + +add_executable(test_package ../test_package/test_package.c) +target_link_libraries(test_package PRIVATE libbacktrace::libbacktrace) diff --git a/recipes/libbacktrace/all/test_v1_package/conanfile.py b/recipes/libbacktrace/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..e0a85886fc12c4 --- /dev/null +++ b/recipes/libbacktrace/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import CMake, ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From c6b5db76d48ae06ddcc269271a2ab2359f93d8ed Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 15:45:52 +0200 Subject: [PATCH 013/300] (#13502) xerces-c: conan v2 support --- recipes/xerces-c/all/CMakeLists.txt | 7 -- recipes/xerces-c/all/conandata.yml | 4 - recipes/xerces-c/all/conanfile.py | 96 +++++++++---------- .../xerces-c/all/test_package/CMakeLists.txt | 13 +-- .../xerces-c/all/test_package/conanfile.py | 19 +++- .../all/test_v1_package/CMakeLists.txt | 11 +++ .../xerces-c/all/test_v1_package/conanfile.py | 17 ++++ 7 files changed, 93 insertions(+), 74 deletions(-) delete mode 100644 recipes/xerces-c/all/CMakeLists.txt create mode 100644 recipes/xerces-c/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/xerces-c/all/test_v1_package/conanfile.py diff --git a/recipes/xerces-c/all/CMakeLists.txt b/recipes/xerces-c/all/CMakeLists.txt deleted file mode 100644 index 9d48e327cd88a6..00000000000000 --- a/recipes/xerces-c/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/xerces-c/all/conandata.yml b/recipes/xerces-c/all/conandata.yml index 1fe9340e9c3684..689ea35941ef91 100644 --- a/recipes/xerces-c/all/conandata.yml +++ b/recipes/xerces-c/all/conandata.yml @@ -8,11 +8,7 @@ sources: patches: "3.2.3": - patch_file: "patches/0001-remove-test-samples.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-find-icu-programs.patch" - base_path: "source_subfolder" "3.2.2": - patch_file: "patches/0001-remove-test-samples.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-find-icu-programs.patch" - base_path: "source_subfolder" diff --git a/recipes/xerces-c/all/conanfile.py b/recipes/xerces-c/all/conanfile.py index 06b8a858e9d3eb..de59d70169466c 100644 --- a/recipes/xerces-c/all/conanfile.py +++ b/recipes/xerces-c/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class XercesCConan(ConanFile): @@ -36,21 +39,8 @@ class XercesCConan(ConanFile): "mutex_manager": "standard", } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -67,13 +57,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if "icu" in (self.options.transcoder, self.options.message_loader): - self.requires("icu/70.1") + self.requires("icu/71.1") if self.options.network_accessor == "curl": - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.85.0") def _validate(self, option, value, os): """ @@ -85,7 +81,7 @@ def _validate(self, option, value, os): :param os: either a single string or a tuple of strings containing the OS(es) that `value` is valid on """ - if self.settings.os not in os and getattr(self.options, option) == value: + if self.info.settings.os not in os and getattr(self.info.options, option) == value: raise ConanInvalidConfiguration( "Option '{option}={value}' is only supported on {os}".format( option=option, value=value, os=os @@ -93,7 +89,7 @@ def _validate(self, option, value, os): ) def validate(self): - if self.settings.os not in ("Windows", "Macos", "Linux"): + if self.info.settings.os not in ("Windows", "Macos", "Linux"): raise ConanInvalidConfiguration("OS is not supported") self._validate("char_type", "wchar_t", ("Windows", )) self._validate("network_accessor", "winsock", ("Windows", )) @@ -107,51 +103,51 @@ def validate(self): def build_requirements(self): if hasattr(self, "settings_build") and self.options.message_loader == "icu": - self.build_requires("icu/70.1") + self.tool_requires("icu/71.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) # https://xerces.apache.org/xerces-c/build-3.html - self._cmake.definitions["network-accessor"] = self.options.network_accessor - self._cmake.definitions["transcoder"] = self.options.transcoder - self._cmake.definitions["message-loader"] = self.options.message_loader - self._cmake.definitions["xmlch-type"] = self.options.char_type - self._cmake.definitions["mutex-manager"] = self.options.mutex_manager + tc.variables["network-accessor"] = self.options.network_accessor + tc.variables["transcoder"] = self.options.transcoder + tc.variables["message-loader"] = self.options.message_loader + tc.variables["xmlch-type"] = self.options.char_type + tc.variables["mutex-manager"] = self.options.mutex_manager # avoid picking up system dependency - self._cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_CURL"] = self.options.network_accessor != "curl" - self._cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_ICU"] = "icu" not in (self.options.transcoder, self.options.message_loader) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_CURL"] = self.options.network_accessor != "curl" + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_ICU"] = "icu" not in (self.options.transcoder, self.options.message_loader) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="NOTICE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + for license in ("LICENSE", "NOTICE"): + copy(self, license, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - # remove unneeded directories - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "XercesC") self.cpp_info.set_property("cmake_target_name", "XercesC::XercesC") self.cpp_info.set_property("pkg_config_name", "xerces-c") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Macos": self.cpp_info.frameworks = ["CoreFoundation", "CoreServices"] elif self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/xerces-c/all/test_package/CMakeLists.txt b/recipes/xerces-c/all/test_package/CMakeLists.txt index 71e1760854d13a..3f03b5b9ef2cd6 100644 --- a/recipes/xerces-c/all/test_package/CMakeLists.txt +++ b/recipes/xerces-c/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(XercesC REQUIRED CONFIG) +find_package(XercesC REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} XercesC::XercesC) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE XercesC::XercesC) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/xerces-c/all/test_package/conanfile.py b/recipes/xerces-c/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/xerces-c/all/test_package/conanfile.py +++ b/recipes/xerces-c/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xerces-c/all/test_v1_package/CMakeLists.txt b/recipes/xerces-c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..7c3c78b82bae73 --- /dev/null +++ b/recipes/xerces-c/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(XercesC REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE XercesC::XercesC) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/xerces-c/all/test_v1_package/conanfile.py b/recipes/xerces-c/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..19e6a0c06e3d81 --- /dev/null +++ b/recipes/xerces-c/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 3e2db9b2b12a3e5715e62a1c72235783870b2fe5 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 16:24:46 +0200 Subject: [PATCH 014/300] (#13504) oatpp-sqlite: conan v2 support --- recipes/oatpp-sqlite/all/CMakeLists.txt | 7 -- recipes/oatpp-sqlite/all/conanfile.py | 115 ++++++++++-------- .../all/test_package/CMakeLists.txt | 12 +- .../all/test_package/conanfile.py | 25 ++-- .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 17 +++ 6 files changed, 111 insertions(+), 76 deletions(-) delete mode 100644 recipes/oatpp-sqlite/all/CMakeLists.txt create mode 100644 recipes/oatpp-sqlite/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/oatpp-sqlite/all/test_v1_package/conanfile.py diff --git a/recipes/oatpp-sqlite/all/CMakeLists.txt b/recipes/oatpp-sqlite/all/CMakeLists.txt deleted file mode 100644 index 1b8db564f60449..00000000000000 --- a/recipes/oatpp-sqlite/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-sqlite/all/conanfile.py b/recipes/oatpp-sqlite/all/conanfile.py index 82525eb53e8d97..75896ed5f3e712 100644 --- a/recipes/oatpp-sqlite/all/conanfile.py +++ b/recipes/oatpp-sqlite/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" class OatppsqliteConan(ConanFile): @@ -12,21 +17,16 @@ class OatppsqliteConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "oat++ SQLite library" topics = ("oat++", "oatpp", "sqlite") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" - - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -34,60 +34,73 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + def layout(self): + cmake_layout(self, src_folder="src") - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-sqlite can not be built as shared library on Windows") + def requirements(self): + self.requires(f"oatpp/{self.version}") + self.requires("sqlite3/3.39.4") - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-sqlite requires GCC >=5") + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def requirements(self): - self.requires("oatpp/" + self.version) - self.requires("sqlite3/3.37.0") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") - def _configure_cmake(self): - if self._cmake: - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-sqlite" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-sqlite" self.cpp_info.set_property("cmake_file_name", "oatpp-sqlite") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-sqlite") - self.cpp_info.components["_oatpp-sqlite"].names["cmake_find_package"] = "oatpp-sqlite" - self.cpp_info.components["_oatpp-sqlite"].names["cmake_find_package_multi"] = "oatpp-sqlite" - self.cpp_info.components["_oatpp-sqlite"].set_property("cmake_target_name", "oatpp::oatpp-sqlite") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-sqlite"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-sqlite") + os.path.join("include", f"oatpp-{self.version}", "oatpp-sqlite") ] - self.cpp_info.components["_oatpp-sqlite"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-sqlite"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-sqlite"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-sqlite"].bindirs = [] self.cpp_info.components["_oatpp-sqlite"].libs = ["oatpp-sqlite"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-sqlite"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-sqlite" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-sqlite" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-sqlite"].names["cmake_find_package"] = "oatpp-sqlite" + self.cpp_info.components["_oatpp-sqlite"].names["cmake_find_package_multi"] = "oatpp-sqlite" + self.cpp_info.components["_oatpp-sqlite"].set_property("cmake_target_name", "oatpp::oatpp-sqlite") self.cpp_info.components["_oatpp-sqlite"].requires = ["oatpp::oatpp", "sqlite3::sqlite3"] diff --git a/recipes/oatpp-sqlite/all/test_package/CMakeLists.txt b/recipes/oatpp-sqlite/all/test_package/CMakeLists.txt index 8b55c43a919b97..ca51c6a39660d6 100644 --- a/recipes/oatpp-sqlite/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-sqlite/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(oatpp-sqlite REQUIRED) +find_package(oatpp-sqlite REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-sqlite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-sqlite/all/test_package/conanfile.py b/recipes/oatpp-sqlite/all/test_package/conanfile.py index 68d108b091ab2b..0a6bc68712d901 100644 --- a/recipes/oatpp-sqlite/all/test_package/conanfile.py +++ b/recipes/oatpp-sqlite/all/test_package/conanfile.py @@ -1,21 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - -class OatppSqliteTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - # Current dir is "test_package/build/" and CMakeLists.txt is - # in "test_package" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) - - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-sqlite/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-sqlite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..ec8289a60ed9c8 --- /dev/null +++ b/recipes/oatpp-sqlite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-sqlite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-sqlite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-sqlite/all/test_v1_package/conanfile.py b/recipes/oatpp-sqlite/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/oatpp-sqlite/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 126c82ea8eda5d5a274c64b9d95727a487783076 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 16:45:38 +0200 Subject: [PATCH 015/300] (#13505) oatpp-openssl: conan v2 support --- recipes/oatpp-openssl/all/CMakeLists.txt | 7 - recipes/oatpp-openssl/all/conanfile.py | 120 ++++++++++-------- .../all/test_package/CMakeLists.txt | 13 +- .../all/test_package/conanfile.py | 20 ++- .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 17 +++ 6 files changed, 115 insertions(+), 73 deletions(-) delete mode 100644 recipes/oatpp-openssl/all/CMakeLists.txt create mode 100644 recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/oatpp-openssl/all/test_v1_package/conanfile.py diff --git a/recipes/oatpp-openssl/all/CMakeLists.txt b/recipes/oatpp-openssl/all/CMakeLists.txt deleted file mode 100644 index 7b920d87ae6279..00000000000000 --- a/recipes/oatpp-openssl/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) # Mininum as required oatpp -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-openssl/all/conanfile.py b/recipes/oatpp-openssl/all/conanfile.py index b250393d708ccf..d109d1b7545bb2 100644 --- a/recipes/oatpp-openssl/all/conanfile.py +++ b/recipes/oatpp-openssl/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" + class OatppOpenSSLConan(ConanFile): name = "oatpp-openssl" @@ -11,21 +17,16 @@ class OatppOpenSSLConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "Oat++ OpenSSL library" topics = ("oat++", "oatpp", "openssl") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -33,60 +34,75 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-openssl can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-openssl requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("oatpp/" + self.version) - self.requires("openssl/3.0.1") + self.requires(f"oatpp/{self.version}") + self.requires("openssl/3.0.5") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def _configure_cmake(self): - if self._cmake: - return self._cmake + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-openssl" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-openssl" self.cpp_info.set_property("cmake_file_name", "oatpp-openssl") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-openssl") - self.cpp_info.components["_oatpp-openssl"].names["cmake_find_package"] = "oatpp-openssl" - self.cpp_info.components["_oatpp-openssl"].names["cmake_find_package_multi"] = "oatpp-openssl" - self.cpp_info.components["_oatpp-openssl"].set_property("cmake_target_name", "oatpp::oatpp-openssl") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-openssl"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-openssl") + os.path.join("include", f"oatpp-{self.version}", "oatpp-openssl") ] - self.cpp_info.components["_oatpp-openssl"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-openssl"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-openssl"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-openssl"].bindirs = [] self.cpp_info.components["_oatpp-openssl"].libs = ["oatpp-openssl"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-openssl"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-openssl" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-openssl" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-openssl"].names["cmake_find_package"] = "oatpp-openssl" + self.cpp_info.components["_oatpp-openssl"].names["cmake_find_package_multi"] = "oatpp-openssl" + self.cpp_info.components["_oatpp-openssl"].set_property("cmake_target_name", "oatpp::oatpp-openssl") self.cpp_info.components["_oatpp-openssl"].requires = ["oatpp::oatpp", "openssl::openssl"] diff --git a/recipes/oatpp-openssl/all/test_package/CMakeLists.txt b/recipes/oatpp-openssl/all/test_package/CMakeLists.txt index b28526769f48ca..716aedd7390f1f 100644 --- a/recipes/oatpp-openssl/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-openssl/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(oatpp-openssl REQUIRED) +find_package(oatpp-openssl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-openssl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-openssl/all/test_package/conanfile.py b/recipes/oatpp-openssl/all/test_package/conanfile.py index a77f6e7a20977c..0a6bc68712d901 100644 --- a/recipes/oatpp-openssl/all/test_package/conanfile.py +++ b/recipes/oatpp-openssl/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class OatppOpenSSLTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..07d783bdbcaec7 --- /dev/null +++ b/recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-openssl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-openssl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-openssl/all/test_v1_package/conanfile.py b/recipes/oatpp-openssl/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/oatpp-openssl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 936eef000e6242193174c2d3e875d4c0a04c5150 Mon Sep 17 00:00:00 2001 From: cguentherTUChemnitz Date: Mon, 17 Oct 2022 17:04:47 +0200 Subject: [PATCH 016/300] (#13113) qpdf/11.1.1 add (lib only) package * initial conan qpdf package implementation * make conan check hooks green: missing new line on test_package.cpp * add current cmake as build_requirements * remove comments as requested from review * remove validation check from example, which was not validated for the current pacakge * remove implicit library depdendency from example * remove further comments from example * simplify test_package to just print QPDF_VERSION * provide crypto provider selection * reenable missing system lib dependency m * cope with minor linting warnings * add gnutls option as a placeholder, to activate later on but not change package-id * remove further comments * remove not matching cleanup for packaging * add minimal as possible pdf handling to test_package to ensure link-time dependency check * cope with unused lint warning * introduce jpeg dependency option * add conan v1 test * fix up test_v1_package for shared builds: correct the build env passing to v1 * convert line breaks * fix the visual code version number to select full C++14 supported compilers * try to migrate to is_msvc instead of own version comparison for vs compiler * remove duplicated test package source file * clean import statement * go for string based compiler version comparison * call binaries of the package directly without manual path determination to ensure they are exisiting in PATH * provide pkgconf as explicit build dependency, since msvc has it not preinstalled and the others are only green because of implicit shipment in ci env * revert import review change, since it triggers the linter * patch level update qpdf to 11.1.1 * fix missing version update entry in config.yml * try to fix linter on import statement * add packageConfigDeps and virtual build env to toolchain configure handling * current workaround for missing pkg_config dependency retrieval from cmake qpdf project: set PKG_CONFIG_PATH manually * switch to working openssl version as qpdf dependency * switch to libqpdf build only; patch qpdf cmake build files, injecting conans CMakeDeps * cope with linter warning * remove not anymore compiled binaries from test_v1 * apply review changes * disable mac shared builds * try to get around windows and mac shared lib missing symbols into libjpeg, potentially caused by private linkage of libjpeg * try to fix missing libjpeg symols problem for shared libs on windows according to review * provide cmake dependencies also to shared and static lib target directly and not only to the object lib * try to reenable mac os, since the missing symbols should be caused on windows and mac for same reason * reuse existing target_link_libraries calls and append conan libs to them instead of calling it multiple times * add missing public entries to target_link_libraries * move cmake deps out of atomic library check and set only once for every library type * remove wrongly reintroduces target_link_libraries from overwritten qpdf deps * try to fix msvc tests with code-path avoiding #warning macro * cope with linter error * add necessary compile-definition also to test_v1_package * cope with linter error * Update recipes/qpdf/all/conanfile.py Co-authored-by: Jordan Williams * Update recipes/qpdf/all/test_package/CMakeLists.txt Co-authored-by: Jordan Williams * Update recipes/qpdf/all/test_v1_package/CMakeLists.txt Co-authored-by: Jordan Williams * Update recipes/qpdf/all/conanfile.py Co-authored-by: Jordan Williams * Update recipes/qpdf/all/test_v1_package/CMakeLists.txt Co-authored-by: Jordan Williams * make it link correctly again * remove not anymore necessary way to provide conan dependencies via pkg_config, since we patch CMakeDeps already in the qpdf build * Update recipes/qpdf/all/conanfile.py Co-authored-by: Jordan Williams * Update recipes/qpdf/all/conanfile.py Co-authored-by: Jordan Williams * fix python function name definition * avoid cmake SEND_ERROR and FATAL_ERROR on patched-away dependency handling * fix patch base addresses * Update recipes/qpdf/all/conandata.yml Co-authored-by: Chris Mc * Update recipes/qpdf/all/conanfile.py Co-authored-by: Chris Mc * export example file with fixed path from binary instead of agrument from test_package/conanfile.py * clarify options names: with_crypto -> with_ssl; native -> internal * avoid code-duplication in patch-files, go for conditional python patching of already patched file instead * review-changes: add description and type for patches * follow more precise the documentation guideline * prepare gnutls config * deactivate special windows exernal lib handling * Patch found crypto flags, corresponding to conan options. This should finally fix windows plattform of not enabling openssl sources, even when conan does provide openssl. * update dependencies * remove slightly misleading comment Co-authored-by: Jordan Williams Co-authored-by: Chris Mc --- recipes/qpdf/all/conandata.yml | 12 ++ recipes/qpdf/all/conanfile.py | 181 ++++++++++++++++++ .../0001-libqpdf-cmake-deps-jpeg-zlib.patch | 113 +++++++++++ ...xclude-unnecessary-cmake-subprojects.patch | 17 ++ recipes/qpdf/all/test_package/CMakeLists.txt | 12 ++ recipes/qpdf/all/test_package/conanfile.py | 24 +++ .../qpdf/all/test_package/test_package.cpp | 21 ++ .../qpdf/all/test_v1_package/CMakeLists.txt | 15 ++ recipes/qpdf/all/test_v1_package/conanfile.py | 19 ++ recipes/qpdf/config.yml | 3 + 10 files changed, 417 insertions(+) create mode 100644 recipes/qpdf/all/conandata.yml create mode 100644 recipes/qpdf/all/conanfile.py create mode 100644 recipes/qpdf/all/patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch create mode 100644 recipes/qpdf/all/patches/0002-exclude-unnecessary-cmake-subprojects.patch create mode 100644 recipes/qpdf/all/test_package/CMakeLists.txt create mode 100644 recipes/qpdf/all/test_package/conanfile.py create mode 100644 recipes/qpdf/all/test_package/test_package.cpp create mode 100644 recipes/qpdf/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/qpdf/all/test_v1_package/conanfile.py create mode 100644 recipes/qpdf/config.yml diff --git a/recipes/qpdf/all/conandata.yml b/recipes/qpdf/all/conandata.yml new file mode 100644 index 00000000000000..6a5e7ead04475a --- /dev/null +++ b/recipes/qpdf/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "11.1.1": + url: "https://github.com/qpdf/qpdf/archive/refs/tags/v11.1.1.tar.gz" + sha256: "785edab622a1bc7e25e1537ad2c325005d48c5c7957f7abedff405deb80fa59a" +patches: + "11.1.1": + - patch_file: "patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch" + patch_description: "Inject Conan Deps, disable qpdf-dep handling: update libqpdf/CMakeLists.txt by disabling cmake fails, caused by pkg_config fail to find dependencies. Add conan generated cmake dependencies instead." + patch_type: "conan" + - patch_file: "patches/0002-exclude-unnecessary-cmake-subprojects.patch" + patch_description: "Exclude unnecessary targets: update CMakeLists.txt removing subdir includes for binaries, tests, examples, docs and fuzzing" + patch_type: "conan" diff --git a/recipes/qpdf/all/conanfile.py b/recipes/qpdf/all/conanfile.py new file mode 100644 index 00000000000000..749ef210e85f2d --- /dev/null +++ b/recipes/qpdf/all/conanfile.py @@ -0,0 +1,181 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.files import replace_in_file, apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc, check_min_vs +from conan.tools.env import VirtualBuildEnv +import os + +required_conan_version = ">=1.52.0" + +class PackageConan(ConanFile): + name = "qpdf" + description = "QPDF is a command-line tool and C++ library that performs content-preserving transformations on PDF files." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/qpdf/qpdf" + topics = ("pdf") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_ssl": ["internal", "openssl", "gnutls"], + "with_jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg"], + } + default_options = { + "shared": False, + "fPIC": True, + "with_ssl": "openssl", + "with_jpeg": "libjpeg", + } + + @property + def _minimum_cpp_standard(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "3.4", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + # https://qpdf.readthedocs.io/en/stable/installation.html#basic-dependencies + self.requires("zlib/1.2.13") + if self.options.with_ssl == "openssl": + self.requires("openssl/1.1.1q") + elif self.options.with_ssl == "gnutls": + raise ConanInvalidConfiguration("GnuTLS is not available in Conan Center yet.") + if self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") + + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + if is_msvc(self): + check_min_vs(self, "150") + else: + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + + def build_requirements(self): + self.tool_requires("cmake/3.24.1") + self.tool_requires("pkgconf/1.9.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + # https://qpdf.readthedocs.io/en/latest/installation.html#build-time-crypto-selection + tc.variables["USE_IMPLICIT_CRYPTO"] = False + tc.cache_variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + if self.options.with_ssl == "internal": + tc.variables["REQUIRE_CRYPTO_NATIVE"] = True + tc.variables["REQUIRE_CRYPTO_GNUTLS"] = False + tc.variables["REQUIRE_CRYPTO_OPENSSL"] = False + if self.options.with_ssl == "openssl": + tc.variables["REQUIRE_CRYPTO_NATIVE"] = False + tc.variables["REQUIRE_CRYPTO_GNUTLS"] = False + tc.variables["REQUIRE_CRYPTO_OPENSSL"] = True + if self.options.with_ssl == "gnutls": + tc.variables["REQUIRE_CRYPTO_NATIVE"] = False + tc.variables["REQUIRE_CRYPTO_GNUTLS"] = True + tc.variables["REQUIRE_CRYPTO_OPENSSL"] = False + tc.generate() + # TODO: after https://github.com/conan-io/conan/issues/11962 is solved + # we might obsolete here cmake deps generation and cmake patching and get + # the possibility to go for to pkg_config based dependency discovery instead. + # At the moment, even with the linked work-around, the linkage is mixed-up + tc = CMakeDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") + + def _patch_sources(self): + apply_conandata_patches(self) + # we generally expect to have one crypto in-place, but need to patch the found mechanics + # since we avoid currently the correct pkg_config + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "set(FOUND_CRYPTO OFF)", "set(FOUND_CRYPTO ON)") + if self.options.with_ssl == "openssl": + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "set(USE_CRYPTO_OPENSSL OFF)", "set(USE_CRYPTO_OPENSSL ON)") + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "find_package(ZLIB REQUIRED)", + "find_package(ZLIB REQUIRED)\nfind_package(OpenSSL REQUIRED)\n") + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "PUBLIC JPEG::JPEG ZLIB::ZLIB", "PUBLIC JPEG::JPEG ZLIB::ZLIB OpenSSL::SSL") + if self.options.with_ssl == "gnutls": + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "set(USE_CRYPTO_GNUTLS OFF)", "set(USE_CRYPTO_GNUTLS ON)") + if self.options.with_ssl == "internal": + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "set(USE_CRYPTO_NATIVE OFF)", "set(USE_CRYPTO_NATIVE ON)") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "qpdf") + + self.cpp_info.components["libqpdf"].libs = ["qpdf"] + self.cpp_info.components["libqpdf"].set_property("pkg_config_name", "libqpdf") + self.cpp_info.components["libqpdf"].set_property("cmake_target_name", "qpdf::libqpdf") + self.cpp_info.components["libqpdf"].requires.append("zlib::zlib") + self.cpp_info.components["libqpdf"].requires.append(f"{self.options.with_jpeg}::{self.options.with_jpeg}") + + if self.options.with_ssl == "openssl": + self.cpp_info.components["libqpdf"].requires.append("openssl::openssl") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libqpdf"].system_libs.append("m") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "qpdf" + self.cpp_info.filenames["cmake_find_package_multi"] = "qpdf" + self.cpp_info.names["cmake_find_package"] = "qpdf" + self.cpp_info.names["cmake_find_package_multi"] = "qpdf" + self.cpp_info.components["libqpdf"].names["cmake_find_package"] = "libqpdf" + self.cpp_info.components["libqpdf"].names["cmake_find_package_multi"] = "libqpdf" diff --git a/recipes/qpdf/all/patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch b/recipes/qpdf/all/patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch new file mode 100644 index 00000000000000..0d8edceb557a6e --- /dev/null +++ b/recipes/qpdf/all/patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch @@ -0,0 +1,113 @@ +diff --git a/libqpdf/CMakeLists.txt b/libqpdf/CMakeLists.txt +index 7053e205..9f5962f7 100644 +--- a/libqpdf/CMakeLists.txt ++++ b/libqpdf/CMakeLists.txt +@@ -128,13 +128,8 @@ include(CheckSymbolExists) + set(dep_include_directories) + set(dep_link_directories) + set(dep_link_libraries) +-set(ANYTHING_MISSING 0) + +-if(WIN32 AND (EXISTS ${qpdf_SOURCE_DIR}/external-libs)) +- set(EXTERNAL_LIBS 1) +-else() +- set(EXTERNAL_LIBS 0) +-endif() ++set(EXTERNAL_LIBS 0) + + if(EXTERNAL_LIBS) + set(EXTLIBDIR ${qpdf_SOURCE_DIR}/external-libs) +@@ -161,9 +156,6 @@ if(NOT EXTERNAL_LIBS) + if(ZLIB_H_PATH AND ZLIB_LIB_PATH) + list(APPEND dep_include_directories ${ZLIB_H_PATH}) + list(APPEND dep_link_libraries ${ZLIB_LIB_PATH}) +- else() +- message(SEND_ERROR "zlib not found") +- set(ANYTHING_MISSING 1) + endif() + endif() + endif() +@@ -182,9 +174,6 @@ if(NOT EXTERNAL_LIBS) + list(APPEND dep_include_directories ${LIBJPEG_H_PATH}) + list(APPEND dep_link_libraries ${LIBJPEG_LIB_PATH}) + set(JPEG_INCLUDE ${LIBJPEG_H_PATH}) +- else() +- message(SEND_ERROR "libjpeg not found") +- set(ANYTHING_MISSING 1) + endif() + endif() + endif() +@@ -220,9 +209,6 @@ if(USE_IMPLICIT_CRYPTO OR REQUIRE_CRYPTO_OPENSSL) + list(APPEND dep_link_libraries ${OPENSSL_LIB_PATH}) + set(USE_CRYPTO_OPENSSL ON) + set(FOUND_CRYPTO ON) +- elseif(REQUIRE_CRYPTO_OPENSSL) +- message(SEND_ERROR "openssl not found") +- set(ANYTHING_MISSING 1) + endif() + endif() + endif() +@@ -241,9 +227,6 @@ if(USE_IMPLICIT_CRYPTO OR REQUIRE_CRYPTO_GNUTLS) + list(APPEND dep_link_libraries ${GNUTLS_LIB_PATH}) + set(USE_CRYPTO_GNUTLS ON) + set(FOUND_CRYPTO ON) +- elseif(REQUIRE_CRYPTO_GNUTLS) +- message(SEND_ERROR "gnutls not found") +- set(ANYTHING_MISSING 1) + endif() + endif() + endif() +@@ -268,14 +251,9 @@ if(FOUND_CRYPTO) + set(DEFAULT_CRYPTO "native") + endif() + endif() +-else() +- message(SEND_ERROR "no crypto provider is available") +- set(ANYTHING_MISSING 1) +-endif() +-if(ANYTHING_MISSING) +- message(FATAL_ERROR "Missing dependencies; unable to continue") + endif() + ++ + message(STATUS "") + message(STATUS "*** Crypto Summary ***") + message(STATUS " GNU TLS crypto enabled: " ${USE_CRYPTO_GNUTLS}) +@@ -403,6 +381,10 @@ endif() + # use PIC for the object library so we don't have to compile twice. + set(OBJECT_LIB libqpdf_object) + add_library(${OBJECT_LIB} OBJECT ${libqpdf_SOURCES}) ++find_package(JPEG REQUIRED) ++find_package(ZLIB REQUIRED) ++target_link_libraries(${OBJECT_LIB} PUBLIC JPEG::JPEG ZLIB::ZLIB) ++ + if(OBJECT_LIB_IS_PIC) + target_compile_definitions(${OBJECT_LIB} PRIVATE libqpdf_EXPORTS) + endif() +@@ -498,8 +480,6 @@ if(BUILD_SHARED_LIBS) + PUBLIC + $ + $) +- target_link_directories(${SHARED_LIB} PRIVATE ${dep_link_directories}) +- target_link_libraries(${SHARED_LIB} PRIVATE ${dep_link_libraries}) + if(ATOMIC_LIBRARY) + target_link_libraries(${SHARED_LIB} PRIVATE ${ATOMIC_LIBRARY}) + endif() +@@ -507,6 +487,8 @@ if(BUILD_SHARED_LIBS) + target_link_options(${SHARED_LIB} PRIVATE ${LD_VERSION_FLAGS}) + endif() + ++ target_link_libraries(${SHARED_LIB} PUBLIC JPEG::JPEG ZLIB::ZLIB) ++ + target_include_directories(${SHARED_LIB} + PRIVATE ${qpdf_SOURCE_DIR}/libqpdf ${CMAKE_CURRENT_BINARY_DIR}) + +@@ -544,6 +526,8 @@ if(BUILD_STATIC_LIBS) + target_link_libraries(${STATIC_LIB} INTERFACE ${ATOMIC_LIBRARY}) + endif() + ++ target_link_libraries(${STATIC_LIB} PUBLIC JPEG::JPEG ZLIB::ZLIB) ++ + # Avoid name clashes on Windows with the the DLL import library. + if(NOT DEFINED STATIC_SUFFIX AND BUILD_SHARED_LIBS) + if (WIN32) diff --git a/recipes/qpdf/all/patches/0002-exclude-unnecessary-cmake-subprojects.patch b/recipes/qpdf/all/patches/0002-exclude-unnecessary-cmake-subprojects.patch new file mode 100644 index 00000000000000..2e40ca26d687e5 --- /dev/null +++ b/recipes/qpdf/all/patches/0002-exclude-unnecessary-cmake-subprojects.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5c0915f3..6c4945d3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -323,12 +323,6 @@ add_test( + # add_subdirectory order affects test order + add_subdirectory(include) + add_subdirectory(libqpdf) +-add_subdirectory(qpdf) +-add_subdirectory(libtests) +-add_subdirectory(examples) +-add_subdirectory(zlib-flate) +-add_subdirectory(manual) +-add_subdirectory(fuzz) + + # We don't need to show everything -- just the things that we really + # need to be sure are right or that are turned on or off with complex diff --git a/recipes/qpdf/all/test_package/CMakeLists.txt b/recipes/qpdf/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..2892d11ff1f83b --- /dev/null +++ b/recipes/qpdf/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(qpdf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qpdf::libqpdf) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +# msvc has problems consuming #warning macro +# therefore we need a code-path in the include avoiding this warning https://github.com/qpdf/qpdf/issues/804 +target_compile_definitions(${PROJECT_NAME} PUBLIC POINTERHOLDER_TRANSITION=4) diff --git a/recipes/qpdf/all/test_package/conanfile.py b/recipes/qpdf/all/test_package/conanfile.py new file mode 100644 index 00000000000000..57b63cfec4d160 --- /dev/null +++ b/recipes/qpdf/all/test_package/conanfile.py @@ -0,0 +1,24 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/qpdf/all/test_package/test_package.cpp b/recipes/qpdf/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..f79386dd766bb9 --- /dev/null +++ b/recipes/qpdf/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include +#include +#include + +int main(int argc, char* argv[]) +{ + std::cout << "QPDF_VERSION " << QPDF_VERSION << "\n"; + + try { + QPDF pdf; + pdf.emptyPDF(); + QPDFWriter w(pdf, "empty_example.pdf"); + w.write(); + } catch (std::exception& e) { + std::cerr << e.what() << "\n"; + exit(2); + } + + return 0; +} diff --git a/recipes/qpdf/all/test_v1_package/CMakeLists.txt b/recipes/qpdf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..ccb1cc676af038 --- /dev/null +++ b/recipes/qpdf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(qpdf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qpdf::libqpdf) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +# msvc has problems consuming #warning macro +# therefore we need a code-path in the include avoiding this warning https://github.com/qpdf/qpdf/issues/804 +target_compile_definitions(${PROJECT_NAME} PUBLIC POINTERHOLDER_TRANSITION=4) diff --git a/recipes/qpdf/all/test_v1_package/conanfile.py b/recipes/qpdf/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c492184eec19c2 --- /dev/null +++ b/recipes/qpdf/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/qpdf/config.yml b/recipes/qpdf/config.yml new file mode 100644 index 00000000000000..35a13df3f72ef6 --- /dev/null +++ b/recipes/qpdf/config.yml @@ -0,0 +1,3 @@ +versions: + "11.1.1": + folder: all From 7c9b065df898fe7c4ca94c40f8f12cff13562962 Mon Sep 17 00:00:00 2001 From: Josh Faust <1388377+jfaust@users.noreply.github.com> Date: Mon, 17 Oct 2022 08:24:44 -0700 Subject: [PATCH 017/300] (#13430) cgltf: add version 1.13 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/cgltf/all/conandata.yml | 3 +++ recipes/cgltf/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/cgltf/all/conandata.yml b/recipes/cgltf/all/conandata.yml index 690b56f17fa08a..e54cb4331e8470 100644 --- a/recipes/cgltf/all/conandata.yml +++ b/recipes/cgltf/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.13": + url: "https://github.com/jkuhlmann/cgltf/archive/v1.13.tar.gz" + sha256: "053d5320097334767486c6e33d01dd1b1c6224eac82aac2d720f4ec456d8c50b" "1.12": url: "https://github.com/jkuhlmann/cgltf/archive/v1.12.tar.gz" sha256: "2c429bb26256b49bfed2510aef1e5fa9321b27fe4cf226c9ece9a5867150974f" diff --git a/recipes/cgltf/config.yml b/recipes/cgltf/config.yml index 134adfa22de6f3..9f334f27c89c67 100644 --- a/recipes/cgltf/config.yml +++ b/recipes/cgltf/config.yml @@ -1,4 +1,6 @@ versions: + "1.13": + folder: all "1.12": folder: all "1.11": From dac3d78e797fb0bc1bf464020caf631539f32fe9 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 17:47:03 +0200 Subject: [PATCH 018/300] (#13501) libe57format: conan v2 support * conan v2 support * add missing include of limits to fix gcc11 * add libm to system libs * use self.dependencies Co-authored-by: Uilian Ries Co-authored-by: Uilian Ries --- recipes/libe57format/all/CMakeLists.txt | 7 -- recipes/libe57format/all/conandata.yml | 4 +- recipes/libe57format/all/conanfile.py | 84 +++++++++---------- .../{fix-pic.patch => 0001-fix-pic.patch} | 0 .../all/patches/0002-missing-include.patch | 11 +++ .../all/test_package/CMakeLists.txt | 11 +-- .../all/test_package/conanfile.py | 21 +++-- .../all/test_v1_package/CMakeLists.txt | 11 +++ .../all/test_v1_package/conanfile.py | 17 ++++ 9 files changed, 100 insertions(+), 66 deletions(-) delete mode 100644 recipes/libe57format/all/CMakeLists.txt rename recipes/libe57format/all/patches/{fix-pic.patch => 0001-fix-pic.patch} (100%) create mode 100644 recipes/libe57format/all/patches/0002-missing-include.patch create mode 100644 recipes/libe57format/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libe57format/all/test_v1_package/conanfile.py diff --git a/recipes/libe57format/all/CMakeLists.txt b/recipes/libe57format/all/CMakeLists.txt deleted file mode 100644 index 9719e759ff2b53..00000000000000 --- a/recipes/libe57format/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/libe57format/all/conandata.yml b/recipes/libe57format/all/conandata.yml index 2431f660af552f..ca42e36ed36ec9 100644 --- a/recipes/libe57format/all/conandata.yml +++ b/recipes/libe57format/all/conandata.yml @@ -4,5 +4,5 @@ sources: url: "https://github.com/asmaloney/libE57Format/archive/refs/tags/v2.2.0.tar.gz" patches: "2.2.0": - - patch_file: "patches/fix-pic.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-pic.patch" + - patch_file: "patches/0002-missing-include.patch" diff --git a/recipes/libe57format/all/conanfile.py b/recipes/libe57format/all/conanfile.py index 0fbd3acb1699a7..479e129d3bbf35 100644 --- a/recipes/libe57format/all/conanfile.py +++ b/recipes/libe57format/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class LibE57FormatConan(ConanFile): @@ -13,7 +16,7 @@ class LibE57FormatConan(ConanFile): description = "Library for reading & writing the E57 file format" topics = ("e57", "io", "point-cloud") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,21 +26,8 @@ class LibE57FormatConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,66 +35,72 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("xerces-c/3.2.3") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, "11") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USING_STATIC_XERCES"] = not self.options["xerces-c"].shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USING_STATIC_XERCES"] = not self.dependencies["xerces-c"].options.shared + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"E57Format": "E57Format::E57Format"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "e57format") self.cpp_info.set_property("cmake_target_name", "E57Format") suffix = "-d" if self.settings.build_type == "Debug" else "" - self.cpp_info.libs = ["E57Format{}".format(suffix)] - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.libs = [f"E57Format{suffix}"] + if self.settings.os in ["Linux", "FreeBSD"] and not self.options.shared: + self.cpp_info.system_libs.extend(["m", "pthread"]) # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "e57format" diff --git a/recipes/libe57format/all/patches/fix-pic.patch b/recipes/libe57format/all/patches/0001-fix-pic.patch similarity index 100% rename from recipes/libe57format/all/patches/fix-pic.patch rename to recipes/libe57format/all/patches/0001-fix-pic.patch diff --git a/recipes/libe57format/all/patches/0002-missing-include.patch b/recipes/libe57format/all/patches/0002-missing-include.patch new file mode 100644 index 00000000000000..50253b05d6c2ac --- /dev/null +++ b/recipes/libe57format/all/patches/0002-missing-include.patch @@ -0,0 +1,11 @@ +--- a/src/E57XmlParser.cpp ++++ b/src/E57XmlParser.cpp +@@ -42,6 +42,8 @@ + #include "StringNodeImpl.h" + #include "VectorNodeImpl.h" + ++#include ++ + using namespace e57; + using namespace XERCES_CPP_NAMESPACE; + diff --git a/recipes/libe57format/all/test_package/CMakeLists.txt b/recipes/libe57format/all/test_package/CMakeLists.txt index 2b2a28ed1bc7f5..b8de16fa4046ca 100644 --- a/recipes/libe57format/all/test_package/CMakeLists.txt +++ b/recipes/libe57format/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(e57format REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -find_package(e57format REQUIRED CONFIG) target_link_libraries(${PROJECT_NAME} PRIVATE E57Format) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libe57format/all/test_package/conanfile.py b/recipes/libe57format/all/test_package/conanfile.py index 49a3a66ea5bad4..0a6bc68712d901 100644 --- a/recipes/libe57format/all/test_package/conanfile.py +++ b/recipes/libe57format/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libe57format/all/test_v1_package/CMakeLists.txt b/recipes/libe57format/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..2bf6344a5bafd0 --- /dev/null +++ b/recipes/libe57format/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(e57format REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE E57Format) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libe57format/all/test_v1_package/conanfile.py b/recipes/libe57format/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libe57format/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From c6aba0696c3b0e53bb44961e409803ea1b3da8a5 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 17 Oct 2022 18:05:07 +0200 Subject: [PATCH 019/300] (#13443) cgal: add version 5.5.1 --- recipes/cgal/all/conandata.yml | 3 +++ recipes/cgal/all/conanfile.py | 4 ++-- recipes/cgal/config.yml | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/recipes/cgal/all/conandata.yml b/recipes/cgal/all/conandata.yml index 3e1bbd3d7b2e66..a9e86a33613438 100644 --- a/recipes/cgal/all/conandata.yml +++ b/recipes/cgal/all/conandata.yml @@ -14,3 +14,6 @@ sources: "5.5": sha256: 98ac395ca08aacf38b7a8170a822b650aedf10355df41dd0e4bfb238408e08a6 url: https://github.com/CGAL/cgal/releases/download/v5.5/CGAL-5.5.tar.xz + "5.5.1": + sha256: 091630def028facdcaf00eb5b68ad79eddac1b855cca6e87eef18a031566edfc + url: https://github.com/CGAL/cgal/releases/download/v5.5.1/CGAL-5.5.1.tar.xz diff --git a/recipes/cgal/all/conanfile.py b/recipes/cgal/all/conanfile.py index f62ead24fa3d78..47cc7c6fa95ce6 100644 --- a/recipes/cgal/all/conanfile.py +++ b/recipes/cgal/all/conanfile.py @@ -11,8 +11,8 @@ class CgalConan(ConanFile): license = "GPL-3.0-or-later", "LGPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/CGAL/cgal" - description = "C++ library that aims to provide easy access to efficient and reliable algorithms"\ - "in computational geometry." + description = "C++ library that provides easy access to efficient and reliable algorithms"\ + " in computational geometry." topics = ("cgal", "geometry", "algorithms") settings = "os", "compiler", "build_type", "arch" generators = "cmake" diff --git a/recipes/cgal/config.yml b/recipes/cgal/config.yml index 857541c90fe5c0..72209e170658c8 100644 --- a/recipes/cgal/config.yml +++ b/recipes/cgal/config.yml @@ -9,3 +9,5 @@ versions: folder: all "5.5": folder: all + "5.5.1": + folder: all From 24ea2b48bb76a64cd7d2c8f4ff11fbae5b69c6a6 Mon Sep 17 00:00:00 2001 From: Eric Riff <57375845+ericriff@users.noreply.github.com> Date: Mon, 17 Oct 2022 13:24:44 -0300 Subject: [PATCH 020/300] (#13492) libsvm: Add version 330 & modernize recipe * Add version 330 * Modernize recipe * Use fstring * Clean up topics Co-authored-by: Jordan Williams * Link privately Co-authored-by: Jordan Williams * Link privately * Fix system libs * Use "src" as source subfolder for consistency with other recipes. Pass the source dir as a variable also for consistency. * Use new copy method Co-authored-by: Jordan Williams * Be explicit about the licences path Co-authored-by: Uilian Ries * Add missing GNUInstallDirs include * Fix typo Co-authored-by: Jordan Williams Co-authored-by: Uilian Ries --- recipes/libsvm/all/CMakeLists.txt | 17 +++--- recipes/libsvm/all/conandata.yml | 3 + recipes/libsvm/all/conanfile.py | 61 +++++++++++-------- .../libsvm/all/test_package/CMakeLists.txt | 5 +- recipes/libsvm/all/test_package/conanfile.py | 21 +++++-- .../libsvm/all/test_v1_package/CMakeLists.txt | 10 +++ .../libsvm/all/test_v1_package/conanfile.py | 18 ++++++ recipes/libsvm/config.yml | 2 + 8 files changed, 93 insertions(+), 44 deletions(-) create mode 100644 recipes/libsvm/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libsvm/all/test_v1_package/conanfile.py diff --git a/recipes/libsvm/all/CMakeLists.txt b/recipes/libsvm/all/CMakeLists.txt index 94b3d9d728f7d4..3c3e2d6052401c 100644 --- a/recipes/libsvm/all/CMakeLists.txt +++ b/recipes/libsvm/all/CMakeLists.txt @@ -1,20 +1,19 @@ cmake_minimum_required(VERSION 3.4) project(svm C CXX) -include(${CMAKE_SOURCE_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +include(GNUInstallDirs) -add_library(svm source_subfolder/svm.cpp) +add_library(svm ${LIBSVM_SRC_DIR}/svm.cpp) set_property(TARGET svm PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON) -set_target_properties(svm PROPERTIES PUBLIC_HEADER source_subfolder/svm.h) +set_target_properties(svm PROPERTIES PUBLIC_HEADER ${LIBSVM_SRC_DIR}/svm.h) -add_executable(svm-predict source_subfolder/svm-predict.c) +add_executable(svm-predict ${LIBSVM_SRC_DIR}/svm-predict.c) target_link_libraries(svm-predict svm) -add_executable(svm-train source_subfolder/svm-train.c) +add_executable(svm-train ${LIBSVM_SRC_DIR}/svm-train.c) target_link_libraries(svm-train svm) -add_executable(svm-scale source_subfolder/svm-scale.c) +add_executable(svm-scale ${LIBSVM_SRC_DIR}/svm-scale.c) install(TARGETS svm RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -23,4 +22,6 @@ install(TARGETS svm PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/svm ) -install(TARGETS svm-predict svm-train svm-scale DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS svm-predict svm-train svm-scale + DESTINATION ${CMAKE_INSTALL_BINDIR} + ) diff --git a/recipes/libsvm/all/conandata.yml b/recipes/libsvm/all/conandata.yml index 5cf318b9846a69..5712311441eb33 100644 --- a/recipes/libsvm/all/conandata.yml +++ b/recipes/libsvm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "330": + url: "https://github.com/cjlin1/libsvm/archive/v330.tar.gz" + sha256: "e4fe41308c87cc210aec73e4f5f0fb4da14234d90e7a131763fbad3788ca2d80" "325": url: "https://github.com/cjlin1/libsvm/archive/v325.tar.gz" sha256: "1f587ec0df6fd422dfe50f942f8836ac179b0723b768fe9d2fabdfd1601a0963" diff --git a/recipes/libsvm/all/conanfile.py b/recipes/libsvm/all/conanfile.py index 794619a3eb1c55..897e5749def0c7 100644 --- a/recipes/libsvm/all/conanfile.py +++ b/recipes/libsvm/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy -required_conan_version = ">=1.33.0" +import os +required_conan_version = ">=1.52.0" class libsvmConan(ConanFile): name = "libsvm" @@ -10,17 +13,16 @@ class libsvmConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/" license = "BSD-3-Clause" - topics = ("conan", "svm", "vector") - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + topics = "svm", "vector" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + options = { + "shared": [True, False], + "fPIC": [True, False] + } + default_options = { + "shared": False, + "fPIC": True + } def config_options(self): if self.settings.os == "Windows": @@ -37,30 +39,35 @@ def validate(self): self.options.shared ): raise ConanInvalidConfiguration( - "{} can not be built as shared library + runtime {}.".format( - self.name, - self.settings.compiler.runtime - ) + f"{self.name} can not be built as shared library + runtime {self.settings.compiler.runtime}." ) + def layout(self): + cmake_layout(self, src_folder="src") + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBSVM_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("COPYRIGHT", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYRIGHT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["svm"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] diff --git a/recipes/libsvm/all/test_package/CMakeLists.txt b/recipes/libsvm/all/test_package/CMakeLists.txt index 37cb8eb98e622c..40fb8732f7ba3a 100644 --- a/recipes/libsvm/all/test_package/CMakeLists.txt +++ b/recipes/libsvm/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libsvm CONFIG REQUIRED) add_executable(test_package test_package.cpp) -target_link_libraries(test_package ${CONAN_LIBS}) +target_link_libraries(test_package PRIVATE libsvm::libsvm) diff --git a/recipes/libsvm/all/test_package/conanfile.py b/recipes/libsvm/all/test_package/conanfile.py index a59a26a52c8dcd..1a65f5a41c6268 100644 --- a/recipes/libsvm/all/test_package/conanfile.py +++ b/recipes/libsvm/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsvm/all/test_v1_package/CMakeLists.txt b/recipes/libsvm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..053cf33af70e52 --- /dev/null +++ b/recipes/libsvm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(PackageTest CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libsvm CONFIG REQUIRED) + +add_executable(test_package ../test_package/test_package.cpp) +target_link_libraries(test_package PRIVATE libsvm::libsvm) diff --git a/recipes/libsvm/all/test_v1_package/conanfile.py b/recipes/libsvm/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c1c8554eae2432 --- /dev/null +++ b/recipes/libsvm/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building + +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libsvm/config.yml b/recipes/libsvm/config.yml index eee94a5e39ec3f..026fbb9e303568 100644 --- a/recipes/libsvm/config.yml +++ b/recipes/libsvm/config.yml @@ -1,4 +1,6 @@ versions: + "330": + folder: all "325": folder: all "324": From 167806208975d053938a5b60f4b43b2aae04d469 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 18:45:28 +0200 Subject: [PATCH 021/300] (#13506) oatpp-postgresql: conan v2 support --- recipes/oatpp-postgresql/all/CMakeLists.txt | 7 - recipes/oatpp-postgresql/all/conandata.yml | 8 +- recipes/oatpp-postgresql/all/conanfile.py | 125 ++++++++++-------- .../all/test_package/CMakeLists.txt | 9 +- .../all/test_package/conanfile.py | 23 ++-- .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 17 +++ 7 files changed, 118 insertions(+), 82 deletions(-) delete mode 100644 recipes/oatpp-postgresql/all/CMakeLists.txt create mode 100644 recipes/oatpp-postgresql/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/oatpp-postgresql/all/test_v1_package/conanfile.py diff --git a/recipes/oatpp-postgresql/all/CMakeLists.txt b/recipes/oatpp-postgresql/all/CMakeLists.txt deleted file mode 100644 index d32836cbae4aa5..00000000000000 --- a/recipes/oatpp-postgresql/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-postgresql/all/conandata.yml b/recipes/oatpp-postgresql/all/conandata.yml index dc5c0e7bf5a997..3a58631f67a6da 100644 --- a/recipes/oatpp-postgresql/all/conandata.yml +++ b/recipes/oatpp-postgresql/all/conandata.yml @@ -11,10 +11,8 @@ sources: patches: "1.3.0": - patch_file: "patches/1.3.0/01-add-bigobj.patch" - base_path: "source_subfolder" "1.2.5": - patch_file: "patches/1.2.5/01-fix-windows-build.patch" - base_path: "source_subfolder" - # patch_type: portability - # patch_source: https://github.com/oatpp/oatpp-postgresql/pull/8 - # patch_description: Fix build error in Windows. + patch_description: Fix build error in Windows. + patch_type: portability + patch_source: https://github.com/oatpp/oatpp-postgresql/pull/8 diff --git a/recipes/oatpp-postgresql/all/conanfile.py b/recipes/oatpp-postgresql/all/conanfile.py index c223c73c7d01d4..5aa80c1777d6d2 100644 --- a/recipes/oatpp-postgresql/all/conanfile.py +++ b/recipes/oatpp-postgresql/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class OatppPostgresqlConan(ConanFile): @@ -12,25 +17,19 @@ class OatppPostgresqlConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "oat++ PostgreSQL library" topics = ("oat", "postgresql", "orm", "database") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,62 +37,76 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + try: + del self.options.fPIC + except Exception: + pass - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-postgresql can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-postgresql requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("oatpp/{}".format(self.version)) - self.requires("libpq/13.4") + self.requires(f"oatpp/{self.version}") + self.requires("libpq/14.5") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def _configure_cmake(self): - if self._cmake: - return self._cmake + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-postgresql" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-postgresql" self.cpp_info.set_property("cmake_file_name", "oatpp-postgresql") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-postgresql") - self.cpp_info.components["_oatpp-postgresql"].names["cmake_find_package"] = "oatpp-postgresql" - self.cpp_info.components["_oatpp-postgresql"].names["cmake_find_package_multi"] = "oatpp-postgresql" - self.cpp_info.components["_oatpp-postgresql"].set_property("cmake_target_name", "oatpp::oatpp-postgresql") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-postgresql"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-postgresql") + os.path.join("include", f"oatpp-{self.version}", "oatpp-postgresql") ] - self.cpp_info.components["_oatpp-postgresql"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-postgresql"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-postgresql"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-postgresql"].bindirs = [] self.cpp_info.components["_oatpp-postgresql"].libs = ["oatpp-postgresql"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-postgresql"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-postgresql" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-postgresql" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-postgresql"].names["cmake_find_package"] = "oatpp-postgresql" + self.cpp_info.components["_oatpp-postgresql"].names["cmake_find_package_multi"] = "oatpp-postgresql" + self.cpp_info.components["_oatpp-postgresql"].set_property("cmake_target_name", "oatpp::oatpp-postgresql") self.cpp_info.components["_oatpp-postgresql"].requires = ["oatpp::oatpp", "libpq::libpq"] diff --git a/recipes/oatpp-postgresql/all/test_package/CMakeLists.txt b/recipes/oatpp-postgresql/all/test_package/CMakeLists.txt index 6528f26999838b..3e6651b60950e3 100644 --- a/recipes/oatpp-postgresql/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-postgresql/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(oatpp-postgresql REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-postgresql) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-postgresql/all/test_package/conanfile.py b/recipes/oatpp-postgresql/all/test_package/conanfile.py index 30f0822166f0db..0a6bc68712d901 100644 --- a/recipes/oatpp-postgresql/all/test_package/conanfile.py +++ b/recipes/oatpp-postgresql/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - -class OatppPostgresqlTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) - - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-postgresql/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-postgresql/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..5d0c80f735ffbc --- /dev/null +++ b/recipes/oatpp-postgresql/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-postgresql REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-postgresql) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-postgresql/all/test_v1_package/conanfile.py b/recipes/oatpp-postgresql/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/oatpp-postgresql/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 64732d641eab8e2cca89c05d8a87d11c7b380425 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 19:04:38 +0200 Subject: [PATCH 022/300] (#13507) oatpp-swagger: conan v2 support --- recipes/oatpp-swagger/all/CMakeLists.txt | 7 - recipes/oatpp-swagger/all/conanfile.py | 129 ++++++++++-------- .../all/test_package/CMakeLists.txt | 13 +- .../all/test_package/conanfile.py | 23 ++-- .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 17 +++ 6 files changed, 119 insertions(+), 81 deletions(-) delete mode 100644 recipes/oatpp-swagger/all/CMakeLists.txt create mode 100644 recipes/oatpp-swagger/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/oatpp-swagger/all/test_v1_package/conanfile.py diff --git a/recipes/oatpp-swagger/all/CMakeLists.txt b/recipes/oatpp-swagger/all/CMakeLists.txt deleted file mode 100644 index d32836cbae4aa5..00000000000000 --- a/recipes/oatpp-swagger/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-swagger/all/conanfile.py b/recipes/oatpp-swagger/all/conanfile.py index 862bd63348b83e..0f264dec12f026 100644 --- a/recipes/oatpp-swagger/all/conanfile.py +++ b/recipes/oatpp-swagger/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" + class OatppSwaggerConan(ConanFile): name = "oatpp-swagger" @@ -11,21 +17,16 @@ class OatppSwaggerConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "oat++ Swagger library" topics = ("oat++", "oatpp", "swagger") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" - - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -33,66 +34,80 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + try: + del self.options.fPIC + except Exception: + pass - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-swagger can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-swagger requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("oatpp/" + self.version) + self.requires(f"oatpp/{self.version}") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - def _configure_cmake(self): - if self._cmake: - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - if tools.Version(self.version) >= "1.3.0" and self.settings.compiler == "Visual Studio": - self._cmake.definitions["OATPP_MSVC_LINK_STATIC_RUNTIME"] = self.settings.compiler.runtime in ["MT", "MTd"] - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + if Version(self.version) >= "1.3.0" and is_msvc(self): + tc.variables["OATPP_MSVC_LINK_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-swagger" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-swagger" self.cpp_info.set_property("cmake_file_name", "oatpp-swagger") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-swagger") - self.cpp_info.components["_oatpp-swagger"].names["cmake_find_package"] = "oatpp-swagger" - self.cpp_info.components["_oatpp-swagger"].names["cmake_find_package_multi"] = "oatpp-swagger" - self.cpp_info.components["_oatpp-swagger"].set_property("cmake_target_name", "oatpp::oatpp-swagger") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-swagger"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-swagger") + os.path.join("include", f"oatpp-{self.version}", "oatpp-swagger") ] - self.cpp_info.components["_oatpp-swagger"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-swagger"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-swagger"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-swagger"].bindirs = [] self.cpp_info.components["_oatpp-swagger"].libs = ["oatpp-swagger"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-swagger"].system_libs = ["pthread"] - self.cpp_info.components["_oatpp-swagger"].requires = ["oatpp::oatpp"] # export env var - res_path = os.path.join(self.package_folder, "include", "oatpp-{}".format(self.version), "bin", "oatpp-swagger", "res") - self.output.info("Creating OATPP_SWAGGER_RES_PATH environment variable: {}".format(res_path)) - self.env_info.OATPP_SWAGGER_RES_PATH = res_path + res_path = os.path.join(self.package_folder, "include", f"oatpp-{self.version}", "bin", "oatpp-swagger", "res") self.runenv_info.prepend_path("OATPP_SWAGGER_RES_PATH", res_path) + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-swagger" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-swagger" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-swagger"].names["cmake_find_package"] = "oatpp-swagger" + self.cpp_info.components["_oatpp-swagger"].names["cmake_find_package_multi"] = "oatpp-swagger" + self.cpp_info.components["_oatpp-swagger"].set_property("cmake_target_name", "oatpp::oatpp-swagger") + self.cpp_info.components["_oatpp-swagger"].requires = ["oatpp::oatpp"] + self.env_info.OATPP_SWAGGER_RES_PATH = res_path diff --git a/recipes/oatpp-swagger/all/test_package/CMakeLists.txt b/recipes/oatpp-swagger/all/test_package/CMakeLists.txt index a30f4f9f8f19b6..bc689c85dba9ba 100644 --- a/recipes/oatpp-swagger/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-swagger/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(oatpp-swagger REQUIRED) +find_package(oatpp-swagger REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-swagger) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-swagger/all/test_package/conanfile.py b/recipes/oatpp-swagger/all/test_package/conanfile.py index 3cd3965663c046..0a6bc68712d901 100644 --- a/recipes/oatpp-swagger/all/test_package/conanfile.py +++ b/recipes/oatpp-swagger/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - -class OatppSwaggerTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) - - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-swagger/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-swagger/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..9c51a16ee89251 --- /dev/null +++ b/recipes/oatpp-swagger/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-swagger REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-swagger) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-swagger/all/test_v1_package/conanfile.py b/recipes/oatpp-swagger/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/oatpp-swagger/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 0f355ca2f3cdaa72e29483f7344f1c1f6c22f923 Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Mon, 17 Oct 2022 20:24:37 +0300 Subject: [PATCH 023/300] (#13386) onetbb: add version 2021.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * check compiler version for all Apple platforms * add version 2021.6.0 * don't skip linter in v1 test package * add required system libs for Linux/FreeBSD Co-authored-by: Christian Günther * raise ConanInvalidConfiguration when attempting to make static build Co-authored-by: Christian Günther --- recipes/onetbb/all/conandata.yml | 3 ++ recipes/onetbb/all/conanfile.py | 28 +++++++++++++++---- .../onetbb/all/test_v1_package/conanfile.py | 1 - recipes/onetbb/config.yml | 2 ++ 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/recipes/onetbb/all/conandata.yml b/recipes/onetbb/all/conandata.yml index ea0c621b1ec0cf..82844371591768 100644 --- a/recipes/onetbb/all/conandata.yml +++ b/recipes/onetbb/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2021.6.0": + url: "https://github.com/oneapi-src/oneTBB/archive/v2021.6.0.tar.gz" + sha256: "4897dd106d573e9dacda8509ca5af1a0e008755bf9c383ef6777ac490223031f" "2021.3.0": url: "https://github.com/oneapi-src/oneTBB/archive/v2021.3.0.tar.gz" sha256: "8f616561603695bbb83871875d2c6051ea28f8187dbe59299961369904d1d49e" diff --git a/recipes/onetbb/all/conanfile.py b/recipes/onetbb/all/conanfile.py index 0a0702971da74d..c0f1359419b8c5 100644 --- a/recipes/onetbb/all/conanfile.py +++ b/recipes/onetbb/all/conanfile.py @@ -1,12 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, load, rmdir from conan.tools.scm import Version import os import re -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.51.3" class OneTBBConan(ConanFile): @@ -26,17 +27,21 @@ class OneTBBConan(ConanFile): "fPIC": [True, False], "tbbmalloc": [True, False], "tbbproxy": [True, False], + "interprocedural_optimization": [True, False], } default_options = { "shared": True, "fPIC": True, "tbbmalloc": False, "tbbproxy": False, + "interprocedural_optimization": True, } def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if not (Version(self.version) >= "2021.6.0" and self.options.shared and self.settings.os != "Android"): + del self.options.interprocedural_optimization if Version(self.version) < "2021.2.0": del self.options.shared del self.options.fPIC @@ -46,11 +51,12 @@ def configure(self): del self.options.fPIC def package_id(self): - del self.info.options.tbbmalloc - del self.info.options.tbbproxy + if Version(self.version) < "2021.6.0": + del self.info.options.tbbmalloc + del self.info.options.tbbproxy def validate(self): - if (self.settings.os == "Macos" + if (is_apple_os(self) and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "11.0"): raise ConanInvalidConfiguration( @@ -59,6 +65,12 @@ def validate(self): self.version, )) if not self.options.get_safe("shared", True): + if Version(self.version) >= "2021.6.0": + raise ConanInvalidConfiguration( + "Building oneTBB as a static library is highly discouraged and not supported " + "to avoid unforeseen issues like https://github.com/oneapi-src/oneTBB/issues/920. " + "Please consider fixing at least the aforementioned issue in upstream." + ) self.output.warn( "oneTBB strongly discourages usage of static linkage") if (self.options.tbbproxy @@ -78,6 +90,10 @@ def generate(self): toolchain = CMakeToolchain(self) toolchain.variables["TBB_TEST"] = False toolchain.variables["TBB_STRICT"] = False + if Version(self.version) >= "2021.6.0": + toolchain.variables["TBBMALLOC_BUILD"] = self.options.tbbmalloc + toolchain.variables["TBBMALLOC_PROXY_BUILD"] = self.options.tbbproxy + toolchain.variables["TBB_ENABLE_IPO"] = self.options.get_safe("interprocedural_optimization", False) toolchain.generate() def build(self): @@ -120,7 +136,7 @@ def lib_name(name): ) tbb.libs.append(lib_name("tbb{}".format(binary_version))) if self.settings.os in ["Linux", "FreeBSD"]: - tbb.system_libs = ["dl", "rt", "pthread"] + tbb.system_libs = ["m", "dl", "rt", "pthread"] # tbbmalloc if self.options.tbbmalloc: @@ -138,6 +154,8 @@ def lib_name(name): tbbproxy.set_property("cmake_target_name", "TBB::tbbmalloc_proxy") tbbproxy.libs = [lib_name("tbbmalloc_proxy")] tbbproxy.requires = ["tbbmalloc"] + if self.settings.os in ["Linux", "FreeBSD"]: + tbbproxy.system_libs = ["m", "dl", "pthread"] # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "TBB" diff --git a/recipes/onetbb/all/test_v1_package/conanfile.py b/recipes/onetbb/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/onetbb/all/test_v1_package/conanfile.py +++ b/recipes/onetbb/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/onetbb/config.yml b/recipes/onetbb/config.yml index 198048be7bd452..4fc6c42cf957bc 100644 --- a/recipes/onetbb/config.yml +++ b/recipes/onetbb/config.yml @@ -1,4 +1,6 @@ versions: + "2021.6.0": + folder: all "2021.3.0": folder: all "2020.3": From 21fc6a1c96c322dc3489a1f794ab75880fd9c69b Mon Sep 17 00:00:00 2001 From: Sebastian Morgenstern Date: Mon, 17 Oct 2022 19:45:07 +0200 Subject: [PATCH 024/300] (#13435) openssl: updated url for old 1.x versions * openssl: added 1.1.1r fixed url sources * openssl: remove 1.1.1r release * openssl: added new urls to old releases * openssl: fixex yaml syntax * openssl: fixed yaml intentation * openssl: revert url pathes for 3.x * openhab: forgot endofline --- recipes/openssl/1.x.x/conandata.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/openssl/1.x.x/conandata.yml b/recipes/openssl/1.x.x/conandata.yml index b4834a9996ead9..f5decdd72359f3 100644 --- a/recipes/openssl/1.x.x/conandata.yml +++ b/recipes/openssl/1.x.x/conandata.yml @@ -3,31 +3,31 @@ sources: sha256: ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16 url: [ "https://www.openssl.org/source/openssl-1.0.2u.tar.gz", - "https://www.openssl.org/source/old/openssl-1.0.2u.tar.gz" + "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz" ] 1.1.0l: sha256: 74a2f756c64fd7386a29184dc0344f4831192d61dc2481a93a4c5dd727f41148 url: [ "https://www.openssl.org/source/openssl-1.1.0l.tar.gz", - "https://www.openssl.org/source/old/openssl-1.1.0l.tar.gz" + "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0l.tar.gz" ] 1.1.1o: sha256: 9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f url: [ "https://www.openssl.org/source/openssl-1.1.1o.tar.gz", - "https://www.openssl.org/source/old/openssl-1.1.1o.tar.gz" + "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1o.tar.gz" ] 1.1.1p: sha256: bf61b62aaa66c7c7639942a94de4c9ae8280c08f17d4eac2e44644d9fc8ace6f url: [ "https://www.openssl.org/source/openssl-1.1.1p.tar.gz", - "https://www.openssl.org/source/old/openssl-1.1.1p.tar.gz" + "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1p.tar.gz" ] 1.1.1q: sha256: d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca url: [ "https://www.openssl.org/source/openssl-1.1.1q.tar.gz", - "https://www.openssl.org/source/old/openssl-1.1.1q.tar.gz" + "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1q.tar.gz" ] patches: 1.0.2u: From 4a24d7696fda618f56c5a19499f62bd10ff39568 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 20:41:23 +0200 Subject: [PATCH 025/300] (#13508) oatpp-libressl: conan v2 support --- recipes/oatpp-libressl/all/CMakeLists.txt | 7 - recipes/oatpp-libressl/all/conanfile.py | 120 ++++++++++-------- .../all/test_package/CMakeLists.txt | 17 +-- .../all/test_package/conanfile.py | 20 ++- ...tpp-libressl-test.cpp => test_package.cpp} | 0 .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 17 +++ 7 files changed, 117 insertions(+), 75 deletions(-) delete mode 100644 recipes/oatpp-libressl/all/CMakeLists.txt rename recipes/oatpp-libressl/all/test_package/{oatpp-libressl-test.cpp => test_package.cpp} (100%) create mode 100644 recipes/oatpp-libressl/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/oatpp-libressl/all/test_v1_package/conanfile.py diff --git a/recipes/oatpp-libressl/all/CMakeLists.txt b/recipes/oatpp-libressl/all/CMakeLists.txt deleted file mode 100644 index 7b920d87ae6279..00000000000000 --- a/recipes/oatpp-libressl/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) # Mininum as required oatpp -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-libressl/all/conanfile.py b/recipes/oatpp-libressl/all/conanfile.py index 64ed19cdac443f..6eec475cde13dd 100644 --- a/recipes/oatpp-libressl/all/conanfile.py +++ b/recipes/oatpp-libressl/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" + class OatppLibresslConan(ConanFile): name = "oatpp-libressl" @@ -11,21 +17,16 @@ class OatppLibresslConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "oat++ libressl library" topics = ("oat++", "oatpp", "libressl") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -33,60 +34,75 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-libressl can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-libressl requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("oatpp/" + self.version) - self.requires("libressl/3.2.1") + self.requires(f"oatpp/{self.version}") + self.requires("libressl/3.5.3") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def _configure_cmake(self): - if self._cmake: - return self._cmake + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-libressl" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-libressl" self.cpp_info.set_property("cmake_file_name", "oatpp-libressl") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-libressl") - self.cpp_info.components["_oatpp-libressl"].names["cmake_find_package"] = "oatpp-libressl" - self.cpp_info.components["_oatpp-libressl"].names["cmake_find_package_multi"] = "oatpp-libressl" - self.cpp_info.components["_oatpp-libressl"].set_property("cmake_target_name", "oatpp::oatpp-libressl") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-libressl"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-libressl") + os.path.join("include", f"oatpp-{self.version}", "oatpp-libressl") ] - self.cpp_info.components["_oatpp-libressl"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-libressl"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-libressl"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-libressl"].bindirs = [] self.cpp_info.components["_oatpp-libressl"].libs = ["oatpp-libressl"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-libressl"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-libressl" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-libressl" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-libressl"].names["cmake_find_package"] = "oatpp-libressl" + self.cpp_info.components["_oatpp-libressl"].names["cmake_find_package_multi"] = "oatpp-libressl" + self.cpp_info.components["_oatpp-libressl"].set_property("cmake_target_name", "oatpp::oatpp-libressl") self.cpp_info.components["_oatpp-libressl"].requires = ["oatpp::oatpp", "libressl::libressl"] diff --git a/recipes/oatpp-libressl/all/test_package/CMakeLists.txt b/recipes/oatpp-libressl/all/test_package/CMakeLists.txt index 704e2b23f267b8..3cc329996c9b00 100644 --- a/recipes/oatpp-libressl/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-libressl/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(oatpp-libressl-test CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(oatpp-libressl REQUIRED CONFIG) -find_package(oatpp-libressl REQUIRED) - -add_executable(oatpp-libressl-test oatpp-libressl-test.cpp) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - -target_link_libraries(oatpp-libressl-test PRIVATE oatpp::oatpp-libressl) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-libressl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-libressl/all/test_package/conanfile.py b/recipes/oatpp-libressl/all/test_package/conanfile.py index d63ea54eb1d462..0a6bc68712d901 100644 --- a/recipes/oatpp-libressl/all/test_package/conanfile.py +++ b/recipes/oatpp-libressl/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class OatppLibresslTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "oatpp-libressl-test"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-libressl/all/test_package/oatpp-libressl-test.cpp b/recipes/oatpp-libressl/all/test_package/test_package.cpp similarity index 100% rename from recipes/oatpp-libressl/all/test_package/oatpp-libressl-test.cpp rename to recipes/oatpp-libressl/all/test_package/test_package.cpp diff --git a/recipes/oatpp-libressl/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-libressl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..07afded94f59c8 --- /dev/null +++ b/recipes/oatpp-libressl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-libressl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-libressl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-libressl/all/test_v1_package/conanfile.py b/recipes/oatpp-libressl/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/oatpp-libressl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 5f0b933b7b6a2688a49087d331c46c9db1743d55 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 21:05:33 +0200 Subject: [PATCH 026/300] (#13509) oatpp-websocket: conan v2 support --- recipes/oatpp-websocket/all/CMakeLists.txt | 7 - recipes/oatpp-websocket/all/conanfile.py | 123 ++++++++++-------- .../all/test_package/CMakeLists.txt | 10 +- .../all/test_package/conanfile.py | 22 +++- .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 17 +++ 6 files changed, 115 insertions(+), 75 deletions(-) delete mode 100644 recipes/oatpp-websocket/all/CMakeLists.txt create mode 100644 recipes/oatpp-websocket/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/oatpp-websocket/all/test_v1_package/conanfile.py diff --git a/recipes/oatpp-websocket/all/CMakeLists.txt b/recipes/oatpp-websocket/all/CMakeLists.txt deleted file mode 100644 index d32836cbae4aa5..00000000000000 --- a/recipes/oatpp-websocket/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-websocket/all/conanfile.py b/recipes/oatpp-websocket/all/conanfile.py index 8aa50210c01f2e..5a8cfa0227561f 100644 --- a/recipes/oatpp-websocket/all/conanfile.py +++ b/recipes/oatpp-websocket/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" + class OatppWebSocketConan(ConanFile): name = "oatpp-websocket" @@ -11,21 +17,16 @@ class OatppWebSocketConan(ConanFile): license = "Apache-2.0" topics = ("oat++", "oatpp", "websocket") url = "https://github.com/conan-io/conan-center-index" - generators = "cmake", "cmake_find_package" - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = "CMakeLists.txt" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -33,62 +34,76 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-websocket can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-websocket requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - # oatpp and oatpp-websocket are tightly coupled so use the same version - self.requires("oatpp/" + self.version) + self.requires(f"oatpp/{self.version}") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def _configure_cmake(self): - if self._cmake: - return self._cmake + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - if tools.Version(self.version) >= "1.3.0" and self.settings.compiler == "Visual Studio": - self._cmake.definitions["OATPP_MSVC_LINK_STATIC_RUNTIME"] = self.settings.compiler.runtime in ["MT", "MTd"] - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + if Version(self.version) >= "1.3.0" and is_msvc(self): + tc.variables["OATPP_MSVC_LINK_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-websocket" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-websocket" self.cpp_info.set_property("cmake_file_name", "oatpp-websocket") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-websocket") - self.cpp_info.components["_oatpp-websocket"].names["cmake_find_package"] = "oatpp-websocket" - self.cpp_info.components["_oatpp-websocket"].names["cmake_find_package_multi"] = "oatpp-websocket" - self.cpp_info.components["_oatpp-websocket"].set_property("cmake_target_name", "oatpp::oatpp-websocket") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-websocket"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-websocket") + os.path.join("include", f"oatpp-{self.version}", "oatpp-websocket") ] - self.cpp_info.components["_oatpp-websocket"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-websocket"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-websocket"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-websocket"].bindirs = [] self.cpp_info.components["_oatpp-websocket"].libs = ["oatpp-websocket"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-websocket"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-websocket" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-websocket" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-websocket"].names["cmake_find_package"] = "oatpp-websocket" + self.cpp_info.components["_oatpp-websocket"].names["cmake_find_package_multi"] = "oatpp-websocket" + self.cpp_info.components["_oatpp-websocket"].set_property("cmake_target_name", "oatpp::oatpp-websocket") self.cpp_info.components["_oatpp-websocket"].requires = ["oatpp::oatpp"] diff --git a/recipes/oatpp-websocket/all/test_package/CMakeLists.txt b/recipes/oatpp-websocket/all/test_package/CMakeLists.txt index 5ed80d9dbfced3..7ec180083e3d06 100644 --- a/recipes/oatpp-websocket/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-websocket/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(oatpp-websocket REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -# Use linking with components to properly test package_info() target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-websocket) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-websocket/all/test_package/conanfile.py b/recipes/oatpp-websocket/all/test_package/conanfile.py index 72a1273530ef4c..0a6bc68712d901 100644 --- a/recipes/oatpp-websocket/all/test_package/conanfile.py +++ b/recipes/oatpp-websocket/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - -class OatppWebSocketTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-websocket/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-websocket/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..6d7f1dc7c5bad9 --- /dev/null +++ b/recipes/oatpp-websocket/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-websocket REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-websocket) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-websocket/all/test_v1_package/conanfile.py b/recipes/oatpp-websocket/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/oatpp-websocket/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From e6f38f58ca3c642bde33413e4ad5a53f2a9bdeba Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 21:24:50 +0200 Subject: [PATCH 027/300] (#13510) flecs: add 3.1.0 + build either shared or static if >= 3.0.1 * add flecs/3.1.0 * build either shared or static and few improvements --- recipes/flecs/all/conandata.yml | 3 ++ recipes/flecs/all/conanfile.py | 33 +++++++++++-------- recipes/flecs/all/test_package/conanfile.py | 11 ++++--- .../flecs/all/test_v1_package/conanfile.py | 1 - recipes/flecs/config.yml | 2 ++ 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/recipes/flecs/all/conandata.yml b/recipes/flecs/all/conandata.yml index 651673d78917bc..f290a6a835598a 100644 --- a/recipes/flecs/all/conandata.yml +++ b/recipes/flecs/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1.0": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.0.tar.gz" + sha256: "67e7cf4ff2abe661d9269b9d7f52ec7c39192f22e69bab638f27ef4337c12905" "3.0.4": url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.0.4.tar.gz" sha256: "370e2bf1bd9fd6dc79b515887e7f048be676b0d95e23d43b2c8b76a5e645c8f4" diff --git a/recipes/flecs/all/conanfile.py b/recipes/flecs/all/conanfile.py index 18d41fdbab49cb..3a9882b4aabf80 100644 --- a/recipes/flecs/all/conanfile.py +++ b/recipes/flecs/all/conanfile.py @@ -33,15 +33,18 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: - del self.settings.compiler.libcxx + del self.settings.compiler.libcxx except Exception: - pass + pass try: - del self.settings.compiler.cppstd + del self.settings.compiler.cppstd except Exception: - pass + pass def layout(self): cmake_layout(self, src_folder="src") @@ -52,10 +55,14 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["FLECS_STATIC_LIBS"] = not self.options.shared + if Version(self.version) < "3.0.1": + tc.variables["FLECS_STATIC_LIBS"] = not self.options.shared + tc.variables["FLECS_SHARED_LIBS"] = self.options.shared + tc.variables["FLECS_DEVELOPER_WARNINGS"] = False + else: + tc.variables["FLECS_STATIC"] = not self.options.shared + tc.variables["FLECS_SHARED"] = self.options.shared tc.variables["FLECS_PIC"] = self.options.get_safe("fPIC", True) - tc.variables["FLECS_SHARED_LIBS"] = self.options.shared - tc.variables["FLECS_DEVELOPER_WARNINGS"] = False tc.generate() def build(self): @@ -72,10 +79,10 @@ def package(self): def package_info(self): suffix = "" if self.options.shared else "_static" self.cpp_info.set_property("cmake_file_name", "flecs") - self.cpp_info.set_property("cmake_target_name", "flecs::flecs{}".format(suffix)) + self.cpp_info.set_property("cmake_target_name", f"flecs::flecs{suffix}") # TODO: back to global scope once cmake_find_package* generators removed - self.cpp_info.components["_flecs"].libs = ["flecs{}".format(suffix)] + self.cpp_info.components["_flecs"].libs = [f"flecs{suffix}"] if not self.options.shared: self.cpp_info.components["_flecs"].defines.append("flecs_STATIC") if Version(self.version) >= "3.0.0": @@ -87,6 +94,6 @@ def package_info(self): # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "flecs" self.cpp_info.names["cmake_find_package_multi"] = "flecs" - self.cpp_info.components["_flecs"].names["cmake_find_package"] = "flecs{}".format(suffix) - self.cpp_info.components["_flecs"].names["cmake_find_package_multi"] = "flecs{}".format(suffix) - self.cpp_info.components["_flecs"].set_property("cmake_target_name", "flecs::flecs{}".format(suffix)) + self.cpp_info.components["_flecs"].names["cmake_find_package"] = f"flecs{suffix}" + self.cpp_info.components["_flecs"].names["cmake_find_package_multi"] = f"flecs{suffix}" + self.cpp_info.components["_flecs"].set_property("cmake_target_name", f"flecs::flecs{suffix}") diff --git a/recipes/flecs/all/test_package/conanfile.py b/recipes/flecs/all/test_package/conanfile.py index 3a8c6c5442b33b..0a6bc68712d901 100644 --- a/recipes/flecs/all/test_package/conanfile.py +++ b/recipes/flecs/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/flecs/all/test_v1_package/conanfile.py b/recipes/flecs/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/flecs/all/test_v1_package/conanfile.py +++ b/recipes/flecs/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/flecs/config.yml b/recipes/flecs/config.yml index d116302226cc64..7fb35d9d8030bd 100644 --- a/recipes/flecs/config.yml +++ b/recipes/flecs/config.yml @@ -1,4 +1,6 @@ versions: + "3.1.0": + folder: all "3.0.4": folder: all "3.0.1": From f38adf2869f4c182e39b1143c8d0b5778e7ce8c7 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 22:04:45 +0200 Subject: [PATCH 028/300] (#13512) zstr: conan v2 support --- recipes/zstr/all/conanfile.py | 33 ++++++++++--------- recipes/zstr/all/test_package/CMakeLists.txt | 13 +++----- recipes/zstr/all/test_package/conanfile.py | 19 ++++++++--- .../zstr/all/test_v1_package/CMakeLists.txt | 11 +++++++ recipes/zstr/all/test_v1_package/conanfile.py | 17 ++++++++++ 5 files changed, 65 insertions(+), 28 deletions(-) create mode 100644 recipes/zstr/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/zstr/all/test_v1_package/conanfile.py diff --git a/recipes/zstr/all/conanfile.py b/recipes/zstr/all/conanfile.py index e6352d395c1c24..512be7c200256b 100644 --- a/recipes/zstr/all/conanfile.py +++ b/recipes/zstr/all/conanfile.py @@ -1,43 +1,46 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.51.1" class ZstrConan(ConanFile): name = "zstr" description = "A C++ header-only ZLib wrapper." license = "MIT" - topics = ("zstr", "zlib", "compression") + topics = ("zlib", "wrapper", "compression") homepage = "https://github.com/mateidavid/zstr" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "src")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "src"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/zstr/all/test_package/CMakeLists.txt b/recipes/zstr/all/test_package/CMakeLists.txt index ed1a400183c929..4fae7f3b9f5a34 100644 --- a/recipes/zstr/all/test_package/CMakeLists.txt +++ b/recipes/zstr/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(zstr CONFIG REQUIRED) +find_package(zstr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} zstr::zstr) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE zstr::zstr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/zstr/all/test_package/conanfile.py b/recipes/zstr/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/zstr/all/test_package/conanfile.py +++ b/recipes/zstr/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zstr/all/test_v1_package/CMakeLists.txt b/recipes/zstr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..629a41f38d6f89 --- /dev/null +++ b/recipes/zstr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(zstr REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zstr::zstr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/zstr/all/test_v1_package/conanfile.py b/recipes/zstr/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/zstr/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 2296ee1f7056db139bed2e7b50e9fa425fd0da11 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 22:24:36 +0200 Subject: [PATCH 029/300] (#13513) zint: conan v2 support --- recipes/zint/all/CMakeLists.txt | 7 -- recipes/zint/all/conandata.yml | 1 - recipes/zint/all/conanfile.py | 95 ++++++++++--------- recipes/zint/all/test_package/CMakeLists.txt | 5 +- recipes/zint/all/test_package/conanfile.py | 29 ++++-- .../zint/all/test_v1_package/CMakeLists.txt | 20 ++++ recipes/zint/all/test_v1_package/conanfile.py | 21 ++++ 7 files changed, 112 insertions(+), 66 deletions(-) delete mode 100644 recipes/zint/all/CMakeLists.txt create mode 100644 recipes/zint/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/zint/all/test_v1_package/conanfile.py diff --git a/recipes/zint/all/CMakeLists.txt b/recipes/zint/all/CMakeLists.txt deleted file mode 100644 index dd348757f3de81..00000000000000 --- a/recipes/zint/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/zint/all/conandata.yml b/recipes/zint/all/conandata.yml index 70cf1cd3fb510c..7f452ab6533371 100644 --- a/recipes/zint/all/conandata.yml +++ b/recipes/zint/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "2.10.0": - patch_file: "patches/0001-2.10.0-conan-integration.patch" - base_path: "source_subfolder" diff --git a/recipes/zint/all/conanfile.py b/recipes/zint/all/conanfile.py index 5d31fc46df8af9..61596c6c982a74 100644 --- a/recipes/zint/all/conanfile.py +++ b/recipes/zint/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class ZintConan(ConanFile): @@ -28,20 +30,8 @@ class ZintConan(ConanFile): "with_qt": False, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -49,57 +39,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass if not self.options.with_qt: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_libpng: - self.requires("libpng/1.6.37") - self.requires("zlib/1.2.12") + self.requires("libpng/1.6.38") + self.requires("zlib/1.2.13") if self.options.with_qt: - self.requires("qt/5.15.3") + self.requires("qt/5.15.6") def validate(self): - if self.options.with_qt and not self.options["qt"].gui: - raise ConanInvalidConfiguration(f"{self.name} needs qt:gui=True") + if self.info.options.with_qt and not self.dependencies["qt"].options.gui: + raise ConanInvalidConfiguration(f"{self.ref} needs qt:gui=True") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DATA_INSTALL_DIR"] = os.path.join(self.package_folder, "lib").replace("\\", "/") + tc.variables["ZINT_USE_QT"] = self.options.with_qt + if self.options.with_qt: + tc.variables["QT_VERSION_MAJOR"] = Version(self.dependencies["qt"].ref.version).major + tc.variables["ZINT_USE_PNG"] = self.options.with_libpng + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_source(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # Don't override CMAKE_OSX_SYSROOT, it can easily break consumers. - tools.replace_in_file( - os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_OSX_SYSROOT \"/\")", "", ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["DATA_INSTALL_DIR"] = os.path.join(self.package_folder, "lib") - cmake.definitions["ZINT_USE_QT"] = self.options.with_qt - if self.options.with_qt: - cmake.definitions["QT_VERSION_MAJOR"] = tools.Version(self.deps_cpp_info["qt"].version).major - cmake.definitions["ZINT_USE_PNG"] = self.options.with_libpng - cmake.configure() - return cmake - def build(self): self._patch_source() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Zint") diff --git a/recipes/zint/all/test_package/CMakeLists.txt b/recipes/zint/all/test_package/CMakeLists.txt index 865d3850ba3697..14bd143a5e4a68 100644 --- a/recipes/zint/all/test_package/CMakeLists.txt +++ b/recipes/zint/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) option(ZINT_WITH_QT "Zint has been built with Qt support") if(ZINT_WITH_QT) enable_language(CXX) endif() -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(Zint REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/zint/all/test_package/conanfile.py b/recipes/zint/all/test_package/conanfile.py index 1ce37b6a52e778..1617e37109bc27 100644 --- a/recipes/zint/all/test_package/conanfile.py +++ b/recipes/zint/all/test_package/conanfile.py @@ -1,21 +1,34 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ZINT_WITH_QT"] = self.dependencies["zint"].options.with_qt + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["ZINT_WITH_QT"] = self.options["zint"].with_qt cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") if self.options["zint"].with_qt: - bin_path = os.path.join("bin", "test_package_cpp") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") + self.run(bin_path, env="conanrun") diff --git a/recipes/zint/all/test_v1_package/CMakeLists.txt b/recipes/zint/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..d155f1e77d4aaf --- /dev/null +++ b/recipes/zint/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +option(ZINT_WITH_QT "Zint has been built with Qt support") +if(ZINT_WITH_QT) + enable_language(CXX) +endif() + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Zint REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Zint::Zint) + +if(ZINT_WITH_QT) + add_executable(${PROJECT_NAME}_cpp ../test_package/test_package.cpp) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE Zint::QZint) +endif() diff --git a/recipes/zint/all/test_v1_package/conanfile.py b/recipes/zint/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..1ce37b6a52e778 --- /dev/null +++ b/recipes/zint/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["ZINT_WITH_QT"] = self.options["zint"].with_qt + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + if self.options["zint"].with_qt: + bin_path = os.path.join("bin", "test_package_cpp") + self.run(bin_path, run_environment=True) From 6d2a713b6a0e10e81168b86f5d101f291c973da5 Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 18 Oct 2022 05:44:20 +0900 Subject: [PATCH 030/300] (#13365) grpc: update abseil * grpc: update abseil * use conan.ConanFile * remove `from conan import tools` * remove tools_legacy * define BZIP3_DLL_EXPORT * Revert "define BZIP3_DLL_EXPORT" This reverts commit 4227cfcd8dcad050d560f672f46682d7760ca43b. * remove recipe name from topics Co-authored-by: Jordan Williams * use abseil/20211102.0 when msvc and grpc/1.46.3 Co-authored-by: Jordan Williams --- recipes/grpc/all/conanfile.py | 69 ++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/recipes/grpc/all/conanfile.py b/recipes/grpc/all/conanfile.py index 5c6b96b1c8d43b..79d1581f47087d 100644 --- a/recipes/grpc/all/conanfile.py +++ b/recipes/grpc/all/conanfile.py @@ -1,9 +1,13 @@ -import shutil -from conan import tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.microsoft import visual, is_msvc +from conan.tools.build import cross_building, valid_min_cppstd, check_min_cppstd +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, rename, replace_in_file from conan.tools.scm import Version -from conans import ConanFile, CMake, tools as tools_legacy -from conans.errors import ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration +from conans import CMake import os +import shutil required_conan_version = ">=1.49.0" @@ -11,10 +15,10 @@ class grpcConan(ConanFile): name = "grpc" description = "Google's RPC (remote procedure call) library and framework." - topics = ("grpc", "rpc") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/grpc/grpc" - license = "Apache-2.0" + topics = ("rpc") settings = "os", "arch", "compiler", "build_type" @@ -59,10 +63,6 @@ def _source_subfolder(self): def _build_subfolder(self): return "build_subfolder" - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _grpc_plugin_template(self): return "grpc_plugin_template.cmake.in" @@ -74,8 +74,7 @@ def _cxxstd_required(self): def export_sources(self): self.copy("CMakeLists.txt") self.copy(os.path.join("cmake", self._grpc_plugin_template)) - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -89,7 +88,10 @@ def configure(self): self.options["grpc-proto"].shared = True def requirements(self): - self.requires("abseil/20211102.0") + if is_msvc(self) and Version(self.version) < "1.47": + self.requires("abseil/20211102.0") + else: + self.requires("abseil/20220623.0") self.requires("c-ares/1.18.1") self.requires("openssl/1.1.1q") self.requires("re2/20220601") @@ -99,11 +101,11 @@ def requirements(self): self.requires("grpc-proto/cci.20220627") def validate(self): - if self._is_msvc: + if is_msvc(self): if self.settings.compiler == "Visual Studio": vs_ide_version = self.settings.compiler.version else: - vs_ide_version = tools.microsoft.visual.msvc_version_to_vs_ide_version(self.settings.compiler.version) + vs_ide_version = visual.msvc_version_to_vs_ide_version(self.settings.compiler.version) if Version(vs_ide_version) < "14": raise ConanInvalidConfiguration("gRPC can only be built with Visual Studio 2015 or higher.") @@ -114,7 +116,7 @@ def validate(self): raise ConanInvalidConfiguration("GCC older than 6 is not supported") if self.settings.compiler.get_safe("cppstd"): - tools_legacy.check_min_cppstd(self, self._cxxstd_required) + check_min_cppstd(self, self._cxxstd_required) if self.options.shared and (not self.options["protobuf"].shared or not self.options["googleapis"].shared or not self.options["grpc-proto"].shared): raise ConanInvalidConfiguration("If built as shared, protobuf, googleapis and grpc-proto must be shared as well. Please, use `protobuf:shared=True` and `googleapis:shared=True` and `grpc-proto:shared=True`") @@ -127,11 +129,11 @@ def build_requirements(self): if hasattr(self, "settings_build"): self.build_requires('protobuf/3.21.4') # when cross compiling we need pre compiled grpc plugins for protoc - if tools.build.cross_building(self): + if cross_building(self): self.build_requires('grpc/{}'.format(self.version)) def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _configure_cmake(self): @@ -171,41 +173,40 @@ def _configure_cmake(self): self._cmake.definitions["gRPC_BUILD_GRPC_RUBY_PLUGIN"] = self.options.ruby_plugin # Consumed targets (abseil) via interface target_compiler_feature can propagate newer standards - if not tools_legacy.valid_min_cppstd(self, self._cxxstd_required): + if not valid_min_cppstd(self, self._cxxstd_required): self._cmake.definitions["CMAKE_CXX_STANDARD"] = self._cxxstd_required - if tools.build.cross_building(self): + if cross_building(self): # otherwise find_package() can't find config files since # conan doesn't populate CMAKE_FIND_ROOT_PATH self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_PACKAGE"] = "BOTH" - if tools_legacy.is_apple_os(self.settings.os): + if is_apple_os(self): # workaround for: install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False - if self._is_msvc and Version(self.version) >= "1.48": + if is_msvc(self) and Version(self.version) >= "1.48": self._cmake.definitions["CMAKE_SYSTEM_VERSION"] = "10.0.18362.0" self._cmake.configure(build_folder=self._build_subfolder) return self._cmake def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools_legacy.patch(**patch) + apply_conandata_patches(self) # Clean existing proto files, they will be taken from requirements shutil.rmtree(os.path.join(self._source_subfolder, "src", "proto", "grpc")) if Version(self.version) >= "1.47": # Take googleapis from requirement instead of vendored/hardcoded version - tools_legacy.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), "if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/googleapis)", "if (FALSE) # Do not download, it is provided by Conan" ) # We are fine with protobuf::protoc coming from conan generated Find/config file # TODO: to remove when moving to CMakeToolchain (see https://github.com/conan-io/conan/pull/10186) - tools_legacy.replace_in_file(os.path.join(self._source_subfolder, "cmake", "protobuf.cmake"), + replace_in_file(self, os.path.join(self._source_subfolder, "cmake", "protobuf.cmake"), "find_program(_gRPC_PROTOBUF_PROTOC_EXECUTABLE protoc)", "set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE $)" ) @@ -220,8 +221,8 @@ def package(self): cmake = self._configure_cmake() cmake.install() - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # Create one custom module file per executable in order to emulate # CMake executables imported targets of grpc @@ -272,19 +273,19 @@ def _create_executable_module_file(self, target, executable): # Rename it dst_file = os.path.join(self.package_folder, self._module_path, "{}.cmake".format(executable)) - tools.files.rename(self, os.path.join(self.package_folder, self._module_path, self._grpc_plugin_template), + rename(self, os.path.join(self.package_folder, self._module_path, self._grpc_plugin_template), dst_file) # Replace placeholders - tools_legacy.replace_in_file(dst_file, "@target_name@", target) - tools_legacy.replace_in_file(dst_file, "@executable_name@", executable) + replace_in_file(self, dst_file, "@target_name@", target) + replace_in_file(self, dst_file, "@executable_name@", executable) find_program_var = "{}_PROGRAM".format(executable.upper()) - tools_legacy.replace_in_file(dst_file, "@find_program_variable@", find_program_var) + replace_in_file(self, dst_file, "@find_program_variable@", find_program_var) module_folder_depth = len(os.path.normpath(self._module_path).split(os.path.sep)) rel_path = "".join(["../"] * module_folder_depth) - tools_legacy.replace_in_file(dst_file, "@relative_path@", rel_path) + replace_in_file(self, dst_file, "@relative_path@", rel_path) @property def _module_path(self): @@ -308,7 +309,7 @@ def wsock32(): return ["wsock32"] if self.settings.os == "Windows" else [] def corefoundation(): - return ["CoreFoundation"] if tools_legacy.is_apple_os(self.settings.os) else [] + return ["CoreFoundation"] if is_apple_os(self) else [] components = { "address_sorting": { From fafe0cd91950eb700e1b4704bbc2cc4d57b43cca Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 23:04:35 +0200 Subject: [PATCH 031/300] (#13514) zeromq: conan v2 support * conan v2 support * remove pdb files --- recipes/zeromq/all/CMakeLists.txt | 11 -- recipes/zeromq/all/conandata.yml | 8 +- recipes/zeromq/all/conanfile.py | 140 +++++++++--------- .../0004-cmake-minimum-required-first.patch | 15 ++ .../zeromq/all/test_package/CMakeLists.txt | 14 +- recipes/zeromq/all/test_package/conanfile.py | 31 ++-- .../zeromq/all/test_v1_package/CMakeLists.txt | 25 ++++ .../zeromq/all/test_v1_package/conanfile.py | 20 +++ 8 files changed, 158 insertions(+), 106 deletions(-) delete mode 100644 recipes/zeromq/all/CMakeLists.txt create mode 100644 recipes/zeromq/all/patches/0004-cmake-minimum-required-first.patch create mode 100644 recipes/zeromq/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/zeromq/all/test_v1_package/conanfile.py diff --git a/recipes/zeromq/all/CMakeLists.txt b/recipes/zeromq/all/CMakeLists.txt deleted file mode 100644 index 0611895d93c39a..00000000000000 --- a/recipes/zeromq/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(MSVC) - add_definitions("-D_NOEXCEPT=noexcept") -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/zeromq/all/conandata.yml b/recipes/zeromq/all/conandata.yml index b6f5c8a82efc19..a5145365e9be54 100644 --- a/recipes/zeromq/all/conandata.yml +++ b/recipes/zeromq/all/conandata.yml @@ -11,14 +11,12 @@ sources: patches: "4.3.4": - patch_file: "patches/0003-rpath-macos-4.3.3.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-cmake-minimum-required-first.patch" "4.3.3": - patch_file: "patches/0003-rpath-macos-4.3.3.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-cmake-minimum-required-first.patch" "4.3.2": - patch_file: "patches/0001-problem-__try-and-__except-isn-t-universally-supported-on-windows.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-problem-invalid-syntax-for-calling-convention-on-function.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-rpath-macos-4.3.2.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-cmake-minimum-required-first.patch" diff --git a/recipes/zeromq/all/conanfile.py b/recipes/zeromq/all/conanfile.py index 80aa0c29116136..434e0e5fb3084e 100644 --- a/recipes/zeromq/all/conanfile.py +++ b/recipes/zeromq/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, save +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class ZeroMQConan(ConanFile): @@ -36,21 +40,8 @@ class ZeroMQConan(ConanFile): "with_radix_tree": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -58,7 +49,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.encryption == "libsodium": @@ -67,91 +64,88 @@ def requirements(self): self.requires("norm/1.5.9") def validate(self): - if self.settings.os == "Windows" and self.options.with_norm: + if self.info.settings.os == "Windows" and self.info.options.with_norm: raise ConanInvalidConfiguration( "Norm and ZeroMQ are not compatible on Windows yet" ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_CURVE"] = bool(self.options.encryption) - self._cmake.definitions["WITH_LIBSODIUM"] = self.options.encryption == "libsodium" - self._cmake.definitions["ZMQ_BUILD_TESTS"] = False - self._cmake.definitions["WITH_PERF_TOOL"] = False - self._cmake.definitions["BUILD_SHARED"] = self.options.shared - self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["ENABLE_CPACK"] = False - self._cmake.definitions["WITH_DOCS"] = False - self._cmake.definitions["WITH_DOC"] = False - self._cmake.definitions["WITH_NORM"] = self.options.with_norm - self._cmake.definitions["ENABLE_DRAFTS"] = self.options.with_draft_api - self._cmake.definitions["ENABLE_WS"] = self.options.with_websocket - self._cmake.definitions["ENABLE_RADIX_TREE"] = self.options.with_radix_tree + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_CURVE"] = bool(self.options.encryption) + tc.variables["WITH_LIBSODIUM"] = self.options.encryption == "libsodium" + tc.variables["ZMQ_BUILD_TESTS"] = False + tc.variables["WITH_PERF_TOOL"] = False + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["BUILD_TESTS"] = False + tc.variables["ENABLE_CPACK"] = False + tc.variables["WITH_DOCS"] = False + tc.variables["WITH_DOC"] = False + tc.variables["WITH_NORM"] = self.options.with_norm + tc.variables["ENABLE_DRAFTS"] = self.options.with_draft_api + tc.variables["ENABLE_WS"] = self.options.with_websocket + tc.variables["ENABLE_RADIX_TREE"] = self.options.with_radix_tree if self.options.poller: - self._cmake.definitions["POLLER"] = self.options.poller - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["POLLER"] = self.options.poller + if is_msvc(self): + tc.preprocessor_definitions["_NOEXCEPT"] = "noexcept" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - os.unlink(os.path.join(self._source_subfolder, "builds", "cmake", "Modules", "FindSodium.cmake")) - + apply_conandata_patches(self) if self.options.encryption == "libsodium": - os.rename("Findlibsodium.cmake", "FindSodium.cmake") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "SODIUM_FOUND", - "libsodium_FOUND") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "SODIUM_INCLUDE_DIRS", - "libsodium_INCLUDE_DIRS") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "SODIUM_LIBRARIES", - "libsodium_LIBRARIES") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + cpp_info_sodium = self.dependencies["libsodium"].cpp_info + sodium_config = cpp_info_sodium.get_property("cmake_file_name") or "libsodium" + sodium_target = cpp_info_sodium.get_property("cmake_target_name") or "libsodium::libsodium" + find_sodium = "find_package(Sodium)" if Version(self.version) < "4.3.3" else "find_package(\"Sodium\")" + replace_in_file(self, cmakelists, find_sodium, f"find_package({sodium_config} REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "SODIUM_FOUND", f"{sodium_config}_FOUND") + replace_in_file(self, cmakelists, "SODIUM_INCLUDE_DIRS", f"{sodium_config}_INCLUDE_DIRS") + replace_in_file(self, cmakelists, "${SODIUM_LIBRARIES}", sodium_target) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="COPYING*", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "CMake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {self._libzmq_target: "ZeroMQ::{}".format(self._libzmq_target)} + {self._libzmq_target: f"ZeroMQ::{self._libzmq_target}"}, ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _libzmq_target(self): @@ -163,7 +157,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "libzmq") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["libzmq"].libs = tools.collect_libs(self) + self.cpp_info.components["libzmq"].libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.components["libzmq"].system_libs = ["iphlpapi", "ws2_32"] elif self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/zeromq/all/patches/0004-cmake-minimum-required-first.patch b/recipes/zeromq/all/patches/0004-cmake-minimum-required-first.patch new file mode 100644 index 00000000000000..75064b1ea98226 --- /dev/null +++ b/recipes/zeromq/all/patches/0004-cmake-minimum-required-first.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,11 +1,11 @@ + # CMake build script for ZeroMQ +-project(ZeroMQ) + + if(1) + cmake_minimum_required(VERSION 3.0.2) + else() + cmake_minimum_required(VERSION 2.8.12) + endif() ++project(ZeroMQ) + + include(CheckIncludeFiles) + include(CheckCCompilerFlag) diff --git a/recipes/zeromq/all/test_package/CMakeLists.txt b/recipes/zeromq/all/test_package/CMakeLists.txt index 4b5e1b762305aa..e02c2ff4211bda 100644 --- a/recipes/zeromq/all/test_package/CMakeLists.txt +++ b/recipes/zeromq/all/test_package/CMakeLists.txt @@ -1,24 +1,22 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) option(WITH_LIBSODIUM "zeromq is built with libsodium") - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +option(WITH_NORM "zeromq is built with norm") find_package(ZeroMQ REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) if(ZEROMQ_SHARED) - target_link_libraries(${PROJECT_NAME} libzmq) + target_link_libraries(${PROJECT_NAME} PRIVATE libzmq) else() - target_link_libraries(${PROJECT_NAME} libzmq-static) + target_link_libraries(${PROJECT_NAME} PRIVATE libzmq-static) endif() if(WITH_LIBSODIUM) - target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_LIBSODIUM") + target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_LIBSODIUM") endif() if(WITH_NORM) - target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_NORM") + target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_NORM") endif() diff --git a/recipes/zeromq/all/test_package/conanfile.py b/recipes/zeromq/all/test_package/conanfile.py index 9703af61ec3464..0378d2924042d6 100644 --- a/recipes/zeromq/all/test_package/conanfile.py +++ b/recipes/zeromq/all/test_package/conanfile.py @@ -1,20 +1,33 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_LIBSODIUM"] = self.dependencies["zeromq"].options.encryption == "libsodium" + tc.variables["ZEROMQ_SHARED"] = self.dependencies["zeromq"].options.shared + tc.variables["WITH_NORM"] = self.dependencies["zeromq"].options.with_norm + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" - cmake.definitions["ZEROMQ_SHARED"] = self.options["zeromq"].shared - cmake.definitions["WITH_NORM"] = self.options["zeromq"].with_norm cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zeromq/all/test_v1_package/CMakeLists.txt b/recipes/zeromq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..226be2dd7b7c30 --- /dev/null +++ b/recipes/zeromq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +option(WITH_LIBSODIUM "zeromq is built with libsodium") +option(WITH_NORM "zeromq is built with norm") + +find_package(ZeroMQ REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +if(ZEROMQ_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE libzmq) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE libzmq-static) +endif() + +if(WITH_LIBSODIUM) + target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_LIBSODIUM") +endif() + +if(WITH_NORM) + target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_NORM") +endif() diff --git a/recipes/zeromq/all/test_v1_package/conanfile.py b/recipes/zeromq/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..507e0ac53bc64a --- /dev/null +++ b/recipes/zeromq/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" + cmake.definitions["ZEROMQ_SHARED"] = self.options["zeromq"].shared + cmake.definitions["WITH_NORM"] = self.options["zeromq"].with_norm + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 0742f469f9e9b9e838c499b58b81ea982946fdbb Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 17 Oct 2022 23:24:11 +0200 Subject: [PATCH 032/300] (#13515) libcorrect: conan v2 support --- recipes/libcorrect/all/CMakeLists.txt | 7 -- recipes/libcorrect/all/conandata.yml | 3 - recipes/libcorrect/all/conanfile.py | 82 ++++++++++--------- .../all/test_package/CMakeLists.txt | 9 +- .../libcorrect/all/test_package/conanfile.py | 21 +++-- .../all/test_v1_package/CMakeLists.txt | 10 +++ .../all/test_v1_package/conanfile.py | 17 ++++ 7 files changed, 90 insertions(+), 59 deletions(-) delete mode 100644 recipes/libcorrect/all/CMakeLists.txt create mode 100644 recipes/libcorrect/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libcorrect/all/test_v1_package/conanfile.py diff --git a/recipes/libcorrect/all/CMakeLists.txt b/recipes/libcorrect/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d4..00000000000000 --- a/recipes/libcorrect/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libcorrect/all/conandata.yml b/recipes/libcorrect/all/conandata.yml index 373b501c11a6cc..bbabb165203bca 100644 --- a/recipes/libcorrect/all/conandata.yml +++ b/recipes/libcorrect/all/conandata.yml @@ -2,10 +2,7 @@ sources: "20181010": url: "https://github.com/quiet/libcorrect/archive/f5a28c74fba7a99736fe49d3a5243eca29517ae9.tar.gz" sha256: 5a4305aabe6c7d5b58f6677c41c54ad5e8d9003f7a5998f7344d93534e4c5760 - patches: "20181010": - patch_file: "patches/0001-Support-CMake-BUILD_SHARED_LIBS.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-Export-symbols-for-windows.patch" - base_path: "source_subfolder" diff --git a/recipes/libcorrect/all/conanfile.py b/recipes/libcorrect/all/conanfile.py index 0aba3323c93908..a2cd26c5b3b8ef 100644 --- a/recipes/libcorrect/all/conanfile.py +++ b/recipes/libcorrect/all/conanfile.py @@ -1,17 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" -class LibaecConan(ConanFile): +class LibcorrectConan(ConanFile): name = "libcorrect" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/quiet/libcorrect" description = "C library for Convolutional codes and Reed-Solomon" - topics = ("conan", "dsp", "libaec", "encoding", "decoding") - settings = "os", "compiler", "build_type", "arch" + topics = ("fec", "reed-solomon", "viterbi", "convolutional") + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -21,17 +24,8 @@ class LibaecConan(ConanFile): "fPIC": True, } - generators = "cmake" - exports_sources = ["CMakeLists.txt", "patches/*"] - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,40 +33,52 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def layout(self): + cmake_layout(self, src_folder="src") - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "-fPIC", "") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "-fsanitize=address", "") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + # Relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "-fPIC", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "-fsanitize=address", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["correct"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/libcorrect/all/test_package/CMakeLists.txt b/recipes/libcorrect/all/test_package/CMakeLists.txt index aae00b641388d5..37ccc2fe5dfaa8 100644 --- a/recipes/libcorrect/all/test_package/CMakeLists.txt +++ b/recipes/libcorrect/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1.3) -project(test_package) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libcorrect REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libcorrect::libcorrect) diff --git a/recipes/libcorrect/all/test_package/conanfile.py b/recipes/libcorrect/all/test_package/conanfile.py index bd7165a553cf41..0a6bc68712d901 100644 --- a/recipes/libcorrect/all/test_package/conanfile.py +++ b/recipes/libcorrect/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libcorrect/all/test_v1_package/CMakeLists.txt b/recipes/libcorrect/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..37041d4cb4431f --- /dev/null +++ b/recipes/libcorrect/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libcorrect REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libcorrect::libcorrect) diff --git a/recipes/libcorrect/all/test_v1_package/conanfile.py b/recipes/libcorrect/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libcorrect/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 962095cd33556a7907abd60e03fac8520f99892e Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 18 Oct 2022 07:06:01 +0900 Subject: [PATCH 033/300] (#13516) lurlparser: add recipe * lurlparser: add recipe * add WINDOWS_EXPORT_ALL_SYMBOLS * link math lib --- recipes/lurlparser/all/CMakeLists.txt | 21 ++++++ recipes/lurlparser/all/conandata.yml | 4 + recipes/lurlparser/all/conanfile.py | 73 +++++++++++++++++++ .../all/test_package/CMakeLists.txt | 8 ++ .../lurlparser/all/test_package/conanfile.py | 26 +++++++ .../all/test_package/test_package.cpp | 20 +++++ .../all/test_v1_package/CMakeLists.txt | 11 +++ .../all/test_v1_package/conanfile.py | 18 +++++ recipes/lurlparser/config.yml | 3 + 9 files changed, 184 insertions(+) create mode 100644 recipes/lurlparser/all/CMakeLists.txt create mode 100644 recipes/lurlparser/all/conandata.yml create mode 100644 recipes/lurlparser/all/conanfile.py create mode 100644 recipes/lurlparser/all/test_package/CMakeLists.txt create mode 100644 recipes/lurlparser/all/test_package/conanfile.py create mode 100644 recipes/lurlparser/all/test_package/test_package.cpp create mode 100644 recipes/lurlparser/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/lurlparser/all/test_v1_package/conanfile.py create mode 100644 recipes/lurlparser/config.yml diff --git a/recipes/lurlparser/all/CMakeLists.txt b/recipes/lurlparser/all/CMakeLists.txt new file mode 100644 index 00000000000000..e0daa695ec3ad2 --- /dev/null +++ b/recipes/lurlparser/all/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.8) +project(LUrlParser LANGUAGES CXX) + +add_library(lurlparser ${LURLPARSER_SRC_DIR}/LUrlParser.cpp) +target_include_directories(lurlparser PRIVATE ${LURLPARSER_SRC_DIR}) +target_compile_features(lurlparser PRIVATE cxx_std_11) +set_target_properties(lurlparser PROPERTIES + PUBLIC_HEADER ${LURLPARSER_SRC_DIR}/LUrlParser.h + CMAKE_CXX_STANDARD_REQUIRED ON + CMAKE_CXX_EXTENSIONS OFF + WINDOWS_EXPORT_ALL_SYMBOLS ON +) + +include(GNUInstallDirs) +install( + TARGETS lurlparser + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/recipes/lurlparser/all/conandata.yml b/recipes/lurlparser/all/conandata.yml new file mode 100644 index 00000000000000..5f5dd289193861 --- /dev/null +++ b/recipes/lurlparser/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1": + url: "https://github.com/corporateshark/LUrlParser/archive/refs/tags/release-1.1.tar.gz" + sha256: "f697bf9151c78b5e54682ff8f1ff759b15c3cbe73b179576a921b526cdf9ff22" diff --git a/recipes/lurlparser/all/conanfile.py b/recipes/lurlparser/all/conanfile.py new file mode 100644 index 00000000000000..6469f5166a7472 --- /dev/null +++ b/recipes/lurlparser/all/conanfile.py @@ -0,0 +1,73 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.50.0" + +class PackageConan(ConanFile): + name = "lurlparser" + description = "Lightweight URL & URI parser (RFC 1738, RFC 3986)" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/corporateshark/LUrlParser/" + topics = ("url", "uri", "parser") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _minimum_cpp_standard(self): + return 11 + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LURLPARSER_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + 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 = ["lurlparser"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/lurlparser/all/test_package/CMakeLists.txt b/recipes/lurlparser/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..2160e23166fc35 --- /dev/null +++ b/recipes/lurlparser/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(lurlparser REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE lurlparser::lurlparser) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/lurlparser/all/test_package/conanfile.py b/recipes/lurlparser/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/lurlparser/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lurlparser/all/test_package/test_package.cpp b/recipes/lurlparser/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..ef4db579b3178f --- /dev/null +++ b/recipes/lurlparser/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include + +#include "LUrlParser.h" + +int main() { + const auto URL = LUrlParser::ParseURL::parseURL("https://John:Dow@github.com:80/corporateshark/LUrlParser"); + + if (URL.isValid()) { + std::cout << "Scheme : " << URL.scheme_ << std::endl; + std::cout << "Host : " << URL.host_ << std::endl; + std::cout << "Port : " << URL.port_ << std::endl; + std::cout << "Path : " << URL.path_ << std::endl; + std::cout << "Query : " << URL.query_ << std::endl; + std::cout << "Fragment : " << URL.fragment_ << std::endl; + std::cout << "User name : " << URL.userName_ << std::endl; + std::cout << "Password : " << URL.password_ << std::endl; + } + + return 0; +} diff --git a/recipes/lurlparser/all/test_v1_package/CMakeLists.txt b/recipes/lurlparser/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..44cd3222ce1e5a --- /dev/null +++ b/recipes/lurlparser/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(lurlparser REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE lurlparser::lurlparser) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/lurlparser/all/test_v1_package/conanfile.py b/recipes/lurlparser/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/lurlparser/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lurlparser/config.yml b/recipes/lurlparser/config.yml new file mode 100644 index 00000000000000..3f8a45fae58329 --- /dev/null +++ b/recipes/lurlparser/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1": + folder: all From 9cbc92f949e5eb82005c118eefc2fcb2514f66a3 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 00:24:37 +0200 Subject: [PATCH 034/300] (#13517) qt-advanced-docking-system/3.8.3 * qt-advanced-docking-system/3.8.3 * bump qt * add missing imports * Update conanfile.py * Apply suggestions from code review Co-authored-by: Jordan Williams Co-authored-by: Jordan Williams --- .../all/conandata.yml | 3 +++ .../all/conanfile.py | 23 +++++++++++-------- recipes/qt-advanced-docking-system/config.yml | 2 ++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/recipes/qt-advanced-docking-system/all/conandata.yml b/recipes/qt-advanced-docking-system/all/conandata.yml index 7a2ff50f47cd8f..4dc01c8789b064 100644 --- a/recipes/qt-advanced-docking-system/all/conandata.yml +++ b/recipes/qt-advanced-docking-system/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.8.3": + url: "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/archive/refs/tags/3.8.3.tar.gz" + sha256: "bd5a9469b755bedf33baefd0b3dda6d167b7917a2888e2794eed5abee7d78f74" "3.8.2": url: "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/archive/refs/tags/3.8.2.tar.gz" sha256: "e56811228fb4d5f5703c31cd83cb39ab2d5a849f581719d383db72f9322ec7f2" diff --git a/recipes/qt-advanced-docking-system/all/conanfile.py b/recipes/qt-advanced-docking-system/all/conanfile.py index ff22ebfa3d3ef1..332361aaf68625 100644 --- a/recipes/qt-advanced-docking-system/all/conanfile.py +++ b/recipes/qt-advanced-docking-system/all/conanfile.py @@ -1,6 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, replace_in_file, rmdir +from conans import CMake import os +required_conan_version = ">=1.52.0" class QtADS(ConanFile): name = "qt-advanced-docking-system" @@ -23,16 +26,19 @@ class QtADS(ConanFile): "shared": False, "fPIC": True, } - exports_sources = ["CMakeLists.txt", "patches/**"] generators = "cmake", "cmake_find_package", "cmake_find_package_multi" _cmake = None - _qt_version = "5.15.2" + _qt_version = "5.15.6" @property def _source_subfolder(self): return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -45,7 +51,7 @@ def requirements(self): self.requires(f"qt/{self._qt_version}") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_cmake(self): @@ -61,10 +67,9 @@ def _configure_cmake(self): return self._cmake def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - tools.replace_in_file( + replace_in_file(self, f"{self.source_folder}/{self._source_subfolder}/src/ads_globals.cpp", "#include ", f"#include <{self._qt_version}/QtGui/qpa/qplatformnativeinterface.h>" @@ -79,8 +84,8 @@ def package(self): cmake = self._configure_cmake() cmake.install() self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "license")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "license")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): if self.options.shared: diff --git a/recipes/qt-advanced-docking-system/config.yml b/recipes/qt-advanced-docking-system/config.yml index 6cd510297f45ce..63dc53b34436f6 100644 --- a/recipes/qt-advanced-docking-system/config.yml +++ b/recipes/qt-advanced-docking-system/config.yml @@ -1,3 +1,5 @@ versions: + "3.8.3": + folder: "all" "3.8.2": folder: "all" From ecdf7fa9d779f1886477341a061672ecb1875522 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 00:45:29 +0200 Subject: [PATCH 035/300] (#13518) qarchive/2.1.1 * qarchive/2.1.1 * bump qt * fixup * Update conanfile.py * Update conanfile.py --- recipes/qarchive/all/conandata.yml | 8 +++++ recipes/qarchive/all/conanfile.py | 35 +++++++++---------- .../all/patches/0002-export-symbols.patch | 3 +- recipes/qarchive/config.yml | 2 ++ 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/recipes/qarchive/all/conandata.yml b/recipes/qarchive/all/conandata.yml index 953df9977dc0c0..fbfd467ed4937f 100644 --- a/recipes/qarchive/all/conandata.yml +++ b/recipes/qarchive/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1.1": + url: "https://github.com/antony-jr/QArchive/archive/v2.1.1.tar.gz" + sha256: "4ed51121a5bc9b5981d2fa3927f951a6a91ccca233d6b6dc4fef55b4ca5a2d92" "2.0.2": url: "https://github.com/antony-jr/QArchive/archive/v2.0.2.tar.gz" sha256: "f59207c0da2d68bbbdaca79751f08018226d3b587e3f97156b3aee994db018f6" @@ -6,6 +9,11 @@ sources: url: "https://github.com/antony-jr/QArchive/archive/v2.0.1.tar.gz" sha256: "ee8e259795f4f991c0465c3d95cf018bea2a72e9a31f744f2344aaa43201f369" patches: + "2.1.1": + - patch_file: "patches/0001-cmake-conan-compatibility.patch" + base_path: "source_subfolder" + - patch_file: "patches/0002-export-symbols.patch" + base_path: "source_subfolder" "2.0.2": - patch_file: "patches/0001-cmake-conan-compatibility.patch" base_path: "source_subfolder" diff --git a/recipes/qarchive/all/conanfile.py b/recipes/qarchive/all/conanfile.py index 7f628c0084e942..02aed3975aa2f1 100644 --- a/recipes/qarchive/all/conanfile.py +++ b/recipes/qarchive/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.files import get, apply_conandata_patches, rmdir, save, export_conandata_patches +from conans import CMake import functools import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class QarchiveConan(ConanFile): @@ -35,8 +37,7 @@ def _source_subfolder(self): def export_sources(self): self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,14 +48,14 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("libarchive/3.6.0") - self.requires("qt/5.15.3") + self.requires("libarchive/3.6.1") + self.requires("qt/5.15.6") def build_requirements(self): - self.build_requires("cmake/3.23.1") + self.build_requires("cmake/3.24.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @functools.lru_cache(1) @@ -64,8 +65,7 @@ def _configure_cmake(self): return cmake def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) cmake = self._configure_cmake() cmake.build() @@ -73,8 +73,8 @@ def package(self): self.copy("LICENSE", src=self._source_subfolder, dst="licenses") cmake = self._configure_cmake() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -82,21 +82,20 @@ def package(self): {"QArchive": "QArchive::QArchive"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "QArchive") diff --git a/recipes/qarchive/all/patches/0002-export-symbols.patch b/recipes/qarchive/all/patches/0002-export-symbols.patch index 10ea378156b7ad..1ca6edf716eacd 100644 --- a/recipes/qarchive/all/patches/0002-export-symbols.patch +++ b/recipes/qarchive/all/patches/0002-export-symbols.patch @@ -1,6 +1,6 @@ --- a/include/qarchive_enums.hpp +++ b/include/qarchive_enums.hpp -@@ -1,11 +1,12 @@ +@@ -1,10 +1,11 @@ #ifndef QARCHIVE_ENUMS_HPP_INCLUDED #define QARCHIVE_ENUMS_HPP_INCLUDED +#include "qarchive_global.hpp" @@ -13,4 +13,3 @@ +QARCHIVE_EXPORT QString errorCodeToString(short); /* - * Common error codes , these are most likely will be diff --git a/recipes/qarchive/config.yml b/recipes/qarchive/config.yml index 45be05c3784b4d..8bfd455ac59615 100644 --- a/recipes/qarchive/config.yml +++ b/recipes/qarchive/config.yml @@ -1,4 +1,6 @@ versions: + "2.1.1": + folder: all "2.0.2": folder: all "2.0.1": From b59685136816ec69a087b5de28d38c84b82d9e61 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 01:04:56 +0200 Subject: [PATCH 036/300] (#13520) libevent: conan v2 support --- recipes/libevent/all/CMakeLists.txt | 7 -- recipes/libevent/all/conandata.yml | 2 - recipes/libevent/all/conanfile.py | 103 +++++++++--------- .../libevent/all/test_package/CMakeLists.txt | 7 +- .../libevent/all/test_package/conanfile.py | 28 ++--- .../all/test_v1_package/CMakeLists.txt | 10 ++ .../libevent/all/test_v1_package/conanfile.py | 17 +++ 7 files changed, 94 insertions(+), 80 deletions(-) delete mode 100644 recipes/libevent/all/CMakeLists.txt create mode 100644 recipes/libevent/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libevent/all/test_v1_package/conanfile.py diff --git a/recipes/libevent/all/CMakeLists.txt b/recipes/libevent/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33fc..00000000000000 --- a/recipes/libevent/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libevent/all/conandata.yml b/recipes/libevent/all/conandata.yml index 3b0833457f7a35..f2a195cfe79c10 100644 --- a/recipes/libevent/all/conandata.yml +++ b/recipes/libevent/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "2.1.12": - patch_file: patches/fix-cmake-2.1.12.patch - base_path: source_subfolder "2.1.11": - patch_file: patches/fix-cmake-2.1.11.patch - base_path: source_subfolder diff --git a/recipes/libevent/all/conanfile.py b/recipes/libevent/all/conanfile.py index 4f7372e490bb7e..a06ee298377acf 100644 --- a/recipes/libevent/all/conanfile.py +++ b/recipes/libevent/all/conanfile.py @@ -1,9 +1,10 @@ -from conan.tools.microsoft import msvc_runtime_flag, is_msvc -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os -import functools -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.52.0" class LibeventConan(ConanFile): @@ -28,22 +29,8 @@ class LibeventConan(ConanFile): "disable_threads": False, } - generators = "cmake", "cmake_find_package" - short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,57 +38,69 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: self.requires("openssl/1.1.1q") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if self.options.with_openssl: + tc.variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder.replace("\\", "/") + tc.variables["EVENT__LIBRARY_TYPE"] = "SHARED" if self.options.shared else "STATIC" + tc.variables["EVENT__DISABLE_DEBUG_MODE"] = self.settings.build_type == "Release" + tc.variables["EVENT__DISABLE_OPENSSL"] = not self.options.with_openssl + tc.variables["EVENT__DISABLE_THREAD_SUPPORT"] = self.options.disable_threads + tc.variables["EVENT__DISABLE_BENCHMARK"] = True + tc.variables["EVENT__DISABLE_TESTS"] = True + tc.variables["EVENT__DISABLE_REGRESS"] = True + tc.variables["EVENT__DISABLE_SAMPLES"] = True + # libevent uses static runtime (MT) for static builds by default + if is_msvc(self): + tc.variables["EVENT__MSVC_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # relocatable shared libs on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "AddEventLibrary.cmake"), + replace_in_file(self, os.path.join(self.source_folder, "cmake", "AddEventLibrary.cmake"), "INSTALL_NAME_DIR \"${CMAKE_INSTALL_PREFIX}/lib\"", "") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - if self.options.with_openssl: - cmake.definitions["OPENSSL_ROOT_DIR"] = self.deps_cpp_info["openssl"].rootpath - cmake.definitions["EVENT__LIBRARY_TYPE"] = "SHARED" if self.options.shared else "STATIC" - cmake.definitions["EVENT__DISABLE_DEBUG_MODE"] = self.settings.build_type == "Release" - cmake.definitions["EVENT__DISABLE_OPENSSL"] = not self.options.with_openssl - cmake.definitions["EVENT__DISABLE_THREAD_SUPPORT"] = self.options.disable_threads - cmake.definitions["EVENT__DISABLE_BENCHMARK"] = True - cmake.definitions["EVENT__DISABLE_TESTS"] = True - cmake.definitions["EVENT__DISABLE_REGRESS"] = True - cmake.definitions["EVENT__DISABLE_SAMPLES"] = True - # libevent uses static runtime (MT) for static builds by default - if is_msvc(self): - cmake.definitions["EVENT__MSVC_STATIC_RUNTIME"] = "MT" in msvc_runtime_flag(self) - - cmake.configure(build_folder=self._build_subfolder) - return cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Libevent") diff --git a/recipes/libevent/all/test_package/CMakeLists.txt b/recipes/libevent/all/test_package/CMakeLists.txt index 1cc4000b584853..dc7570c75d1b57 100644 --- a/recipes/libevent/all/test_package/CMakeLists.txt +++ b/recipes/libevent/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(Libevent REQUIRED core CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libevent::core) +target_link_libraries(${PROJECT_NAME} PRIVATE libevent::core) diff --git a/recipes/libevent/all/test_package/conanfile.py b/recipes/libevent/all/test_package/conanfile.py index ab912e4e61df1a..0a6bc68712d901 100644 --- a/recipes/libevent/all/test_package/conanfile.py +++ b/recipes/libevent/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libevent/all/test_v1_package/CMakeLists.txt b/recipes/libevent/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..a8d5eec5dd24d7 --- /dev/null +++ b/recipes/libevent/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Libevent REQUIRED core CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libevent::core) diff --git a/recipes/libevent/all/test_v1_package/conanfile.py b/recipes/libevent/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libevent/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 20174227c5495e5643e4f26f3c875268568ae9e7 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 01:24:20 +0200 Subject: [PATCH 037/300] (#13521) tmxlite: conan v2 support --- recipes/tmxlite/all/CMakeLists.txt | 9 -- recipes/tmxlite/all/conandata.yml | 2 +- recipes/tmxlite/all/conanfile.py | 84 ++++++++++--------- ...02-cmake-link-external-miniz-pugixml.patch | 12 +++ .../tmxlite/all/test_package/CMakeLists.txt | 11 ++- recipes/tmxlite/all/test_package/conanfile.py | 19 +++-- .../all/test_v1_package/CMakeLists.txt | 11 +++ .../tmxlite/all/test_v1_package/conanfile.py | 17 ++++ 8 files changed, 103 insertions(+), 62 deletions(-) delete mode 100644 recipes/tmxlite/all/CMakeLists.txt create mode 100644 recipes/tmxlite/all/patches/0002-cmake-link-external-miniz-pugixml.patch create mode 100644 recipes/tmxlite/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/tmxlite/all/test_v1_package/conanfile.py diff --git a/recipes/tmxlite/all/CMakeLists.txt b/recipes/tmxlite/all/CMakeLists.txt deleted file mode 100644 index f39f80ce857c27..00000000000000 --- a/recipes/tmxlite/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -link_libraries(${CONAN_LIBS}) - -add_subdirectory(source_subfolder/tmxlite) diff --git a/recipes/tmxlite/all/conandata.yml b/recipes/tmxlite/all/conandata.yml index 33d0e85a50a956..acb2db05df8224 100644 --- a/recipes/tmxlite/all/conandata.yml +++ b/recipes/tmxlite/all/conandata.yml @@ -5,4 +5,4 @@ sources: patches: "1.3.0": - patch_file: "patches/0001-include-external-pugixml.patch" - base_path: "source_subfolder" + - patch_file: "patches/0002-cmake-link-external-miniz-pugixml.patch" diff --git a/recipes/tmxlite/all/conanfile.py b/recipes/tmxlite/all/conanfile.py index 38e769ee77b577..44380126b8654a 100644 --- a/recipes/tmxlite/all/conanfile.py +++ b/recipes/tmxlite/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class TmxliteConan(ConanFile): @@ -17,21 +21,14 @@ class TmxliteConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "rtti": [True, False], } default_options = { "shared": False, "fPIC": True, - "rtti": True, } - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,59 +36,64 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("miniz/2.1.0") - self.requires("pugixml/1.11") + self.requires("miniz/2.2.0") + self.requires("pugixml/1.12.1") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 not supported") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TMXLITE_STATIC_LIB"] = not self.options.shared + tc.variables["PROJECT_STATIC_RUNTIME"] = False + tc.variables["USE_RTTI"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # unvendor miniz - tools.remove_files_by_mask(os.path.join(self._source_subfolder, "tmxlite", "src"), "miniz*") - tools.replace_in_file(os.path.join(self._source_subfolder, "tmxlite", "src", "CMakeLists.txt"), + rm(self, "miniz*", os.path.join(self.source_folder, "tmxlite", "src")) + replace_in_file(self, os.path.join(self.source_folder, "tmxlite", "src", "CMakeLists.txt"), "${PROJECT_DIR}/miniz.c", "") # unvendor pugixml - tools.rmdir(os.path.join(self._source_subfolder, "tmxlite", "src", "detail")) - tools.replace_in_file(os.path.join(self._source_subfolder, "tmxlite", "src", "CMakeLists.txt"), + rmdir(self, os.path.join(self.source_folder, "tmxlite", "src", "detail")) + replace_in_file(self, os.path.join(self.source_folder, "tmxlite", "src", "CMakeLists.txt"), "${PROJECT_DIR}/detail/pugixml.cpp", "") # Don't inject -O3 in compile flags - tools.replace_in_file(os.path.join(self._source_subfolder, "tmxlite", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "tmxlite", "CMakeLists.txt"), "-O3", "") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TMXLITE_STATIC_LIB"] = not self.options.shared - self._cmake.definitions["PROJECT_STATIC_RUNTIME"] = False - self._cmake.definitions["USE_RTTI"] = self.options.rtti - self._cmake.configure() - return self._cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "tmxlite")) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if not self.options.shared: self.cpp_info.defines.append("TMXLITE_STATIC") if self.settings.os == "Android": diff --git a/recipes/tmxlite/all/patches/0002-cmake-link-external-miniz-pugixml.patch b/recipes/tmxlite/all/patches/0002-cmake-link-external-miniz-pugixml.patch new file mode 100644 index 00000000000000..f2ca8d92a2ca97 --- /dev/null +++ b/recipes/tmxlite/all/patches/0002-cmake-link-external-miniz-pugixml.patch @@ -0,0 +1,12 @@ +--- a/tmxlite/CMakeLists.txt ++++ b/tmxlite/CMakeLists.txt +@@ -70,6 +70,9 @@ else() + add_library(${PROJECT_NAME} SHARED ${PROJECT_SRC}) + endif() + endif() ++find_package(miniz REQUIRED CONFIG) ++find_package(pugixml REQUIRED CONFIG) ++target_link_libraries(${PROJECT_NAME} PRIVATE miniz::miniz pugixml::pugixml) + + target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) + diff --git a/recipes/tmxlite/all/test_package/CMakeLists.txt b/recipes/tmxlite/all/test_package/CMakeLists.txt index 3300ff77502772..564eece99799e1 100644 --- a/recipes/tmxlite/all/test_package/CMakeLists.txt +++ b/recipes/tmxlite/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(tmxlite REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE tmxlite::tmxlite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/tmxlite/all/test_package/conanfile.py b/recipes/tmxlite/all/test_package/conanfile.py index 5216332f39f5ca..0a6bc68712d901 100644 --- a/recipes/tmxlite/all/test_package/conanfile.py +++ b/recipes/tmxlite/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tmxlite/all/test_v1_package/CMakeLists.txt b/recipes/tmxlite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..ca4979c8e62d9d --- /dev/null +++ b/recipes/tmxlite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tmxlite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tmxlite::tmxlite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/tmxlite/all/test_v1_package/conanfile.py b/recipes/tmxlite/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/tmxlite/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 5d957b4fdfc9578353fdbbe31c5f4a030f2be5d1 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 01:44:19 +0200 Subject: [PATCH 038/300] (#13522) tmx: conan v2 support --- recipes/tmx/all/CMakeLists.txt | 7 -- recipes/tmx/all/conanfile.py | 83 ++++++++++--------- recipes/tmx/all/test_package/CMakeLists.txt | 7 +- recipes/tmx/all/test_package/conanfile.py | 19 +++-- .../tmx/all/test_v1_package/CMakeLists.txt | 10 +++ recipes/tmx/all/test_v1_package/conanfile.py | 18 ++++ 6 files changed, 87 insertions(+), 57 deletions(-) delete mode 100644 recipes/tmx/all/CMakeLists.txt create mode 100644 recipes/tmx/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/tmx/all/test_v1_package/conanfile.py diff --git a/recipes/tmx/all/CMakeLists.txt b/recipes/tmx/all/CMakeLists.txt deleted file mode 100644 index 8315062fd31eed..00000000000000 --- a/recipes/tmx/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/tmx/all/conanfile.py b/recipes/tmx/all/conanfile.py index d229ad4b32c22f..5a3b3214bc42f6 100644 --- a/recipes/tmx/all/conanfile.py +++ b/recipes/tmx/all/conanfile.py @@ -1,9 +1,10 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" class TmxConan(ConanFile): @@ -28,58 +29,61 @@ class TmxConan(ConanFile): "with_zstd": False, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libxml2/2.9.13") + self.requires("libxml2/2.9.14") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_zstd: self.requires("zstd/1.5.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "${CMAKE_BINARY_DIR}", "${CMAKE_CURRENT_BINARY_DIR}") + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["WANT_ZLIB"] = self.options.with_zlib - cmake.definitions["WANT_ZSTD"] = self.options.with_zstd + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WANT_ZLIB"] = self.options.with_zlib + tc.variables["WANT_ZSTD"] = self.options.with_zstd if self.options.with_zstd: - cmake.definitions["ZSTD_PREFER_STATIC"] = not self.options["zstd"].shared - cmake.configure() - return cmake + tc.variables["ZSTD_PREFER_STATIC"] = not self.dependencies["zstd"].options.shared + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self._create_cmake_module_alias_targets( @@ -87,21 +91,20 @@ def package(self): {"tmx": "tmx::tmx"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "tmx") diff --git a/recipes/tmx/all/test_package/CMakeLists.txt b/recipes/tmx/all/test_package/CMakeLists.txt index 8caed204543d31..27410290350a8a 100644 --- a/recipes/tmx/all/test_package/CMakeLists.txt +++ b/recipes/tmx/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(tmx REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} tmx) +target_link_libraries(${PROJECT_NAME} PRIVATE tmx) diff --git a/recipes/tmx/all/test_package/conanfile.py b/recipes/tmx/all/test_package/conanfile.py index 2d4b3d3b837ac8..da601c15e4dfcd 100644 --- a/recipes/tmx/all/test_package/conanfile.py +++ b/recipes/tmx/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") tmx_path = os.path.join(self.source_folder, "externtileset.tmx") - self.run("{} {}".format(bin_path, tmx_path), run_environment=True) + self.run(f"{bin_path} {tmx_path}", env="conanrun") diff --git a/recipes/tmx/all/test_v1_package/CMakeLists.txt b/recipes/tmx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..7b3630d9b9ae2e --- /dev/null +++ b/recipes/tmx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tmx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE tmx) diff --git a/recipes/tmx/all/test_v1_package/conanfile.py b/recipes/tmx/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5654af76091cf4 --- /dev/null +++ b/recipes/tmx/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + tmx_path = os.path.join(self.source_folder, os.pardir, "test_package", "externtileset.tmx") + self.run(f"{bin_path} {tmx_path}", run_environment=True) From 9520538e73da7ae6635dbfe93f595d713b996426 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 02:04:22 +0200 Subject: [PATCH 039/300] (#13523) brynet: conan v2 support --- recipes/brynet/all/conanfile.py | 39 +++++++++++-------- .../brynet/all/test_package/CMakeLists.txt | 11 +++--- recipes/brynet/all/test_package/conanfile.py | 19 ++++++--- .../brynet/all/test_v1_package/CMakeLists.txt | 11 ++++++ .../brynet/all/test_v1_package/conanfile.py | 17 ++++++++ 5 files changed, 70 insertions(+), 27 deletions(-) create mode 100644 recipes/brynet/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/brynet/all/test_v1_package/conanfile.py diff --git a/recipes/brynet/all/conanfile.py b/recipes/brynet/all/conanfile.py index 33bea6b1fd7993..f19ddf2cfae85e 100644 --- a/recipes/brynet/all/conanfile.py +++ b/recipes/brynet/all/conanfile.py @@ -1,18 +1,21 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class BrynetConan(ConanFile): name = "brynet" description = "Header Only Cross platform high performance TCP network library using C++ 11." license = "MIT" - topics = ("conan", "brynet", "networking", "tcp", "websocket") + topics = ("networking", "tcp", "websocket") homepage = "https://github.com/IronsDu/brynet" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler" + settings = "os", "arch", "compiler", "build_type" options = { "with_openssl": [True, False], } @@ -22,30 +25,34 @@ class BrynetConan(ConanFile): no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1q", transitive_headers=True, transitive_libs=True) + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.options.with_openssl: self.cpp_info.defines.append("BRYNET_USE_OPENSSL") if self.settings.os == "Windows": diff --git a/recipes/brynet/all/test_package/CMakeLists.txt b/recipes/brynet/all/test_package/CMakeLists.txt index 33ae887aa6aea3..d7b3556ccaf55f 100644 --- a/recipes/brynet/all/test_package/CMakeLists.txt +++ b/recipes/brynet/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(brynet REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE brynet::brynet) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/brynet/all/test_package/conanfile.py b/recipes/brynet/all/test_package/conanfile.py index 5216332f39f5ca..0a6bc68712d901 100644 --- a/recipes/brynet/all/test_package/conanfile.py +++ b/recipes/brynet/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/brynet/all/test_v1_package/CMakeLists.txt b/recipes/brynet/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d6bc29a538907 --- /dev/null +++ b/recipes/brynet/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(brynet REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE brynet::brynet) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/brynet/all/test_v1_package/conanfile.py b/recipes/brynet/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/brynet/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 5dd60f98dc23e5f8a2a63f41a1f8facfd80f39bd Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 02:24:59 +0200 Subject: [PATCH 040/300] (#13525) jxrlib: conan v2 support * conan v2 support * self.info in validate() Co-authored-by: Jordan Williams Co-authored-by: Jordan Williams --- recipes/jxrlib/all/CMakeLists.txt | 13 +-- recipes/jxrlib/all/conandata.yml | 1 - recipes/jxrlib/all/conanfile.py | 81 ++++++++++--------- .../jxrlib/all/test_package/CMakeLists.txt | 7 +- recipes/jxrlib/all/test_package/conanfile.py | 21 +++-- .../jxrlib/all/test_v1_package/CMakeLists.txt | 10 +++ .../jxrlib/all/test_v1_package/conanfile.py | 18 +++++ 7 files changed, 94 insertions(+), 57 deletions(-) create mode 100644 recipes/jxrlib/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/jxrlib/all/test_v1_package/conanfile.py diff --git a/recipes/jxrlib/all/CMakeLists.txt b/recipes/jxrlib/all/CMakeLists.txt index a5327c20bf0d3a..f4e654c29be7f3 100644 --- a/recipes/jxrlib/all/CMakeLists.txt +++ b/recipes/jxrlib/all/CMakeLists.txt @@ -1,16 +1,13 @@ -cmake_minimum_required(VERSION 2.8.12) -project(jxrlib C) +cmake_minimum_required(VERSION 3.1) +project(jxrlib LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(JPEGXR_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) +include(GNUInstallDirs) +include(TestBigEndian) if(NOT MSVC) add_definitions(-D__ANSI__) endif() -include(TestBigEndian) test_big_endian(ISBIGENDIAN) if(ISBIGENDIAN) set(DEF_ENDIAN _BIG__ENDIAN_) @@ -80,8 +77,6 @@ install(TARGETS jxrglue LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) - - install(FILES ${JPEGXR_FOLDER}/jxrgluelib/JXRGlue.h ${JPEGXR_FOLDER}/jxrgluelib/JXRMeta.h diff --git a/recipes/jxrlib/all/conandata.yml b/recipes/jxrlib/all/conandata.yml index bf3b5c5345ec6e..478aec5f4b6b65 100644 --- a/recipes/jxrlib/all/conandata.yml +++ b/recipes/jxrlib/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20170615": - patch_file: patches/0001-missing-declarations.patch - base_path: source_subfolder diff --git a/recipes/jxrlib/all/conanfile.py b/recipes/jxrlib/all/conanfile.py index 8d37497c03a353..d4c71b54de4553 100644 --- a/recipes/jxrlib/all/conanfile.py +++ b/recipes/jxrlib/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class JxrlibConan(ConanFile): @@ -10,9 +14,8 @@ class JxrlibConan(ConanFile): homepage = "https://jxrlib.codeplex.com/" url = "https://github.com/conan-io/conan-center-index" license = "BSD-2-Clause" - topics = ("conan", "jxr", "jpeg", "xr") - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" + topics = ("jxr", "jpeg", "xr") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,15 +26,9 @@ class JxrlibConan(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,44 +36,54 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler == "Visual Studio" and self.options.shared: - raise ConanInvalidConfiguration("jxrlib shared not supported by Visual Studio") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_dir=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["JPEGXR_FOLDER"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libjxr") self.cpp_info.libs = ["jxrglue", "jpegxr"] - - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - if self.settings.os != "Windows": + if not is_msvc(self): self.cpp_info.defines.append("__ANSI__") - self.cpp_info.names["pkg_config"] = "libjxr" + # TODO: to remove in conan v2, and do not port this to CMakeDeps, it was a mistake self.cpp_info.names["cmake_find_package"] = "JXR" self.cpp_info.names["cmake_find_package_multi"] = "JXR" diff --git a/recipes/jxrlib/all/test_package/CMakeLists.txt b/recipes/jxrlib/all/test_package/CMakeLists.txt index 7b9b613cbb24a3..e7689f4130d27d 100644 --- a/recipes/jxrlib/all/test_package/CMakeLists.txt +++ b/recipes/jxrlib/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(jxrlib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE jxrlib::jxrlib) diff --git a/recipes/jxrlib/all/test_package/conanfile.py b/recipes/jxrlib/all/test_package/conanfile.py index d7ad3be43e392f..b8d2e695e4b3ab 100644 --- a/recipes/jxrlib/all/test_package/conanfile.py +++ b/recipes/jxrlib/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") img_path = os.path.join(self.source_folder, "test.jxr") - self.run("{0} {1}".format(bin_path, img_path), run_environment=True) + self.run(f"{bin_path} {img_path}", env="conanrun") diff --git a/recipes/jxrlib/all/test_v1_package/CMakeLists.txt b/recipes/jxrlib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..eb386b8f18cc03 --- /dev/null +++ b/recipes/jxrlib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(JXR REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE JXR::JXR) diff --git a/recipes/jxrlib/all/test_v1_package/conanfile.py b/recipes/jxrlib/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..ffd0b1c74921bb --- /dev/null +++ b/recipes/jxrlib/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_path = os.path.join(self.source_folder, os.pardir, "test_package", "test.jxr") + self.run(f"{bin_path} {img_path}", run_environment=True) From c6d36e209711d50bbdcda0cc576c1ab7d8418c84 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 02:44:16 +0200 Subject: [PATCH 041/300] (#13529) ecos: conan v2 support --- recipes/ecos/all/CMakeLists.txt | 9 --- recipes/ecos/all/conandata.yml | 2 - recipes/ecos/all/conanfile.py | 65 ++++++++++--------- recipes/ecos/all/test_package/CMakeLists.txt | 7 +- recipes/ecos/all/test_package/conanfile.py | 19 ++++-- .../ecos/all/test_v1_package/CMakeLists.txt | 10 +++ recipes/ecos/all/test_v1_package/conanfile.py | 17 +++++ 7 files changed, 79 insertions(+), 50 deletions(-) delete mode 100644 recipes/ecos/all/CMakeLists.txt create mode 100644 recipes/ecos/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/ecos/all/test_v1_package/conanfile.py diff --git a/recipes/ecos/all/CMakeLists.txt b/recipes/ecos/all/CMakeLists.txt deleted file mode 100644 index c5630c8098ba33..00000000000000 --- a/recipes/ecos/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - -add_subdirectory(source_subfolder) diff --git a/recipes/ecos/all/conandata.yml b/recipes/ecos/all/conandata.yml index ddfac800071fae..3034805590c751 100644 --- a/recipes/ecos/all/conandata.yml +++ b/recipes/ecos/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "2.0.8": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-missing-include.patch" - base_path: "source_subfolder" diff --git a/recipes/ecos/all/conanfile.py b/recipes/ecos/all/conanfile.py index 48767c8ddc05e4..6947c543e03525 100644 --- a/recipes/ecos/all/conanfile.py +++ b/recipes/ecos/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class EcosConan(ConanFile): @@ -24,13 +26,8 @@ class EcosConan(ConanFile): "use_long": True, } - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,41 +35,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): # TODO: unvendor suitesparse pass def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_LONG"] = self.options.use_long - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_LONG"] = self.options.use_long + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "ecos" - self.cpp_info.names["cmake_find_package_multi"] = "ecos" + self.cpp_info.set_property("cmake_file_name", "ecos") + self.cpp_info.set_property("cmake_target_name", "ecos::ecos") self.cpp_info.libs = ["ecos"] self.cpp_info.defines.append("CTRLC=1") if self.options.use_long: diff --git a/recipes/ecos/all/test_package/CMakeLists.txt b/recipes/ecos/all/test_package/CMakeLists.txt index 9bc6a076f7ed2a..006729666b6b54 100644 --- a/recipes/ecos/all/test_package/CMakeLists.txt +++ b/recipes/ecos/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(ecos REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ecos::ecos) +target_link_libraries(${PROJECT_NAME} PRIVATE ecos::ecos) diff --git a/recipes/ecos/all/test_package/conanfile.py b/recipes/ecos/all/test_package/conanfile.py index a9f777f7680ff1..0a6bc68712d901 100644 --- a/recipes/ecos/all/test_package/conanfile.py +++ b/recipes/ecos/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ecos/all/test_v1_package/CMakeLists.txt b/recipes/ecos/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..465202cc7e581a --- /dev/null +++ b/recipes/ecos/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(ecos REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE ecos::ecos) diff --git a/recipes/ecos/all/test_v1_package/conanfile.py b/recipes/ecos/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/ecos/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 41737f9551dcc867d851da1194353edf0f2fa9b5 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 03:05:45 +0200 Subject: [PATCH 042/300] (#13531) arcus: conan v2 support * conan v2 support * fix upstream CMakeLists --- recipes/arcus/all/CMakeLists.txt | 7 -- recipes/arcus/all/conandata.yml | 3 + recipes/arcus/all/conanfile.py | 108 +++++++----------- .../arcus/all/patches/0001-fix-cmake.patch | 62 ++++++++++ recipes/arcus/all/test_package/CMakeLists.txt | 11 +- recipes/arcus/all/test_package/conanfile.py | 19 ++- .../arcus/all/test_v1_package/CMakeLists.txt | 11 ++ .../arcus/all/test_v1_package/conanfile.py | 17 +++ 8 files changed, 154 insertions(+), 84 deletions(-) delete mode 100644 recipes/arcus/all/CMakeLists.txt create mode 100644 recipes/arcus/all/patches/0001-fix-cmake.patch create mode 100644 recipes/arcus/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/arcus/all/test_v1_package/conanfile.py diff --git a/recipes/arcus/all/CMakeLists.txt b/recipes/arcus/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9a..00000000000000 --- a/recipes/arcus/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/arcus/all/conandata.yml b/recipes/arcus/all/conandata.yml index 9e659afa43d49c..beb6b4ed8bb020 100644 --- a/recipes/arcus/all/conandata.yml +++ b/recipes/arcus/all/conandata.yml @@ -2,3 +2,6 @@ sources: "4.9.1": url: "https://github.com/Ultimaker/libArcus/archive/refs/tags/4.9.1.tar.gz" sha256: "18d939fd2428c72fdce35a286c196438327cfc3c8476e463e5ca46570168c9ce" +patches: + "4.9.1": + - patch_file: "patches/0001-fix-cmake.patch" diff --git a/recipes/arcus/all/conanfile.py b/recipes/arcus/all/conanfile.py index b11f3d26915f95..10256ef37f2513 100644 --- a/recipes/arcus/all/conanfile.py +++ b/recipes/arcus/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class ArcusConan(ConanFile): @@ -11,7 +15,7 @@ class ArcusConan(ConanFile): "creating a socket in a thread and using this socket to send " \ "and receive messages based on the Protocol Buffers library." license = "LGPL-3.0-or-later" - topics = ("arcus", "protobuf", "socket", "cura") + topics = ("protobuf", "socket", "cura") homepage = "https://github.com/Ultimaker/libArcus" url = "https://github.com/conan-io/conan-center-index" @@ -26,17 +30,8 @@ class ArcusConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _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): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,84 +39,68 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("protobuf/3.17.1") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - # Do not force PIC - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", - "") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set_target_properties(Arcus PROPERTIES COMPILE_FLAGS -fPIC)", - "") - # TODO: this patch could be removed when CMake variables fixed in protobuf recipe - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "target_link_libraries(Arcus PUBLIC ${PROTOBUF_LIBRARIES})", - "target_link_libraries(Arcus PUBLIC protobuf::libprotobuf)") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_PYTHON"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - if self._is_msvc: - if self.settings.compiler == "Visual Studio": - is_static_runtime = str(self.settings.compiler.runtime).startswith("MT") - else: - is_static_runtime = self.settings.compiler.runtime == "static" - self._cmake.definitions["MSVC_STATIC_RUNTIME"] = is_static_runtime - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_PYTHON"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_STATIC"] = not self.options.shared + if is_msvc(self): + tc.variables["MSVC_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"Arcus": "Arcus::Arcus"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) - - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "Arcus") @@ -135,6 +114,5 @@ def package_info(self): # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Arcus" self.cpp_info.names["cmake_find_package_multi"] = "Arcus" - self.cpp_info.builddirs.append(self._module_subfolder) self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/arcus/all/patches/0001-fix-cmake.patch b/recipes/arcus/all/patches/0001-fix-cmake.patch new file mode 100644 index 00000000000000..581de6fa9b257d --- /dev/null +++ b/recipes/arcus/all/patches/0001-fix-cmake.patch @@ -0,0 +1,62 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ ++cmake_minimum_required(VERSION 3.8) + project(arcus) +-cmake_minimum_required(VERSION 3.6) + + include(GNUInstallDirs) + include(CMakePackageConfigHelpers) +@@ -19,7 +19,6 @@ endif() + set(protobuf_MODULE_COMPATIBLE ON CACHE INTERNAL "" FORCE) + find_package(Protobuf 3.0.0 REQUIRED) + +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) #Required if a patch to libArcus needs to be made via templates. + + if(BUILD_PYTHON) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +@@ -37,11 +36,7 @@ if(BUILD_PYTHON) + include_directories(python/ src/ ${SIP_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}) + endif() + +-set(CMAKE_CXX_STANDARD 11) + +-if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") +-endif() + + set(arcus_SRCS + src/Socket.cpp +@@ -63,17 +58,16 @@ set(arcus_HDRS + set(ARCUS_VERSION 1.1.0) + set(ARCUS_SOVERSION 3) + +-set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") + + if(BUILD_STATIC) + add_library(Arcus STATIC ${arcus_SRCS}) + if(NOT WIN32 OR CMAKE_COMPILER_IS_GNUCXX) + target_link_libraries(Arcus PRIVATE pthread) +- set_target_properties(Arcus PROPERTIES COMPILE_FLAGS -fPIC) + endif() + else() + add_library(Arcus SHARED ${arcus_SRCS}) + endif() ++target_compile_features(Arcus PUBLIC cxx_std_11) + + if(MSVC_STATIC_RUNTIME) + foreach(flag_var +@@ -97,11 +91,11 @@ target_include_directories(Arcus PUBLIC + $ + ${PROTOBUF_INCLUDE_DIR} + ) +-target_link_libraries(Arcus PUBLIC ${PROTOBUF_LIBRARIES}) ++target_link_libraries(Arcus PUBLIC protobuf::libprotobuf) + + if(WIN32) + add_definitions(-D_WIN32_WINNT=0x0600) # Declare we require Vista or higher, this allows us to use IPv6 functions. +- target_link_libraries(Arcus PUBLIC Ws2_32) ++ target_link_libraries(Arcus PUBLIC ws2_32) + endif() + + if(${CMAKE_BUILD_TYPE}) diff --git a/recipes/arcus/all/test_package/CMakeLists.txt b/recipes/arcus/all/test_package/CMakeLists.txt index ef27cd84029d88..376d65791e6782 100644 --- a/recipes/arcus/all/test_package/CMakeLists.txt +++ b/recipes/arcus/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Arcus REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Arcus) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE Arcus) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/arcus/all/test_package/conanfile.py b/recipes/arcus/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/arcus/all/test_package/conanfile.py +++ b/recipes/arcus/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/arcus/all/test_v1_package/CMakeLists.txt b/recipes/arcus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..5b257f71e6bdc3 --- /dev/null +++ b/recipes/arcus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Arcus REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Arcus) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/arcus/all/test_v1_package/conanfile.py b/recipes/arcus/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/arcus/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 5ac7587c46c9f102274f4e0f5d06af4773527f57 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 03:24:54 +0200 Subject: [PATCH 043/300] (#13532) gamma: conan v2 support --- recipes/gamma/all/CMakeLists.txt | 39 ++++++------ recipes/gamma/all/conanfile.py | 60 ++++++++++--------- recipes/gamma/all/test_package/CMakeLists.txt | 7 +-- recipes/gamma/all/test_package/conanfile.py | 19 ++++-- .../gamma/all/test_v1_package/CMakeLists.txt | 11 ++++ .../gamma/all/test_v1_package/conanfile.py | 17 ++++++ 6 files changed, 94 insertions(+), 59 deletions(-) create mode 100644 recipes/gamma/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/gamma/all/test_v1_package/conanfile.py diff --git a/recipes/gamma/all/CMakeLists.txt b/recipes/gamma/all/CMakeLists.txt index 13eecd482b342f..d7ab29edac81be 100644 --- a/recipes/gamma/all/CMakeLists.txt +++ b/recipes/gamma/all/CMakeLists.txt @@ -1,33 +1,28 @@ cmake_minimum_required(VERSION 3.8) -project(Gamma) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) +project(Gamma LANGUAGES CXX) option(GAMMA_AUDIO_IO "Provide Audio Class" ON) option(GAMMA_SOUNDFILE "Provide SoundFile Class" ON) include(GNUInstallDirs) -set(GAMMA_DIR source_subfolder) - -file(GLOB GAMMA_PUBLIC_HEADERS ${GAMMA_DIR}/Gamma/*.h) +file(GLOB GAMMA_PUBLIC_HEADERS ${GAMMA_SRC_DIR}/Gamma/*.h) add_library(Gamma - ${GAMMA_DIR}/src/arr.cpp - ${GAMMA_DIR}/src/Conversion.cpp - ${GAMMA_DIR}/src/Domain.cpp - ${GAMMA_DIR}/src/DFT.cpp - ${GAMMA_DIR}/src/FFT_fftpack.cpp - ${GAMMA_DIR}/src/fftpack++1.cpp - ${GAMMA_DIR}/src/fftpack++2.cpp - ${GAMMA_DIR}/src/Print.cpp - ${GAMMA_DIR}/src/scl.cpp - ${GAMMA_DIR}/src/Recorder.cpp - ${GAMMA_DIR}/src/Scheduler.cpp - ${GAMMA_DIR}/src/Timer.cpp + ${GAMMA_SRC_DIR}/src/arr.cpp + ${GAMMA_SRC_DIR}/src/Conversion.cpp + ${GAMMA_SRC_DIR}/src/Domain.cpp + ${GAMMA_SRC_DIR}/src/DFT.cpp + ${GAMMA_SRC_DIR}/src/FFT_fftpack.cpp + ${GAMMA_SRC_DIR}/src/fftpack++1.cpp + ${GAMMA_SRC_DIR}/src/fftpack++2.cpp + ${GAMMA_SRC_DIR}/src/Print.cpp + ${GAMMA_SRC_DIR}/src/scl.cpp + ${GAMMA_SRC_DIR}/src/Recorder.cpp + ${GAMMA_SRC_DIR}/src/Scheduler.cpp + ${GAMMA_SRC_DIR}/src/Timer.cpp ) -target_include_directories(Gamma PUBLIC ${GAMMA_DIR}) +target_include_directories(Gamma PUBLIC ${GAMMA_SRC_DIR}) target_compile_features(Gamma PUBLIC cxx_std_14) set_target_properties(Gamma PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) @@ -39,7 +34,7 @@ endif() if(GAMMA_AUDIO_IO) find_package(portaudio REQUIRED CONFIG) target_link_libraries(Gamma PRIVATE portaudio::portaudio) - target_sources(Gamma PRIVATE ${GAMMA_DIR}/src/AudioIO.cpp) + target_sources(Gamma PRIVATE ${GAMMA_SRC_DIR}/src/AudioIO.cpp) else() list(FILTER GAMMA_PUBLIC_HEADERS EXCLUDE REGEX ".*AudioIO\\.h$") endif() @@ -47,7 +42,7 @@ endif() if(GAMMA_SOUNDFILE) find_package(SndFile REQUIRED CONFIG) target_link_libraries(Gamma PRIVATE SndFile::sndfile) - target_sources(Gamma PRIVATE ${GAMMA_DIR}/src/SoundFile.cpp) + target_sources(Gamma PRIVATE ${GAMMA_SRC_DIR}/src/SoundFile.cpp) target_compile_definitions(Gamma PRIVATE GAM_USE_LIBSNDFILE) else() list(FILTER GAMMA_PUBLIC_HEADERS EXCLUDE REGEX ".*SoundFile\\.h$") diff --git a/recipes/gamma/all/conanfile.py b/recipes/gamma/all/conanfile.py index d791afea8a1398..451083af4f13c1 100644 --- a/recipes/gamma/all/conanfile.py +++ b/recipes/gamma/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.51.1" class Gammaconan(ConanFile): @@ -12,7 +15,7 @@ class Gammaconan(ConanFile): "and filtering of signals." ) license = "MIT" - topics = ("gamma", "signal-processing", "sound", "audio") + topics = ("signal-processing", "sound", "audio") homepage = "https://github.com/LancePutnam/Gamma" url = "https://github.com/conan-io/conan-center-index" @@ -31,11 +34,6 @@ class Gammaconan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -43,41 +41,49 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.soundfile: self.requires("libsndfile/1.0.31") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) - if self.options.audio_io: + if self.info.options.audio_io: # TODO: add audio_io support once portaudio added to CCI raise ConanInvalidConfiguration( "gamma:audio_io=True requires portaudio, not available in conan-center yet" ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["GAMMA_AUDIO_IO"] = self.options.audio_io - cmake.definitions["GAMMA_SOUNDFILE"] = self.options.soundfile - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["GAMMA_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["GAMMA_AUDIO_IO"] = self.options.audio_io + tc.variables["GAMMA_SOUNDFILE"] = self.options.soundfile + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/gamma/all/test_package/CMakeLists.txt b/recipes/gamma/all/test_package/CMakeLists.txt index f8bf6bdc344e32..98f55fe7ea287d 100644 --- a/recipes/gamma/all/test_package/CMakeLists.txt +++ b/recipes/gamma/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(gamma REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} gamma::gamma) +target_link_libraries(${PROJECT_NAME} PRIVATE gamma::gamma) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/gamma/all/test_package/conanfile.py b/recipes/gamma/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/gamma/all/test_package/conanfile.py +++ b/recipes/gamma/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gamma/all/test_v1_package/CMakeLists.txt b/recipes/gamma/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..c32216450f32e5 --- /dev/null +++ b/recipes/gamma/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(gamma REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gamma::gamma) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/gamma/all/test_v1_package/conanfile.py b/recipes/gamma/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/gamma/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 1a17b4c7dfb2cd3b70b152b418df775ea1eb870f Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 04:04:15 +0200 Subject: [PATCH 044/300] (#13538) xorg: allow cross compilation * xorg: allow cross compilation with arch settings, it always installs the system's default arch for system packages * Update conanfile.py * complete settings --- recipes/xorg/all/conanfile.py | 16 ++++++++-------- recipes/xorg/all/test_v1_package/conanfile.py | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/recipes/xorg/all/conanfile.py b/recipes/xorg/all/conanfile.py index 6dfbe525aad489..c1f209e672558d 100644 --- a/recipes/xorg/all/conanfile.py +++ b/recipes/xorg/all/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.tools.gnu import PkgConfig -from conan.tools.system.package_manager import Apt, Dnf, PacMan, Pkg, Yum, Zypper +from conan.tools.system import package_manager from conan.errors import ConanInvalidConfiguration required_conan_version = ">=1.47" @@ -12,7 +12,7 @@ class XorgConan(ConanFile): license = "MIT" homepage = "https://www.x.org/wiki/" description = "The X.Org project provides an open source implementation of the X Window System." - settings = "os" + settings = "os", "arch", "compiler", "build_type" topics = ("x11", "xorg") def validate(self): @@ -23,7 +23,7 @@ def package_id(self): self.info.header_only() def system_requirements(self): - apt = Apt(self) + apt = package_manager.Apt(self) apt.install(["libx11-dev", "libx11-xcb-dev", "libfontenc-dev", "libice-dev", "libsm-dev", "libxau-dev", "libxaw7-dev", "libxcomposite-dev", "libxcursor-dev", "libxdamage-dev", "libxdmcp-dev", "libxext-dev", "libxfixes-dev", "libxi-dev", "libxinerama-dev", "libxkbfile-dev", "libxmu-dev", "libxmuu-dev", @@ -35,33 +35,33 @@ def system_requirements(self): apt.install_substitutes( ["libxcb-util-dev"], ["libxcb-util0-dev"], update=True, check=True) - Yum(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + package_manager.Yum(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel", "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", "xcb-util-devel", "libuuid-devel", "xkeyboard-config-devel"], update=True, check=True) - Dnf(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + package_manager.Dnf(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel", "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", "xcb-util-devel", "libuuid-devel", "xkeyboard-config-devel"], update=True, check=True) - Zypper(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + package_manager.Zypper(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel", "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", "xcb-util-devel", "libuuid-devel", "xkeyboard-config"], update=True, check=True) - PacMan(self).install(["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", + package_manager.PacMan(self).install(["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", "libxss", "libxvmc", "xtrans", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util", "util-linux-libs"], update=True, check=True) - Pkg(self).install(["libX11", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", + package_manager.Pkg(self).install(["libX11", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", "libXScrnSaver", "libxvmc", "xtrans", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util"], update=True, check=True) diff --git a/recipes/xorg/all/test_v1_package/conanfile.py b/recipes/xorg/all/test_v1_package/conanfile.py index 5079d1fb5b0837..ce69ba8b754caf 100644 --- a/recipes/xorg/all/test_v1_package/conanfile.py +++ b/recipes/xorg/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os From 79207824dce2b1618e6d7e69a4ea1c597782b711 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 04:24:59 +0200 Subject: [PATCH 045/300] (#13541) opengl: allow cross compilation with arch settings, it always installs the system's default arch for system packages --- recipes/opengl/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/opengl/all/conanfile.py b/recipes/opengl/all/conanfile.py index 264e40ea5e0f0b..09a72805491dee 100644 --- a/recipes/opengl/all/conanfile.py +++ b/recipes/opengl/all/conanfile.py @@ -11,7 +11,7 @@ class SysConfigOpenGLConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.opengl.org/" license = "MIT" - settings = "os" + settings = "os", "arch", "compiler", "build_type" def package_id(self): self.info.header_only() From 901aebb54f3a6a18c0b1336027d1b481cc873484 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 04:44:22 +0200 Subject: [PATCH 046/300] (#13542) egl: allow cross compilation --- recipes/egl/system/conanfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes/egl/system/conanfile.py b/recipes/egl/system/conanfile.py index 818059aea10edc..956446154ca51f 100644 --- a/recipes/egl/system/conanfile.py +++ b/recipes/egl/system/conanfile.py @@ -1,5 +1,6 @@ -from conans import ConanFile, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanException, ConanInvalidConfiguration +from conans import tools class SysConfigEGLConan(ConanFile): @@ -10,7 +11,7 @@ class SysConfigEGLConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.khronos.org/egl" license = "MIT" - settings = "os" + settings = "os", "arch", "compiler", "build_type" def configure(self): if self.settings.os not in ["Linux", "FreeBSD"]: From 03118e827b8d2b872d286c723fe5aca9c9c1122c Mon Sep 17 00:00:00 2001 From: Conan Center Index Bot <54393557+conan-center-bot@users.noreply.github.com> Date: Tue, 18 Oct 2022 05:14:15 +0200 Subject: [PATCH 047/300] (#13543) [bot] Add Access Request users (2022-10-17) --- .c3i/authorized_users.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index 94ef38e9a5f6a4..b3998b2377562c 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -954,3 +954,6 @@ authorized_users: - "jfaust" - "morningstar1" - "lrineau" + - "jwidauer" + - "partiallyderived" + - "Ahajha" From 2af0b4f8a82b8f16fb65c636f3bcee2f861c83e4 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 05:24:38 +0200 Subject: [PATCH 048/300] (#13544) bump github actions * bump github actions these use depcreated nodejs: https://github.com/conan-io/conan-center-index/actions/runs/3264204975 https://github.com/conan-io/conan-center-index/actions/runs/3264790541 https://github.com/conan-io/conan-center-index/actions/runs/3264796403 * Update linter-yaml.yml * Update linter-yaml.yml * Update linter-conan-v2.yml * Update linter-conan-v2.yml --- .github/workflows/linter-conan-v2.yml | 12 ++++++------ .github/workflows/linter-yaml.yml | 10 +++++----- .github/workflows/on-push-do-doco.yml | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/linter-conan-v2.yml b/.github/workflows/linter-conan-v2.yml index d1f78543433e74..618e82492e8650 100644 --- a/.github/workflows/linter-conan-v2.yml +++ b/.github/workflows/linter-conan-v2.yml @@ -18,7 +18,7 @@ jobs: with: fetch-depth: 2 - name: Get changed files - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 id: changed_files with: files: | @@ -29,7 +29,7 @@ jobs: uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed_files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} @@ -87,7 +87,7 @@ jobs: fetch-depth: 2 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 with: files: | recipes/*/*/conanfile.py @@ -97,7 +97,7 @@ jobs: uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed-files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} @@ -122,7 +122,7 @@ jobs: fetch-depth: 2 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 with: files: | recipes/*/*/test_*/conanfile.py @@ -132,7 +132,7 @@ jobs: uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed-files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} diff --git a/.github/workflows/linter-yaml.yml b/.github/workflows/linter-yaml.yml index 511e654ab8bb02..be716fffc216a4 100644 --- a/.github/workflows/linter-yaml.yml +++ b/.github/workflows/linter-yaml.yml @@ -20,13 +20,13 @@ jobs: fetch-depth: 2 - name: Get changed files - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 id: changed_files with: files: | linter/** - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed_files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} @@ -53,7 +53,7 @@ jobs: with: fetch-depth: 2 - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 with: python-version: ${{ env.PYVER }} @@ -64,7 +64,7 @@ jobs: - name: Get changed files (config) id: changed_files_config if: always() - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 with: files: | ${{ env.CONFIG_FILES_PATH }} @@ -80,7 +80,7 @@ jobs: - name: Get changed files (conandata) id: changed_files_conandata if: always() - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 with: files: | ${{ env.CONANDATA_FILES_PATH }} diff --git a/.github/workflows/on-push-do-doco.yml b/.github/workflows/on-push-do-doco.yml index fe33f4984dfb3c..f5206b720d4a98 100644 --- a/.github/workflows/on-push-do-doco.yml +++ b/.github/workflows/on-push-do-doco.yml @@ -22,7 +22,7 @@ jobs: --toc-level 5 shell: bash - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: branch: bot/action-doc-toc commit-message: "[docs] Regenerate tables of contents" From d78fefe0e2116e4d45deff9a02e59d300ebf622d Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 05:44:22 +0200 Subject: [PATCH 049/300] (#13545) Create dependabot.yml this bot will create automatically pull-request bumping github actions version This avoids obsolescences and vulnerabilities --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000000..90e05c40d04594 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" From 42faf2bb9bd52bb22a073313903fad18388592eb Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 18 Oct 2022 13:08:53 +0900 Subject: [PATCH 050/300] (#13527) tcb-span: add vercion cci.20220616 and support conan v2 * tcb-span: add vercion cci.20220616 and support conan v2 * remove Version Co-authored-by: Chris Mc Co-authored-by: Chris Mc --- recipes/tcb-span/all/conandata.yml | 3 ++ recipes/tcb-span/all/conanfile.py | 53 ++++++++++++------- .../tcb-span/all/test_package/CMakeLists.txt | 13 ++--- .../tcb-span/all/test_package/conanfile.py | 21 +++++--- .../all/test_v1_package/CMakeLists.txt | 11 ++++ .../tcb-span/all/test_v1_package/conanfile.py | 18 +++++++ recipes/tcb-span/config.yml | 2 + 7 files changed, 88 insertions(+), 33 deletions(-) create mode 100644 recipes/tcb-span/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/tcb-span/all/test_v1_package/conanfile.py diff --git a/recipes/tcb-span/all/conandata.yml b/recipes/tcb-span/all/conandata.yml index 05f7484b6046db..d9462a68d33396 100644 --- a/recipes/tcb-span/all/conandata.yml +++ b/recipes/tcb-span/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20220616": + url: "https://github.com/tcbrindle/span/archive/836dc6a0efd9849cb194e88e4aa2387436bb079b.tar.gz" + sha256: "66650479f85b92c6a6230706e4ac4a1bca18a7c7102fc7e02ad332f86548c9b6" "cci.20200603": url: "https://github.com/tcbrindle/span/archive/5d8d366eca918d0ed3d2d196cbeae6abfd874736.tar.gz" sha256: "c294ec2314eeccbcfe12b549ca6c165fbe9f97d2d52a0ad4c9a28f73fa87861a" diff --git a/recipes/tcb-span/all/conanfile.py b/recipes/tcb-span/all/conanfile.py index 9ede6d7dbfadf2..5edd705ca74ca5 100644 --- a/recipes/tcb-span/all/conanfile.py +++ b/recipes/tcb-span/all/conanfile.py @@ -1,34 +1,49 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.50.0" class TcbSpanConan(ConanFile): name = "tcb-span" description = "Implementation of C++20's std::span for older C++ standards" - topics = ("conan", "span", "header-only", "tcb-span") - homepage = "https://github.com/tcbrindle/span" - url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" - settings = "compiler" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/tcbrindle/span" + topics = ("span", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 - def configure(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="LICENSE*.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", src=include_folder) - - def package_id(self): - self.info.header_only() + copy(self, pattern="LICENSE*.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/tcb-span/all/test_package/CMakeLists.txt b/recipes/tcb-span/all/test_package/CMakeLists.txt index 3618b7fc14eb54..858448385983df 100644 --- a/recipes/tcb-span/all/test_package/CMakeLists.txt +++ b/recipes/tcb-span/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(tcb-span REQUIRED CONFIG) -find_package(tcb-span REQUIRED) - -add_executable(test_package test_package.cxx) -target_link_libraries(test_package tcb-span::tcb-span) -set_property(TARGET test_package PROPERTY CXX_STANDARD 17) +add_executable(${PROJECT_NAME} test_package.cxx) +target_link_libraries(${PROJECT_NAME} PRIVATE tcb-span::tcb-span) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tcb-span/all/test_package/conanfile.py b/recipes/tcb-span/all/test_package/conanfile.py index 1d0bdd3779793f..a9fb96656f2039 100644 --- a/recipes/tcb-span/all/test_package/conanfile.py +++ b/recipes/tcb-span/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tcb-span/all/test_v1_package/CMakeLists.txt b/recipes/tcb-span/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..6930ecd6ea58a3 --- /dev/null +++ b/recipes/tcb-span/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tcb-span REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cxx) +target_link_libraries(${PROJECT_NAME} PRIVATE tcb-span::tcb-span) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tcb-span/all/test_v1_package/conanfile.py b/recipes/tcb-span/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/tcb-span/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tcb-span/config.yml b/recipes/tcb-span/config.yml index 7208e0ea0a4e04..eb7ad34aa4cc49 100644 --- a/recipes/tcb-span/config.yml +++ b/recipes/tcb-span/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20220616": + folder: all "cci.20200603": folder: all From 71f7dfbf07ce4e2e102b8164fc19e17d1f952a45 Mon Sep 17 00:00:00 2001 From: Conan Center Index Bot <54393557+conan-center-bot@users.noreply.github.com> Date: Tue, 18 Oct 2022 06:27:15 +0200 Subject: [PATCH 051/300] (#13549) [doc] Update supported platforms and configurations (2022-10-17) Co-authored-by: CCI bot --- docs/supported_platforms_and_configurations.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/supported_platforms_and_configurations.md b/docs/supported_platforms_and_configurations.md index 6ca6d82cfbdc5d..d246cd963f72ce 100644 --- a/docs/supported_platforms_and_configurations.md +++ b/docs/supported_platforms_and_configurations.md @@ -39,6 +39,8 @@ For more information see [conan-io/conan-docker-tools](https://github.com/conan- - Python: 3.7.9 - CMake: 3.21.6 - WinSDK: 10.0.20348 + > WinSDK version is rolled periodically as [discussed previously](https://github.com/conan-io/conan-center-index/issues/4450). + > Please open an issue in case it needs to be updated. - Compilers: Visual Studio: - 2017 (19.16.27048) From dfd7ddc382f7ff95d8a5d2d90851969a3e8be19a Mon Sep 17 00:00:00 2001 From: Andrei Malashkin Date: Tue, 18 Oct 2022 08:04:32 +0200 Subject: [PATCH 052/300] (#12747) migrate hash-library to conan v2 * migrate hash-library to conan v2 * Update recipes/hash-library/all/conanfile.py * Update recipes/hash-library/all/conanfile.py * Update recipes/hash-library/all/conanfile.py * Update recipes/hash-library/all/test_package/conanfile.py * Update recipes/hash-library/all/test_package/conanfile.py * complete migration * Apply suggestions from code review Co-authored-by: Chris Mc * Apply suggestions from code review Co-authored-by: Chris Mc Co-authored-by: Daniel Co-authored-by: Chris Mc --- recipes/hash-library/all/CMakeLists.txt | 7 ++-- recipes/hash-library/all/conanfile.py | 33 ++++++++----------- .../all/test_package/CMakeLists.txt | 5 +-- .../all/test_package/conanfile.py | 19 ++++++++--- .../all/test_v1_package/CMakeLists.txt | 10 ++++++ .../all/test_v1_package/conanfile.py | 17 ++++++++++ 6 files changed, 58 insertions(+), 33 deletions(-) create mode 100644 recipes/hash-library/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/hash-library/all/test_v1_package/conanfile.py diff --git a/recipes/hash-library/all/CMakeLists.txt b/recipes/hash-library/all/CMakeLists.txt index fcb1139946f462..93df61904faf02 100644 --- a/recipes/hash-library/all/CMakeLists.txt +++ b/recipes/hash-library/all/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.15) project(hash-library CXX) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - add_library(${CMAKE_PROJECT_NAME} source_subfolder/crc32.cpp source_subfolder/keccak.cpp @@ -26,7 +23,7 @@ set(HEADERS source_subfolder/sha3.h ) -set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES +set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADERS}" ) diff --git a/recipes/hash-library/all/conanfile.py b/recipes/hash-library/all/conanfile.py index ec0cfab1d3887c..7eb68b7364340e 100644 --- a/recipes/hash-library/all/conanfile.py +++ b/recipes/hash-library/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.cmake import CMake +from conan.tools.files import apply_conandata_patches, get +from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class HashLibraryConan(ConanFile): @@ -13,17 +15,16 @@ class HashLibraryConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" settings = "os", "compiler", "build_type", "arch" options = { - "shared": [True, False], + "shared": [True, False], "fPIC": [True, False] } default_options = { - "shared": False, + "shared": False, "fPIC": True } - generators = "cmake" + generators = "CMakeToolchain" exports_sources = ["CMakeLists.txt", "patches/*"] - _cmake = None @property def _source_subfolder(self): @@ -42,24 +43,18 @@ def configure(self): del self.options.fPIC def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.install() def package_info(self): diff --git a/recipes/hash-library/all/test_package/CMakeLists.txt b/recipes/hash-library/all/test_package/CMakeLists.txt index 0680bf45d87e92..a7c0d37bd65080 100644 --- a/recipes/hash-library/all/test_package/CMakeLists.txt +++ b/recipes/hash-library/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(hash-library CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/hash-library/all/test_package/conanfile.py b/recipes/hash-library/all/test_package/conanfile.py index 1d5e456107c572..6dbd1de3882883 100644 --- a/recipes/hash-library/all/test_package/conanfile.py +++ b/recipes/hash-library/all/test_package/conanfile.py @@ -1,11 +1,20 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout class HashLibraryTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hash-library/all/test_v1_package/CMakeLists.txt b/recipes/hash-library/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..ec49a4ac21f184 --- /dev/null +++ b/recipes/hash-library/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(hash-library CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} hash-library::hash-library) diff --git a/recipes/hash-library/all/test_v1_package/conanfile.py b/recipes/hash-library/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..4265550ef4aee7 --- /dev/null +++ b/recipes/hash-library/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, tools, CMake + + +class HashLibraryTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 0bb4601189762008bf1d0aa700569c14b1ec1e8e Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 08:25:48 +0200 Subject: [PATCH 053/300] (#13524) embree3: conan v2 support * conan v2 support * fix position of cmake_minimum_required() * remove vc runtime files --- recipes/embree3/all/CMakeLists.txt | 7 - recipes/embree3/all/conandata.yml | 16 ++ recipes/embree3/all/conanfile.py | 167 +++++++++--------- .../3.12.x-0001-cmake-minimum-required.patch | 17 ++ .../3.13.x-0001-cmake-minimum-required.patch | 17 ++ .../embree3/all/test_package/CMakeLists.txt | 7 +- recipes/embree3/all/test_package/conanfile.py | 19 +- .../all/test_v1_package/CMakeLists.txt | 10 ++ .../embree3/all/test_v1_package/conanfile.py | 17 ++ 9 files changed, 175 insertions(+), 102 deletions(-) delete mode 100644 recipes/embree3/all/CMakeLists.txt create mode 100644 recipes/embree3/all/patches/3.12.x-0001-cmake-minimum-required.patch create mode 100644 recipes/embree3/all/patches/3.13.x-0001-cmake-minimum-required.patch create mode 100644 recipes/embree3/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/embree3/all/test_v1_package/conanfile.py diff --git a/recipes/embree3/all/CMakeLists.txt b/recipes/embree3/all/CMakeLists.txt deleted file mode 100644 index 27f20e640dcb84..00000000000000 --- a/recipes/embree3/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/embree3/all/conandata.yml b/recipes/embree3/all/conandata.yml index c3ac8086923808..9013cde5668001 100644 --- a/recipes/embree3/all/conandata.yml +++ b/recipes/embree3/all/conandata.yml @@ -8,3 +8,19 @@ sources: "3.12.0": url: "https://github.com/embree/embree/archive/refs/tags/v3.12.0.tar.gz" sha256: "f3646977c45a9ece1fb0cfe107567adcc645b1c77c27b36572d0aa98b888190c" +patches: + "3.13.3": + - patch_file: "patches/3.13.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: Fix position of cmake_minimum_required()" + patch_type: "backport" + patch_source: "https://github.com/embree/embree/pull/406" + "3.13.1": + - patch_file: "patches/3.13.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: Fix position of cmake_minimum_required()" + patch_type: "backport" + patch_source: "https://github.com/embree/embree/pull/406" + "3.12.0": + - patch_file: "patches/3.12.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: Fix position of cmake_minimum_required()" + patch_type: "backport" + patch_source: "https://github.com/embree/embree/pull/406" diff --git a/recipes/embree3/all/conanfile.py b/recipes/embree3/all/conanfile.py index 295f4cee2d9844..4be8a839047092 100644 --- a/recipes/embree3/all/conanfile.py +++ b/recipes/embree3/all/conanfile.py @@ -1,11 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.files import save, load +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, rm, rmdir, save +from conan.tools.microsoft import check_min_vs +from conan.tools.scm import Version import glob import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class EmbreeConan(ConanFile): @@ -59,25 +62,13 @@ class EmbreeConan(ConanFile): "ignore_invalid_rays": False, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _has_sse_avx(self): return self.settings.arch in ["x86", "x86_64"] @property def _embree_has_neon_support(self): - return tools.Version(self.version) >= "3.13.0" + return Version(self.version) >= "3.13.0" @property def _has_neon(self): @@ -93,6 +84,9 @@ def _num_isa(self): num_isa += 1 return num_isa + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -105,98 +99,102 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if not (self._has_sse_avx or (self._embree_has_neon_support and self._has_neon)): raise ConanInvalidConfiguration("Embree {} doesn't support {}".format(self.version, self.settings.arch)) - compiler_version = tools.Version(self.settings.compiler.version) - if self.settings.compiler == "clang" and compiler_version < "4": + compiler_version = Version(self.info.settings.compiler.version) + if self.info.settings.compiler == "clang" and compiler_version < "4": raise ConanInvalidConfiguration("Clang < 4 is not supported") - elif self.settings.compiler == "Visual Studio" and compiler_version < "15": - raise ConanInvalidConfiguration("Visual Studio < 15 is not supported") - if self.settings.os == "Linux" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": - raise ConanInvalidConfiguration("conan recipe for Embree v{0} \ - cannot be built with clang libc++, use libstdc++ instead".format(self.version)) + check_min_vs(self, 191) + + if self.info.settings.os == "Linux" and self.info.settings.compiler == "clang" and self.info.settings.compiler.libcxx == "libc++": + raise ConanInvalidConfiguration(f"{self.ref} cannot be built with clang libc++, use libstdc++ instead") - if self.settings.compiler == "apple-clang" and not self.options.shared and compiler_version >= "9.0" and self._num_isa > 1: + if self.info.settings.compiler == "apple-clang" and not self.info.options.shared and compiler_version >= "9.0" and self._num_isa > 1: raise ConanInvalidConfiguration("Embree static with apple-clang >=9 and multiple ISA (simd) is not supported") if self._num_isa == 0: raise ConanInvalidConfiguration("At least one ISA (simd) must be enabled") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - - # Configure CMake library build: - self._cmake.definitions["EMBREE_STATIC_LIB"] = not self.options.shared - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["EMBREE_TUTORIALS"] = False - self._cmake.definitions["EMBREE_GEOMETRY_CURVE"] = self.options.geometry_curve - self._cmake.definitions["EMBREE_GEOMETRY_GRID"] = self.options.geometry_grid - self._cmake.definitions["EMBREE_GEOMETRY_INSTANCE"] = self.options.geometry_instance - self._cmake.definitions["EMBREE_GEOMETRY_QUAD"] = self.options.geometry_quad - self._cmake.definitions["EMBREE_GEOMETRY_SUBDIVISION"] = self.options.geometry_subdivision - self._cmake.definitions["EMBREE_GEOMETRY_TRIANGLE"] = self.options.geometry_triangle - self._cmake.definitions["EMBREE_GEOMETRY_USER"] = self.options.geometry_user - self._cmake.definitions["EMBREE_RAY_PACKETS"] = self.options.ray_packets - self._cmake.definitions["EMBREE_RAY_MASK"] = self.options.ray_masking - self._cmake.definitions["EMBREE_BACKFACE_CULLING"] = self.options.backface_culling - self._cmake.definitions["EMBREE_IGNORE_INVALID_RAYS"] = self.options.ignore_invalid_rays - self._cmake.definitions["EMBREE_ISPC_SUPPORT"] = False - self._cmake.definitions["EMBREE_TASKING_SYSTEM"] = "INTERNAL" - self._cmake.definitions["EMBREE_MAX_ISA"] = "NONE" + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["EMBREE_STATIC_LIB"] = not self.options.shared + tc.variables["BUILD_TESTING"] = False + tc.variables["EMBREE_TUTORIALS"] = False + tc.variables["EMBREE_GEOMETRY_CURVE"] = self.options.geometry_curve + tc.variables["EMBREE_GEOMETRY_GRID"] = self.options.geometry_grid + tc.variables["EMBREE_GEOMETRY_INSTANCE"] = self.options.geometry_instance + tc.variables["EMBREE_GEOMETRY_QUAD"] = self.options.geometry_quad + tc.variables["EMBREE_GEOMETRY_SUBDIVISION"] = self.options.geometry_subdivision + tc.variables["EMBREE_GEOMETRY_TRIANGLE"] = self.options.geometry_triangle + tc.variables["EMBREE_GEOMETRY_USER"] = self.options.geometry_user + tc.variables["EMBREE_RAY_PACKETS"] = self.options.ray_packets + tc.variables["EMBREE_RAY_MASK"] = self.options.ray_masking + tc.variables["EMBREE_BACKFACE_CULLING"] = self.options.backface_culling + tc.variables["EMBREE_IGNORE_INVALID_RAYS"] = self.options.ignore_invalid_rays + tc.variables["EMBREE_ISPC_SUPPORT"] = False + tc.variables["EMBREE_TASKING_SYSTEM"] = "INTERNAL" + tc.variables["EMBREE_MAX_ISA"] = "NONE" if self._embree_has_neon_support: - self._cmake.definitions["EMBREE_ISA_NEON"] = self._has_neon - self._cmake.definitions["EMBREE_ISA_SSE2"] = self.options.get_safe("sse2", False) - self._cmake.definitions["EMBREE_ISA_SSE42"] = self.options.get_safe("sse42", False) - self._cmake.definitions["EMBREE_ISA_AVX"] = self.options.get_safe("avx", False) - self._cmake.definitions["EMBREE_ISA_AVX2"] = self.options.get_safe("avx2", False) - if tools.Version(self.version) < "3.12.2": + tc.variables["EMBREE_ISA_NEON"] = self._has_neon + tc.variables["EMBREE_ISA_SSE2"] = self.options.get_safe("sse2", False) + tc.variables["EMBREE_ISA_SSE42"] = self.options.get_safe("sse42", False) + tc.variables["EMBREE_ISA_AVX"] = self.options.get_safe("avx", False) + tc.variables["EMBREE_ISA_AVX2"] = self.options.get_safe("avx2", False) + if Version(self.version) < "3.12.2": # TODO: probably broken if avx512 enabled, must cumbersome to add specific options in the recipe - self._cmake.definitions["EMBREE_ISA_AVX512KNL"] = self.options.get_safe("avx512", False) - self._cmake.definitions["EMBREE_ISA_AVX512SKX"] = self.options.get_safe("avx512", False) + tc.variables["EMBREE_ISA_AVX512KNL"] = self.options.get_safe("avx512", False) + tc.variables["EMBREE_ISA_AVX512SKX"] = self.options.get_safe("avx512", False) else: - self._cmake.definitions["EMBREE_ISA_AVX512"] = self.options.get_safe("avx512", False) - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["EMBREE_ISA_AVX512"] = self.options.get_safe("avx512", False) + tc.generate() - def build(self): + def _patch_sources(self): + apply_conandata_patches(self) # some compilers (e.g. clang) do not like UTF-16 sources - rc = os.path.join(self._source_subfolder, "kernels", "embree.rc") + rc = os.path.join(self.source_folder, "kernels", "embree.rc") content = load(self, rc, encoding="utf_16_le") if content[0] == '\ufeff': content = content[1:] content = "#pragma code_page(65001)\n" + content save(self, rc, content) - os.remove(os.path.join(self._source_subfolder, "common", "cmake", "FindTBB.cmake")) - cmake = self._configure_cmake() + os.remove(os.path.join(self.source_folder, "common", "cmake", "FindTBB.cmake")) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder), "*.command") - tools.remove_files_by_mask(os.path.join(self.package_folder), "*.cmake") + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.command", os.path.join(self.package_folder)) + rm(self, "*.cmake", os.path.join(self.package_folder)) if self.settings.os == "Windows" and self.options.shared: for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: - tools.remove_files_by_mask(os.path.join(self.package_folder), dll_pattern_to_remove) + rm(self, dll_pattern_to_remove, os.path.join(self.package_folder, "bin")) else: - tools.rmdir(os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "bin")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -204,34 +202,33 @@ def package(self): {"embree": "embree::embree"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "embree") self.cpp_info.set_property("cmake_target_name", "embree") def _lib_exists(name): - return True if glob.glob(os.path.join(self.package_folder, "lib", "*{}.*".format(name))) else False + return True if glob.glob(os.path.join(self.package_folder, "lib", f"*{name}.*")) else False self.cpp_info.libs = ["embree3"] if not self.options.shared: self.cpp_info.libs.extend(["sys", "math", "simd", "lexers", "tasking"]) simd_libs = ["embree_sse42", "embree_avx", "embree_avx2"] - simd_libs.extend(["embree_avx512knl", "embree_avx512skx"] if tools.Version(self.version) < "3.12.2" else ["embree_avx512"]) + simd_libs.extend(["embree_avx512knl", "embree_avx512skx"] if Version(self.version) < "3.12.2" else ["embree_avx512"]) for lib in simd_libs: if _lib_exists(lib): self.cpp_info.libs.append(lib) diff --git a/recipes/embree3/all/patches/3.12.x-0001-cmake-minimum-required.patch b/recipes/embree3/all/patches/3.12.x-0001-cmake-minimum-required.patch new file mode 100644 index 00000000000000..d07ff0aa4e590d --- /dev/null +++ b/recipes/embree3/all/patches/3.12.x-0001-cmake-minimum-required.patch @@ -0,0 +1,17 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,6 @@ + ## Copyright 2009-2020 Intel Corporation + ## SPDX-License-Identifier: Apache-2.0 ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) + + SET(EMBREE_VERSION_MAJOR 3) + SET(EMBREE_VERSION_MINOR 12) +@@ -12,7 +13,6 @@ SET(CPACK_RPM_PACKAGE_RELEASE 1) + + PROJECT(embree${EMBREE_VERSION_MAJOR}) + +-CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) + + # We use our own strip tool on macOS to sign during install. This is required as CMake modifies RPATH of the binary during install. + IF (APPLE AND EMBREE_SIGN_FILE) diff --git a/recipes/embree3/all/patches/3.13.x-0001-cmake-minimum-required.patch b/recipes/embree3/all/patches/3.13.x-0001-cmake-minimum-required.patch new file mode 100644 index 00000000000000..6208148722846c --- /dev/null +++ b/recipes/embree3/all/patches/3.13.x-0001-cmake-minimum-required.patch @@ -0,0 +1,17 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,6 @@ + ## Copyright 2009-2021 Intel Corporation + ## SPDX-License-Identifier: Apache-2.0 ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) + + SET(EMBREE_VERSION_MAJOR 3) + SET(EMBREE_VERSION_MINOR 13) +@@ -12,7 +13,6 @@ SET(CPACK_RPM_PACKAGE_RELEASE 1) + + PROJECT(embree${EMBREE_VERSION_MAJOR}) + +-CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) + + # We use our own strip tool on macOS to sign during install. This is required as CMake modifies RPATH of the binary during install. + IF (APPLE AND EMBREE_SIGN_FILE) diff --git a/recipes/embree3/all/test_package/CMakeLists.txt b/recipes/embree3/all/test_package/CMakeLists.txt index 401ddb44db0d52..fe2724327bb76c 100644 --- a/recipes/embree3/all/test_package/CMakeLists.txt +++ b/recipes/embree3/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(embree REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} embree) +target_link_libraries(${PROJECT_NAME} PRIVATE embree) diff --git a/recipes/embree3/all/test_package/conanfile.py b/recipes/embree3/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/embree3/all/test_package/conanfile.py +++ b/recipes/embree3/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/embree3/all/test_v1_package/CMakeLists.txt b/recipes/embree3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..42932a84125668 --- /dev/null +++ b/recipes/embree3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(embree REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE embree) diff --git a/recipes/embree3/all/test_v1_package/conanfile.py b/recipes/embree3/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/embree3/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From f9ac9d9698c63cad51abdb4a62adfca7f03e555b Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 18 Oct 2022 15:44:44 +0900 Subject: [PATCH 054/300] (#13553) libmaxminddb: add version 1.7.1 * libmaxminddb: add version 1.7.1 * rmdir lib/pkgconfig --- recipes/libmaxminddb/all/conandata.yml | 3 +++ recipes/libmaxminddb/all/conanfile.py | 17 +++++++++-------- recipes/libmaxminddb/config.yml | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/recipes/libmaxminddb/all/conandata.yml b/recipes/libmaxminddb/all/conandata.yml index e3c0f80605ee64..83c876364326de 100644 --- a/recipes/libmaxminddb/all/conandata.yml +++ b/recipes/libmaxminddb/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.7.1": + url: "https://github.com/maxmind/libmaxminddb/releases/download/1.7.1/libmaxminddb-1.7.1.tar.gz" + sha256: "e8414f0dedcecbc1f6c31cb65cd81650952ab0677a4d8c49cab603b3b8fb083e" "1.6.0": url: "https://github.com/maxmind/libmaxminddb/releases/download/1.6.0/libmaxminddb-1.6.0.tar.gz" sha256: "7620ac187c591ce21bcd7bf352376a3c56a933e684558a1f6bef4bd4f3f98267" diff --git a/recipes/libmaxminddb/all/conanfile.py b/recipes/libmaxminddb/all/conanfile.py index b892fd003142a5..7afd56f70e0870 100644 --- a/recipes/libmaxminddb/all/conanfile.py +++ b/recipes/libmaxminddb/all/conanfile.py @@ -1,19 +1,17 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir import os -required_conan_version = ">=1.50.0" - +required_conan_version = ">=1.52.0" class LibmaxminddbConan(ConanFile): name = "libmaxminddb" + description = "C library for the MaxMind DB file format" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "http://maxmind.github.io/libmaxminddb/" - description = "C library for the MaxMind DB file format" topics = ("maxmind", "geoip") - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,8 +23,7 @@ class LibmaxminddbConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,7 +31,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: del self.settings.compiler.libcxx except Exception: @@ -69,6 +69,7 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "maxminddb") diff --git a/recipes/libmaxminddb/config.yml b/recipes/libmaxminddb/config.yml index 225152169dbd89..9efd2189b76e96 100644 --- a/recipes/libmaxminddb/config.yml +++ b/recipes/libmaxminddb/config.yml @@ -1,3 +1,5 @@ versions: + "1.7.1": + folder: all "1.6.0": folder: all From 72c835918e33c73a5340d2bb1a765a1e99c606c9 Mon Sep 17 00:00:00 2001 From: Martin Delille Date: Tue, 18 Oct 2022 10:05:41 +0200 Subject: [PATCH 055/300] (#13185) [yasm/xxx] Conan v2 migration * [yasm/xxx] Conan v2 migration * Apply suggestions from code review Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * Fix self.package_folder * Remove basic_layout src_folder parameter * Fix sln path * Patch visual studio project * Apply suggestions from code review Co-authored-by: Chris Mc * Switch to vc12 * yasm: use CMake script for MSVC * Use cmake_layout Windows * Remove YAML-VERSION-GEN.bat * Remove unused import and property * Update recipes/yasm/all/test_package/conanfile.py Co-authored-by: Uilian Ries Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Co-authored-by: Chris Mc Co-authored-by: Anonymous Maarten Co-authored-by: Uilian Ries --- recipes/yasm/all/conandata.yml | 7 +- recipes/yasm/all/conanfile.py | 117 +++++++++--------- .../yasm/all/patches/0001-cmake-updates.patch | 67 ++++++++++ recipes/yasm/all/test_package/conanfile.py | 14 ++- recipes/yasm/all/test_v1_package/conanfile.py | 10 ++ 5 files changed, 149 insertions(+), 66 deletions(-) create mode 100644 recipes/yasm/all/patches/0001-cmake-updates.patch create mode 100644 recipes/yasm/all/test_v1_package/conanfile.py diff --git a/recipes/yasm/all/conandata.yml b/recipes/yasm/all/conandata.yml index 8513b90d3ac059..54b8e4dfddf30c 100644 --- a/recipes/yasm/all/conandata.yml +++ b/recipes/yasm/all/conandata.yml @@ -2,5 +2,8 @@ sources: "1.3.0": - url: "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz" sha256: "3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd5603f" - - url: "https://raw.githubusercontent.com/yasm/yasm/bcc01c59d8196f857989e6ae718458c296ca20e3/YASM-VERSION-GEN.bat" - sha256: "b976cb97d2f7bb00e78e5db0da0978659acbdd60b52998cd2983145d8d75f141" +patches: + "1.3.0": + - patch_file: "patches/0001-cmake-updates.patch" + patch_description: "CMake 3.0+ compatibility" + patch_type: "conan" diff --git a/recipes/yasm/all/conanfile.py b/recipes/yasm/all/conanfile.py index 7a6b161ce45e85..6ae77d25266179 100644 --- a/recipes/yasm/all/conanfile.py +++ b/recipes/yasm/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout, cmake_layout +from conan.tools.microsoft import is_msvc + import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class YASMConan(ConanFile): name = "yasm" @@ -14,87 +19,79 @@ class YASMConan(ConanFile): license = "BSD-2-Clause" settings = "os", "arch", "compiler", "build_type" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def configure(self): del self.settings.compiler.libcxx del self.settings.compiler.cppstd - def build_requirements(self): - if self._settings_build.os == "Windows" and self.settings.compiler != "Visual Studio" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def layout(self): + if is_msvc(self): + cmake_layout(self) + else: + basic_layout(self) def package_id(self): del self.info.settings.compiler def source(self): - tools.get(**self.conan_data["sources"][self.version][0], - destination=self._source_subfolder, strip_root=True) - tools.download(**self.conan_data["sources"][self.version][1], - filename=os.path.join(self._source_subfolder, "YASM-VERSION-GEN.bat")) - - @property - def _msvc_subfolder(self): - return os.path.join(self._source_subfolder, "Mkfiles", "vc10") - - def _build_vs(self): - with tools.chdir(self._msvc_subfolder): - msbuild = MSBuild(self) - if self.settings.arch == "x86": - msbuild.build_env.link_flags.append("/MACHINE:X86") - elif self.settings.arch == "x86_64": - msbuild.build_env.link_flags.append("/SAFESEH:NO /MACHINE:X64") - build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - msbuild.build(project_file="yasm.sln", build_type=build_type, upgrade_project=False, - targets=["yasm"], platforms={"x86": "Win32"}, force_vcvars=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), + get(self, **self.conan_data["sources"][self.version][0], + destination=self.source_folder, strip_root=True) + + def _generate_autotools(self): + tc = AutotoolsToolchain(self) + enable_debug = "yes" if self.settings.build_type == "Debug" else "no" + tc.configure_args.extend([ + f"--enable-debug={enable_debug}", "--disable-rpath", "--disable-nls", - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + ]) + tc.generate() + + def _generate_cmake(self): + tc = CMakeToolchain(self) + tc.cache_variables["YASM_BUILD_TESTS"] = False + tc.generate() + + def generate(self): + if is_msvc(self): + self._generate_cmake() + else: + self._generate_autotools() def build(self): - if self.settings.compiler == "Visual Studio": - self._build_vs() + apply_conandata_patches(self) + if is_msvc(self): + cmake = CMake(self) + cmake.configure() + cmake.build() else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="BSD.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self.settings.compiler == "Visual Studio": - arch = { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - tools.mkdir(os.path.join(self.package_folder, "bin")) - build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - shutil.copy(os.path.join(self._msvc_subfolder, arch, build_type, "yasm.exe"), - os.path.join(self.package_folder, "bin", "yasm.exe")) - self.copy(pattern="yasm.exe*", src=self._source_subfolder, dst="bin", keep_path=False) + copy(self, pattern="BSD.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/yasm/all/patches/0001-cmake-updates.patch b/recipes/yasm/all/patches/0001-cmake-updates.patch new file mode 100644 index 00000000000000..8f43dacf4f2407 --- /dev/null +++ b/recipes/yasm/all/patches/0001-cmake-updates.patch @@ -0,0 +1,67 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ ++CMAKE_MINIMUM_REQUIRED(VERSION 3.0) + PROJECT(yasm) +-CMAKE_MINIMUM_REQUIRED(VERSION 2.4) + if (COMMAND cmake_policy) + cmake_policy(SET CMP0003 NEW) + endif (COMMAND cmake_policy) +--- a/cmake/modules/YasmMacros.cmake ++++ b/cmake/modules/YasmMacros.cmake +@@ -58,31 +58,31 @@ macro (YASM_ADD_MODULE _module_NAME) + endmacro (YASM_ADD_MODULE) + + macro (YASM_GENPERF _in_NAME _out_NAME) +- get_target_property(_tmp_GENPERF_EXE genperf LOCATION) ++ #get_target_property(_tmp_GENPERF_EXE genperf LOCATION) + add_custom_command( + OUTPUT ${_out_NAME} +- COMMAND ${_tmp_GENPERF_EXE} ${_in_NAME} ${_out_NAME} +- DEPENDS ${_tmp_GENPERF_EXE} ++ COMMAND genperf ${_in_NAME} ${_out_NAME} ++ #DEPENDS ${_tmp_GENPERF_EXE} + MAIN_DEPENDENCY ${_in_NAME} + ) + endmacro (YASM_GENPERF) + + macro (YASM_RE2C _in_NAME _out_NAME) +- get_target_property(_tmp_RE2C_EXE re2c LOCATION) ++ #get_target_property(_tmp_RE2C_EXE re2c LOCATION) + add_custom_command( + OUTPUT ${_out_NAME} +- COMMAND ${_tmp_RE2C_EXE} ${ARGN} -o ${_out_NAME} ${_in_NAME} +- DEPENDS ${_tmp_RE2C_EXE} ++ COMMAND re2c ${ARGN} -o ${_out_NAME} ${_in_NAME} ++ #DEPENDS ${_tmp_RE2C_EXE} + MAIN_DEPENDENCY ${_in_NAME} + ) + endmacro (YASM_RE2C) + + macro (YASM_GENMACRO _in_NAME _out_NAME _var_NAME) +- get_target_property(_tmp_GENMACRO_EXE genmacro LOCATION) ++ #get_target_property(_tmp_GENMACRO_EXE genmacro LOCATION) + add_custom_command( + OUTPUT ${_out_NAME} +- COMMAND ${_tmp_GENMACRO_EXE} ${_out_NAME} ${_var_NAME} ${_in_NAME} +- DEPENDS ${_tmp_GENMACRO_EXE} ++ COMMAND genmacro ${_out_NAME} ${_var_NAME} ${_in_NAME} ++ #DEPENDS ${_tmp_GENMACRO_EXE} + MAIN_DEPENDENCY ${_in_NAME} + ) + endmacro (YASM_GENMACRO) +--- a/modules/preprocs/nasm/CMakeLists.txt ++++ b/modules/preprocs/nasm/CMakeLists.txt +@@ -1,9 +1,9 @@ + add_executable(genversion preprocs/nasm/genversion.c) +-get_target_property(_tmp_GENVERSION_EXE genversion LOCATION) ++#get_target_property(_tmp_GENVERSION_EXE genversion LOCATION) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.mac +- COMMAND ${_tmp_GENVERSION_EXE} ${CMAKE_CURRENT_BINARY_DIR}/version.mac +- DEPENDS ${_tmp_GENVERSION_EXE} ++ COMMAND genversion ${CMAKE_CURRENT_BINARY_DIR}/version.mac ++ #DEPENDS ${_tmp_GENVERSION_EXE} + ) + + YASM_GENMACRO( diff --git a/recipes/yasm/all/test_package/conanfile.py b/recipes/yasm/all/test_package/conanfile.py index 605eba819f5940..df63a750624da6 100644 --- a/recipes/yasm/all/test_package/conanfile.py +++ b/recipes/yasm/all/test_package/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run -class TestPackage(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - self.run("yasm --help", run_environment=True) + if can_run(self): + self.run("yasm --help", env="conanrun") diff --git a/recipes/yasm/all/test_v1_package/conanfile.py b/recipes/yasm/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5992797490cc6f --- /dev/null +++ b/recipes/yasm/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +from conans import ConanFile +from conan.tools.build import cross_building + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not cross_building(self): + self.run("yasm --help", run_environment=True) From 4abc68a16a55f49d48671672baff0c9b84bfc2cb Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 18 Oct 2022 18:44:58 +0900 Subject: [PATCH 056/300] (#13496) aws-c-auth: change dependeant recipe version for aws-c-s3 * aws-c-auth: change dependeant recipe version for aws-c-s3 * fix condition * add TODO for cpp_info.filenames/names --- recipes/aws-c-auth/all/conanfile.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/recipes/aws-c-auth/all/conanfile.py b/recipes/aws-c-auth/all/conanfile.py index 500a62df5407ad..98d3c8c463737d 100644 --- a/recipes/aws-c-auth/all/conanfile.py +++ b/recipes/aws-c-auth/all/conanfile.py @@ -49,8 +49,12 @@ def layout(self): def requirements(self): self.requires("aws-c-common/0.8.2") self.requires("aws-c-cal/0.5.13") - self.requires("aws-c-io/0.13.4") - self.requires("aws-c-http/0.6.22") + if Version(self.version) < "0.6.17": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") if Version(self.version) >= "0.6.5": self.requires("aws-c-sdkutils/0.1.3") @@ -80,10 +84,6 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-auth") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-auth") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-auth" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-auth" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["aws-c-auth-lib"].names["cmake_find_package"] = "aws-c-auth" self.cpp_info.components["aws-c-auth-lib"].names["cmake_find_package_multi"] = "aws-c-auth" self.cpp_info.components["aws-c-auth-lib"].set_property("cmake_target_name", "AWS::aws-c-auth") @@ -93,7 +93,13 @@ def package_info(self): "aws-c-common::aws-c-common-lib", "aws-c-cal::aws-c-cal-lib", "aws-c-io::aws-c-io-lib", - "aws-c-http::aws-c-http-lib" + "aws-c-http::aws-c-http-lib", ] if Version(self.version) >= "0.6.5": self.cpp_info.components["aws-c-auth-lib"].requires.append("aws-c-sdkutils::aws-c-sdkutils-lib") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "aws-c-auth" + self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-auth" + self.cpp_info.names["cmake_find_package"] = "AWS" + self.cpp_info.names["cmake_find_package_multi"] = "AWS" From 2fb7710fca26d0c6a92c7a9bb2d1ad482c983003 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 18 Oct 2022 03:24:34 -0700 Subject: [PATCH 057/300] (#13557) freetype: v2 touchups + use `cmake_layout` and cache variable for cmake policy --- recipes/freetype/all/conanfile.py | 36 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/recipes/freetype/all/conanfile.py b/recipes/freetype/all/conanfile.py index a9262f44540d70..4138e31ca1536a 100644 --- a/recipes/freetype/all/conanfile.py +++ b/recipes/freetype/all/conanfile.py @@ -1,16 +1,6 @@ from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps -from conan.tools.files import ( - collect_libs, - copy, - load, - get, - rename, - replace_in_file, - rmdir, - save -) -from conan.tools.layout import basic_layout +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import collect_libs, copy, load, get, rename, replace_in_file, rmdir, save from conan.tools.scm import Version import os import re @@ -59,9 +49,18 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def requirements(self): if self.options.with_png: @@ -74,7 +73,7 @@ def requirements(self): self.requires("brotli/1.0.9") def layout(self): - basic_layout(self, src_folder="src") + cmake_layout(self, src_folder="src") def generate(self): deps = CMakeDeps(self) @@ -103,8 +102,7 @@ def generate(self): if self._has_with_brotli_option: cmake.variables["FT_WITH_BROTLI"] = self.options.with_brotli # Generate a relocatable shared lib on Macos - cmake.variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - + cmake.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" cmake.generate() def source(self): @@ -140,7 +138,7 @@ def _patch_sources(self): config_h = os.path.join(self.source_folder, "include", "freetype", "config", "ftoption.h") if self.options.subpixel: - replace_in_file(self,config_h, "/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */", "#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING") + replace_in_file(self, config_h, "/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */", "#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING") def build(self): self._patch_sources() From 5336e4848ecad44a27778adfebb7c99622bcbd20 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 12:44:26 +0200 Subject: [PATCH 058/300] (#13558) meshoptimizer: conan v2 support --- recipes/meshoptimizer/all/CMakeLists.txt | 8 -- recipes/meshoptimizer/all/conandata.yml | 1 - recipes/meshoptimizer/all/conanfile.py | 85 +++++++++---------- .../all/test_package/CMakeLists.txt | 7 +- .../all/test_package/conanfile.py | 20 +++-- .../all/test_v1_package/CMakeLists.txt | 10 +++ .../all/test_v1_package/conanfile.py | 17 ++++ 7 files changed, 86 insertions(+), 62 deletions(-) delete mode 100644 recipes/meshoptimizer/all/CMakeLists.txt create mode 100644 recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/meshoptimizer/all/test_v1_package/conanfile.py diff --git a/recipes/meshoptimizer/all/CMakeLists.txt b/recipes/meshoptimizer/all/CMakeLists.txt deleted file mode 100644 index a60992e8dd75dc..00000000000000 --- a/recipes/meshoptimizer/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") - -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/meshoptimizer/all/conandata.yml b/recipes/meshoptimizer/all/conandata.yml index 3780c1e85f5f8a..1132907df38417 100644 --- a/recipes/meshoptimizer/all/conandata.yml +++ b/recipes/meshoptimizer/all/conandata.yml @@ -14,4 +14,3 @@ sources: patches: "0.14": - patch_file: "patches/0.14/0001-fix-build-on-old-AppleClang-versions.patch" - base_path: "source_subfolder" diff --git a/recipes/meshoptimizer/all/conanfile.py b/recipes/meshoptimizer/all/conanfile.py index f20253e331a799..174a3955a5f632 100644 --- a/recipes/meshoptimizer/all/conanfile.py +++ b/recipes/meshoptimizer/all/conanfile.py @@ -1,20 +1,20 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conans import tools as tools_legacy import os -import glob -from conans import ConanFile, CMake, tools - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class MeshOptimizerConan(ConanFile): name = "meshoptimizer" - description = " Mesh optimization library that makes meshes smaller and faster to render" - topics = ("conan", "mesh", "optimizer", "3d") + description = "Mesh optimization library that makes meshes smaller and faster to render" + topics = ("mesh", "optimizer", "3d") homepage = "https://github.com/zeux/meshoptimizer" url = "https://github.com/conan-io/conan-center-index" license = "MIT" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,60 +25,59 @@ class MeshOptimizerConan(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): - if self.settings.os == 'Windows': + if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - self._cmake = CMake(self) - self._cmake.definitions["MESHOPT_BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MESHOPT_BUILD_SHARED_LIBS"] = self.options.shared + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Don't override warning levels for msvc - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "add_compile_options(/W4 /WX)", "") + apply_conandata_patches(self) + # No warnings as errors + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "add_compile_options(/W4 /WX)", "") + replace_in_file(self, cmakelists, "-Werror", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - for f in glob.glob(os.path.join(self.package_folder, "bin", "*.pdb")): - os.remove(f) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - if not self.options.shared and tools.stdcpp_library(self): - self.cpp_info.system_libs.append(tools.stdcpp_library(self)) + self.cpp_info.set_property("cmake_file_name", "meshoptimizer") + self.cpp_info.set_property("cmake_target_name", "meshoptimizer::meshoptimizer") + self.cpp_info.libs = ["meshoptimizer"] + if not self.options.shared: + libcxx = tools_legacy.stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) if self.options.shared and self.settings.os == "Windows": self.cpp_info.defines = ["MESHOPTIMIZER_API=__declspec(dllimport)"] diff --git a/recipes/meshoptimizer/all/test_package/CMakeLists.txt b/recipes/meshoptimizer/all/test_package/CMakeLists.txt index 541e7b29f6c39f..034ae19a0ca089 100644 --- a/recipes/meshoptimizer/all/test_package/CMakeLists.txt +++ b/recipes/meshoptimizer/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(meshoptimizer REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} meshoptimizer::meshoptimizer) +target_link_libraries(${PROJECT_NAME} PRIVATE meshoptimizer::meshoptimizer) diff --git a/recipes/meshoptimizer/all/test_package/conanfile.py b/recipes/meshoptimizer/all/test_package/conanfile.py index f8eeed898d7bd1..0a6bc68712d901 100644 --- a/recipes/meshoptimizer/all/test_package/conanfile.py +++ b/recipes/meshoptimizer/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt b/recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..b49461acc50ec9 --- /dev/null +++ b/recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(meshoptimizer REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE meshoptimizer::meshoptimizer) diff --git a/recipes/meshoptimizer/all/test_v1_package/conanfile.py b/recipes/meshoptimizer/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/meshoptimizer/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 50945a39a46c8efa1b202de8ac1d98f55b89304e Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 18 Oct 2022 04:04:04 -0700 Subject: [PATCH 059/300] (#13559) conan v2: ignore the files in `test_output/` https://github.com/conan-io/conan/issues/10754 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 13fc7ab5fabfa4..4ecc58bbd7d32c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Conan specific test_package/build/ +test_package/test_output/ conan.lock conanbuildinfo.txt conaninfo.txt From 583751d39652c88f7cdc6874f3dbbafa961633e8 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 18 Oct 2022 07:05:36 -0700 Subject: [PATCH 060/300] (#13556) fmt: touchup how layout is being used * fmt: touchup how layout is being used * chore: hooks * chore: dont duplicate sources * Delete test_package.cpp * Delete test_ranges.cpp --- recipes/fmt/all/conanfile.py | 13 ++-- .../fmt/all/test_v1_package/CMakeLists.txt | 4 +- recipes/fmt/all/test_v1_package/conanfile.py | 1 - .../fmt/all/test_v1_package/test_package.cpp | 62 ------------------- .../fmt/all/test_v1_package/test_ranges.cpp | 11 ---- 5 files changed, 10 insertions(+), 81 deletions(-) delete mode 100644 recipes/fmt/all/test_v1_package/test_package.cpp delete mode 100644 recipes/fmt/all/test_v1_package/test_ranges.cpp diff --git a/recipes/fmt/all/conanfile.py b/recipes/fmt/all/conanfile.py index 80b5bdb3507256..af95895649da5c 100644 --- a/recipes/fmt/all/conanfile.py +++ b/recipes/fmt/all/conanfile.py @@ -3,9 +3,10 @@ from conan import ConanFile from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import get, apply_conandata_patches, copy, rmdir +from conan.tools.files import get, apply_conandata_patches, copy, rmdir, export_conandata_patches +from conan.tools.layout import basic_layout -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class FmtConan(ConanFile): @@ -36,8 +37,7 @@ def _has_with_os_api_option(self): return Version(str(self.version)) >= "7.0.0" def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, patch["patch_file"], src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def generate(self): if not self.options.header_only: @@ -51,7 +51,10 @@ def generate(self): tc.generate() def layout(self): - cmake_layout(self, src_folder="src") + if self.options.header_only: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") def config_options(self): if self.settings.os == "Windows": diff --git a/recipes/fmt/all/test_v1_package/CMakeLists.txt b/recipes/fmt/all/test_v1_package/CMakeLists.txt index e4a5b854419355..cd856e0aa456ab 100644 --- a/recipes/fmt/all/test_v1_package/CMakeLists.txt +++ b/recipes/fmt/all/test_v1_package/CMakeLists.txt @@ -7,7 +7,7 @@ conan_basic_setup(TARGETS) find_package(fmt REQUIRED CONFIG) # TEST_PACKAGE ################################################################# -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) +add_executable(${CMAKE_PROJECT_NAME} ../test_package/test_package.cpp) set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) if(FMT_HEADER_ONLY) target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt-header-only) @@ -16,7 +16,7 @@ else() endif() # TEST_RANGES ################################################################## -add_executable(test_ranges test_ranges.cpp) +add_executable(test_ranges ../test_package/test_ranges.cpp) set_property(TARGET test_ranges PROPERTY CXX_STANDARD 14) if(FMT_HEADER_ONLY) target_link_libraries(test_ranges fmt::fmt-header-only) diff --git a/recipes/fmt/all/test_v1_package/conanfile.py b/recipes/fmt/all/test_v1_package/conanfile.py index 65778c702047d5..f99cfc80791d26 100644 --- a/recipes/fmt/all/test_v1_package/conanfile.py +++ b/recipes/fmt/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/fmt/all/test_v1_package/test_package.cpp b/recipes/fmt/all/test_v1_package/test_package.cpp deleted file mode 100644 index bcd009407212dc..00000000000000 --- a/recipes/fmt/all/test_v1_package/test_package.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include - - -void vreport(const char *format, fmt::format_args args) { - fmt::vprint(format, args); -} - -template -void report(const char *format, const Args & ... args) { - vreport(format, fmt::make_format_args(args...)); -} - -class Date { - int year_, month_, day_; - public: - Date(int year, int month, int day) : year_(year), month_(month), day_(day) {} - - friend std::ostream &operator<<(std::ostream &os, const Date &d) { - return os << d.year_ << '-' << d.month_ << '-' << d.day_; - } -}; - -#if FMT_VERSION >= 90000 -namespace fmt { - template <> struct formatter : ostream_formatter {}; -} -#endif - -int main() { - const std::string thing("World"); - fmt::print("PRINT: Hello {}!\n", thing); - fmt::printf("PRINTF: Hello, %s!\n", thing); - - const std::string formatted = fmt::format("{0}{1}{0}", "abra", "cad"); - fmt::print("{}\n", formatted); - - fmt::memory_buffer buf; - fmt::format_to(std::begin(buf), "{}", 2.7182818); - fmt::print("Euler number: {}\n", fmt::to_string(buf)); - - const std::string date = fmt::format("The date is {}\n", Date(2012, 12, 9)); - fmt::print(date); - - report("{} {} {}\n", "Conan", 42, 3.14159); - - fmt::print(std::cout, "{} {}\n", "Magic number", 42); - - fmt::print(fg(fmt::color::aqua), "Bincrafters\n"); - - return EXIT_SUCCESS; -} diff --git a/recipes/fmt/all/test_v1_package/test_ranges.cpp b/recipes/fmt/all/test_v1_package/test_ranges.cpp deleted file mode 100644 index b808d6987b07e9..00000000000000 --- a/recipes/fmt/all/test_v1_package/test_ranges.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include "fmt/ranges.h" - -int main() { - std::vector numbers; - fmt::format_to(std::back_inserter(numbers), "{}{}{}", 1, 2, 3); - const std::string str_numbers = fmt::format("{}", numbers); - fmt::print("numbers: {}\n", str_numbers); - return EXIT_SUCCESS; -} From 20fd80631fdf5eb0f9de90357c15dacbcc667727 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 18 Oct 2022 07:44:17 -0700 Subject: [PATCH 061/300] (#13429) strawberryperl: conan v2 * strawberryperl: conan v2 * fix package id for v2 * working v2 but 1.x failing * with from, it now works on both versions * cleanup + test v1 * fix bad python * Update conanfile.py * Update conanfile.py * Update conanfile.py * conditional checks so v2 passes --- recipes/strawberryperl/all/conandata.yml | 12 ++-- recipes/strawberryperl/all/conanfile.py | 59 ++++++++++++------- .../all/test_package/conanfile.py | 20 +++++-- .../all/test_v1_package/conanfile.py | 12 ++++ 4 files changed, 69 insertions(+), 34 deletions(-) create mode 100644 recipes/strawberryperl/all/test_v1_package/conanfile.py diff --git a/recipes/strawberryperl/all/conandata.yml b/recipes/strawberryperl/all/conandata.yml index 9652ba8327657e..5d11e843fb9926 100644 --- a/recipes/strawberryperl/all/conandata.yml +++ b/recipes/strawberryperl/all/conandata.yml @@ -1,22 +1,22 @@ sources: "5.32.1.1": x86: - url: "http://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-32bit-portable.zip" + url: "https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-32bit-portable.zip" sha256: "d9c5711d12573a0f6d977792caa58364b1d46217521ae5c25cf5cc378a7c23c0" x86_64: - url: "http://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-64bit-portable.zip" + url: "https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-64bit-portable.zip" sha256: "692646105b0f5e058198a852dc52a48f1cebcaf676d63bbdeae12f4eaee9bf5c" "5.30.0.1": x86: - url: "http://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-32bit-portable.zip" + url: "https://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-32bit-portable.zip" sha256: "a1d77821c77b7a3298cf3fe381e57cba43f89b9859204398f36d85f33b287837" x86_64: - url: "http://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-64bit-portable.zip" + url: "https://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-64bit-portable.zip" sha256: "9367a64ac1451b21804a224bb6235fe6848dd42f5fa1871583821ac3dfabf013" "5.28.1.1": x86: - url: "http://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-32bit-portable.zip" + url: "https://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-32bit-portable.zip" sha256: "8b15c7c9574989568254a7859e473b7d5f68a1145d2e4418036600a81b13805c" x86_64: - url: "http://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-64bit-portable.zip" + url: "https://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-64bit-portable.zip" sha256: "935c95ba096fa11c4e1b5188732e3832d330a2a79e9882ab7ba8460ddbca810d" diff --git a/recipes/strawberryperl/all/conanfile.py b/recipes/strawberryperl/all/conanfile.py index 5fd7a34327cc3d..b665fe8420bef3 100644 --- a/recipes/strawberryperl/all/conanfile.py +++ b/recipes/strawberryperl/all/conanfile.py @@ -1,39 +1,54 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conans import __version__ as conan_version -class StrawberryperlConan(ConanFile): +required_conan_version = ">=1.47.0" + + +class StrawberryPerlConan(ConanFile): name = "strawberryperl" - description = "Strawbery Perl for Windows. Useful as build_require" - license = "GNU Public License or the Artistic License" + description = "Strawberry Perl for Windows. Useful as build_require" + license = ("Artistic-1.0", "GPL-1.0") homepage = "http://strawberryperl.com" url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "installer", "perl", "windows") - settings = "os", "arch" - short_paths = True + topics = ("installer", "perl", "windows") + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + self.folders.build = "build" + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type - def configure(self): - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("Only windows supported for Strawberry Perl.") + def validate(self): + if self.info.settings.os != "Windows": + raise ConanInvalidConfiguration("Strawberry Perl is only intended to be used on Windows.") def build(self): - arch = str(self.settings.arch) - tools.get(**self.conan_data["sources"][self.version][arch]) + get(self, **self.conan_data["sources"][self.version][str(self.settings.arch)], destination=self.build_folder) def package(self): - self.copy(pattern="License.rtf*", dst="licenses", src="licenses") - self.copy(pattern="*", src=os.path.join("perl", "bin"), dst="bin") - self.copy(pattern="*", src=os.path.join("perl", "lib"), dst="lib") - self.copy(pattern="*", src=os.path.join("perl", "vendor", "lib"), dst="lib") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, pattern="License.rtf*", src=os.path.join(self.build_folder, "licenses"), dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*", src=os.path.join(self.build_folder, "perl", "bin"), dst=os.path.join(self.package_folder, "bin")) + copy(self, pattern="*", src=os.path.join(self.build_folder, "perl", "lib"), dst=os.path.join(self.package_folder, "lib")) + copy(self, pattern="*", src=os.path.join(self.build_folder, "perl", "vendor", "lib"), dst=os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: %s" % bin_path) - self.env_info.PATH.append(bin_path) + # TODO remove once conan v2 is the only support and recipes have been migrated + if Version(conan_version) < "2.0.0-beta": + bin_path = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_path) - self.user_info.perl = os.path.join(self.package_folder, "bin", "perl.exe").replace("\\", "/") + perl_path = os.path.join(self.package_folder, "bin", "perl.exe").replace("\\", "/") + self.conf_info.define("user.strawberryperl:perl", perl_path) + if Version(conan_version) < "2.0.0-beta": + self.user_info.perl = perl_path diff --git a/recipes/strawberryperl/all/test_package/conanfile.py b/recipes/strawberryperl/all/test_package/conanfile.py index 397a3d181e1210..85800c3ed5d5ad 100644 --- a/recipes/strawberryperl/all/test_package/conanfile.py +++ b/recipes/strawberryperl/all/test_package/conanfile.py @@ -1,12 +1,20 @@ import os -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version -class DefaultNameConan(ConanFile): - settings = "os", "arch" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - self.run("perl --version", run_environment=True) + if can_run(self): + self.run("perl --version") perl_script = os.path.join(self.source_folder, "list_files.pl") - self.run("perl {}".format(perl_script), run_environment=True) + self.run(f"perl {perl_script}", env="conanbuild") diff --git a/recipes/strawberryperl/all/test_v1_package/conanfile.py b/recipes/strawberryperl/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..641d8fdb8a176c --- /dev/null +++ b/recipes/strawberryperl/all/test_v1_package/conanfile.py @@ -0,0 +1,12 @@ +import os +from conans import ConanFile, tools + + +class DefaultNameConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + self.run("perl --version", run_environment=True) + perl_script = os.path.join(self.source_folder, os.pardir, "test_package", "list_files.pl") + self.run(f"perl {perl_script}", run_environment=True) From 07419ebb9852664bf32a6ad4ccc366645745bf56 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 17:05:03 +0200 Subject: [PATCH 062/300] (#13565) libudev: allow cross compilation * libudev: allow cross compilation * use new system helper * fixup * Update conanfile.py --- recipes/libudev/all/conanfile.py | 40 +++++++++++++++++--------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/recipes/libudev/all/conanfile.py b/recipes/libudev/all/conanfile.py index 2a3cdc0f95b033..bb1bde611d37b1 100644 --- a/recipes/libudev/all/conanfile.py +++ b/recipes/libudev/all/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.system import package_manager +from conans import tools + +required_conan_version = ">=1.47" class LibUDEVConan(ConanFile): @@ -10,7 +14,7 @@ class LibUDEVConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freedesktop.org/software/systemd/man/udev.html" license = "GPL-2.0-or-later", "LGPL-2.1-or-later" - settings = "os" + settings = "os", "arch", "compiler", "build_type" def validate(self): if self.settings.os != "Linux": @@ -40,22 +44,20 @@ def _fill_cppinfo_from_pkgconfig(self, name): self.cpp_info.cxxflags = cflags def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - packages = ["systemd-devel"] - elif tools.os_info.with_apt: - packages = ["libudev-dev"] - elif tools.os_info.with_pacman: - packages = ["systemd-libs"] - elif tools.os_info.with_zypper: - packages = ["libudev-devel"] - else: - self.output.warn("Don't know how to install %s for your distro." % self.name) - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install(["systemd-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["systemd-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libudev-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["systemd-libs"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["libudev-devel"], update=True, check=True) def package_info(self): self.cpp_info.includedirs = [] From f6be60d4b0b8cde2143b5d2c75ac51d261ed9fa6 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 17:24:24 +0200 Subject: [PATCH 063/300] (#13566) vdpau: allow cross compilation * vdpau: allow cross compilation * use new system helper * fixup * Update conanfile.py * Update conanfile.py --- recipes/vdpau/all/conanfile.py | 49 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/recipes/vdpau/all/conanfile.py b/recipes/vdpau/all/conanfile.py index c13780fe4e4827..037314ecd8e206 100644 --- a/recipes/vdpau/all/conanfile.py +++ b/recipes/vdpau/all/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.system import package_manager +from conans import tools + +required_conan_version = ">=1.47" class SysConfigVDPAUConan(ConanFile): @@ -10,7 +14,11 @@ class SysConfigVDPAUConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freedesktop.org/wiki/Software/VDPAU/" license = "MIT" - settings = {"os": ["Linux", "FreeBSD"]} + settings = "os", "arch", "compiler", "build_type" + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): self.info.header_only() @@ -36,24 +44,23 @@ def _fill_cppinfo_from_pkgconfig(self, name): self.cpp_info.cxxflags.extend(cflags) def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - packages = ["libvdpau-devel"] - elif tools.os_info.with_apt: - packages = ["libvdpau-dev"] - elif tools.os_info.with_pacman: - packages = ["libvdpau"] - elif tools.os_info.with_zypper: - packages = ["libvdpau-devel"] - else: - self.output.warn("Don't know how to install %s for your distro." % self.name) - elif tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libvdpau"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install(["libvdpau-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["libvdpau-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libvdpau-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libvdpau"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["libvdpau-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libvdpau"], update=True, check=True) def package_info(self): self.cpp_info.includedirs = [] From b6f44a4e8ebea8ce11697c5bac500a5802f85ab9 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 17:45:14 +0200 Subject: [PATCH 064/300] (#13567) vaapi: allow cross compilation * vaapi: allow cross compilation * use new system helper * fixup * fixup * Update conanfile.py * Update conanfile.py --- recipes/vaapi/all/conanfile.py | 49 +++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/recipes/vaapi/all/conanfile.py b/recipes/vaapi/all/conanfile.py index 588e9fe71b361c..756d5ef4595bef 100644 --- a/recipes/vaapi/all/conanfile.py +++ b/recipes/vaapi/all/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.system import package_manager +from conans import tools + +required_conan_version = ">=1.47" class SysConfigVAAPIConan(ConanFile): @@ -10,7 +14,11 @@ class SysConfigVAAPIConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://01.org/linuxmedia/vaapi" license = "MIT" - settings = {"os": ["Linux", "FreeBSD"]} + settings = "os", "arch", "compiler", "build_type" + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): self.info.header_only() @@ -36,24 +44,23 @@ def _fill_cppinfo_from_pkgconfig(self, name): self.cpp_info.cxxflags.extend(cflags) def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - packages = ["libva-devel"] - elif tools.os_info.with_apt: - packages = ["libva-dev"] - elif tools.os_info.with_pacman: - packages = ["libva"] - elif tools.os_info.with_zypper: - packages = ["libva-devel"] - else: - self.output.warn("Don't know how to install %s for your distro." % self.name) - elif tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libva"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install(["libva-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["libva-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libva-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libva"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["libva-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libva"], update=True, check=True) def package_info(self): self.cpp_info.includedirs = [] From a3b64518ff42bb7bbbf38bde54ac74bf8a84d861 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 18:04:20 +0200 Subject: [PATCH 065/300] (#13568) gtk/system: allow cross compilation * gtk/system: allow cross compilation * use new system helper * fixup * Update conanfile.py * Update conanfile.py * Update conanfile.py --- recipes/gtk/system/conanfile.py | 55 +++++++++++++++++---------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/recipes/gtk/system/conanfile.py b/recipes/gtk/system/conanfile.py index ef496e60614ddb..eaa08c92e96a67 100644 --- a/recipes/gtk/system/conanfile.py +++ b/recipes/gtk/system/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.system import package_manager +from conans import tools + +required_conan_version = ">=1.47" class ConanGTK(ConanFile): @@ -8,22 +12,22 @@ class ConanGTK(ConanFile): license = "LGPL-2.1-or-later" homepage = "https://www.gtk.org" description = "A free and open-source cross-platform widget toolkit for creating graphical user interfaces" - settings = "os" + settings = "os", "arch", "compiler", "build_type" options = {"version": [2, 3]} default_options = {"version": 2} topics = ("gui", "widget", "graphical") - def configure(self): + def validate(self): if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") - + def package_id(self): self.info.settings.clear() def _fill_cppinfo_from_pkgconfig(self, name): pkg_config = tools.PkgConfig(name) if not pkg_config.provides: - raise ConanException("GTK-{} development files aren't available, give up.".format(self.options.version)) + raise ConanException(f"GTK-{self.options.version} development files aren't available, give up.") libs = [lib[2:] for lib in pkg_config.libs_only_l] lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L] ldflags = [flag for flag in pkg_config.libs_only_other] @@ -41,27 +45,24 @@ def _fill_cppinfo_from_pkgconfig(self, name): self.cpp_info.components[name].cxxflags = cflags def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_apt: - packages = ["libgtk2.0-dev"] if self.options.version == 2 else ["libgtk-3-dev"] - elif tools.os_info.with_yum or tools.os_info.with_dnf: - packages = ["gtk{}-devel".format(self.options.version)] - elif tools.os_info.with_pacman: - packages = ["gtk{}".format(self.options.version)] - elif tools.os_info.with_zypper: - packages = ["gtk{}-devel".format(self.options.version)] - else: - self.output.warn("Do not know how to install 'GTK-{}' for {}." - .format(self.options.version, - tools.os_info.linux_distro)) - if tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["gtk{}".format(self.options.version)] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode="verify") - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install([f"gtk{self.options.version}-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install([f"gtk{self.options.version}-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libgtk2.0-dev"] if self.options.version == 2 else ["libgtk-3-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install([f"gtk{self.options.version}"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install([f"gtk{self.options.version}-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install([f"gtk{self.options.version}"], update=True, check=True) def package_info(self): - for name in ["gtk+-{}.0".format(self.options.version)]: + for name in [f"gtk+-{self.options.version}.0"]: self._fill_cppinfo_from_pkgconfig(name) From 356dc0404ec491c083705d8f9e8bec160732aa0a Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 18:24:38 +0200 Subject: [PATCH 066/300] (#13569) glu: allow cross compilation * glu: allow cross compilation * fixup * use new system helper * fixup * fixup * Update conanfile.py --- recipes/glu/all/conanfile.py | 40 +++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/recipes/glu/all/conanfile.py b/recipes/glu/all/conanfile.py index e7bf0072386fe2..42fc9acb237e88 100644 --- a/recipes/glu/all/conanfile.py +++ b/recipes/glu/all/conanfile.py @@ -1,7 +1,10 @@ from conan import ConanFile from conan.errors import ConanException +from conan.tools.system import package_manager from conans import tools +required_conan_version = ">=1.47" + class SysConfigGLUConan(ConanFile): name = "glu" @@ -11,28 +14,27 @@ class SysConfigGLUConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://cgit.freedesktop.org/mesa/glu/" license = "SGI-B-2.0" - settings = "os" + settings = "os", "arch", "compiler", "build_type" requires = "opengl/system" def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum or tools.os_info.with_dnf: - packages = ["mesa-libGLU-devel"] - elif tools.os_info.with_apt: - packages = ["libglu1-mesa-dev"] - elif tools.os_info.with_pacman: - packages = ["glu"] - elif tools.os_info.with_zypper: - packages = ["glu-devel"] - else: - self.output.warn("Don't know how to install GLU for your distro") - if tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libGLU"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install(["mesa-libGLU-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["mesa-libGLU-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libglu1-mesa-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["glu"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["glu-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libGLU"], update=True, check=True) def _fill_cppinfo_from_pkgconfig(self, name): pkg_config = tools.PkgConfig(name) From ad92cda1aba7dbd2e51017b200f78e586529d6b4 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Tue, 18 Oct 2022 18:44:32 +0200 Subject: [PATCH 067/300] (#13571) egl: use new system helper * egl: use new system helper * fixup * Update conanfile.py * Update conanfile.py --- recipes/egl/system/conanfile.py | 52 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/recipes/egl/system/conanfile.py b/recipes/egl/system/conanfile.py index 956446154ca51f..2139b499f3f52b 100644 --- a/recipes/egl/system/conanfile.py +++ b/recipes/egl/system/conanfile.py @@ -1,7 +1,10 @@ from conan import ConanFile from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.system import package_manager from conans import tools +required_conan_version = ">=1.47" + class SysConfigEGLConan(ConanFile): name = "egl" @@ -16,7 +19,7 @@ class SysConfigEGLConan(ConanFile): def configure(self): if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("This recipes supports only Linux and FreeBSD") - + def package_id(self): self.info.header_only() @@ -41,30 +44,29 @@ def _fill_cppinfo_from_pkgconfig(self, name): self.cpp_info.cxxflags.extend(cflags) def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - packages = ["mesa-libEGL-devel"] - elif tools.os_info.with_apt: - ubuntu_20_or_later = tools.os_info.linux_distro == "ubuntu" and tools.os_info.os_version >= "20" - debian_11_or_later = tools.os_info.linux_distro == "debian" and tools.os_info.os_version >= "11" - pop_os_20_or_later = tools.os_info.linux_distro == "pop" and tools.os_info.os_version >= "20" - if ubuntu_20_or_later or debian_11_or_later or pop_os_20_or_later: - packages = ["libegl-dev"] - else: - packages = ["libegl1-mesa-dev"] - elif tools.os_info.with_pacman: - packages = ["libglvnd"] - elif tools.os_info.with_zypper: - packages = ["Mesa-libEGL-devel"] - else: - self.output.warn("Don't know how to install EGL for your distro.") - if tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libglvnd"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install(["mesa-libEGL-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["mesa-libEGL-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + ubuntu_20_or_later = tools.os_info.linux_distro == "ubuntu" and tools.os_info.os_version >= "20" + debian_11_or_later = tools.os_info.linux_distro == "debian" and tools.os_info.os_version >= "11" + pop_os_20_or_later = tools.os_info.linux_distro == "pop" and tools.os_info.os_version >= "20" + if ubuntu_20_or_later or debian_11_or_later or pop_os_20_or_later: + apt.install(["libegl-dev"], update=True, check=True) + else: + apt.install(["libegl1-mesa-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libglvnd"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["Mesa-libEGL-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libglvnd"], update=True, check=True) def package_info(self): # TODO: Workaround for #2311 until a better solution can be found From 7eafaf98dfd0a53f697d9934278f152ea2136dc2 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 19:04:17 +0200 Subject: [PATCH 068/300] (#13573) yasm: fix MinGW --- recipes/yasm/all/conanfile.py | 36 +++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/recipes/yasm/all/conanfile.py b/recipes/yasm/all/conanfile.py index 6ae77d25266179..05721cdf31f907 100644 --- a/recipes/yasm/all/conanfile.py +++ b/recipes/yasm/all/conanfile.py @@ -1,15 +1,15 @@ from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain -from conan.tools.layout import basic_layout, cmake_layout -from conan.tools.microsoft import is_msvc - +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os - required_conan_version = ">=1.52.0" + class YASMConan(ConanFile): name = "yasm" url = "https://github.com/conan-io/conan-center-index" @@ -27,23 +27,38 @@ def export_sources(self): export_conandata_patches(self) def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def layout(self): if is_msvc(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") else: - basic_layout(self) + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler + def build_requirements(self): + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") + def source(self): get(self, **self.conan_data["sources"][self.version][0], destination=self.source_folder, strip_root=True) def _generate_autotools(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) enable_debug = "yes" if self.settings.build_type == "Debug" else "no" tc.configure_args.extend([ @@ -85,7 +100,8 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib")) else: autotools = Autotools(self) - autotools.install() + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): From 23b694192b14c34292bf7691b0e48b19721ec09c Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 19:24:08 +0200 Subject: [PATCH 069/300] (#13576) libevent: build either shared or static --- recipes/libevent/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libevent/all/conanfile.py b/recipes/libevent/all/conanfile.py index a06ee298377acf..0a8f1ba78b504c 100644 --- a/recipes/libevent/all/conanfile.py +++ b/recipes/libevent/all/conanfile.py @@ -66,7 +66,7 @@ def generate(self): tc = CMakeToolchain(self) if self.options.with_openssl: tc.variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder.replace("\\", "/") - tc.variables["EVENT__LIBRARY_TYPE"] = "SHARED" if self.options.shared else "STATIC" + tc.cache_variables["EVENT__LIBRARY_TYPE"] = "SHARED" if self.options.shared else "STATIC" tc.variables["EVENT__DISABLE_DEBUG_MODE"] = self.settings.build_type == "Release" tc.variables["EVENT__DISABLE_OPENSSL"] = not self.options.with_openssl tc.variables["EVENT__DISABLE_THREAD_SUPPORT"] = self.options.disable_threads From 2ad024ba0e7b4341e45949fc6c15412c9cc37c6a Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 18 Oct 2022 19:44:59 +0200 Subject: [PATCH 070/300] (#13580) [actions] Revert tj-actions/changed-file to version v20 * Add fetch-depth for all files Signed-off-by: Uilian Ries * Fix indentation Signed-off-by: Uilian Ries * Fix indentation Signed-off-by: Uilian Ries * Revert tj-actions/changed-file Signed-off-by: Uilian Ries * Use depth 0 Signed-off-by: Uilian Ries * Revert not needed changes Signed-off-by: Uilian Ries * revert to depth 2 Signed-off-by: Uilian Ries Signed-off-by: Uilian Ries --- .github/workflows/linter-conan-v2.yml | 6 +++--- .github/workflows/linter-yaml.yml | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linter-conan-v2.yml b/.github/workflows/linter-conan-v2.yml index 618e82492e8650..7a002314625378 100644 --- a/.github/workflows/linter-conan-v2.yml +++ b/.github/workflows/linter-conan-v2.yml @@ -18,7 +18,7 @@ jobs: with: fetch-depth: 2 - name: Get changed files - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 id: changed_files with: files: | @@ -87,7 +87,7 @@ jobs: fetch-depth: 2 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 with: files: | recipes/*/*/conanfile.py @@ -122,7 +122,7 @@ jobs: fetch-depth: 2 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 with: files: | recipes/*/*/test_*/conanfile.py diff --git a/.github/workflows/linter-yaml.yml b/.github/workflows/linter-yaml.yml index be716fffc216a4..59e73e83b163c0 100644 --- a/.github/workflows/linter-yaml.yml +++ b/.github/workflows/linter-yaml.yml @@ -20,7 +20,7 @@ jobs: fetch-depth: 2 - name: Get changed files - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 id: changed_files with: files: | @@ -30,7 +30,7 @@ jobs: if: steps.changed_files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} - + - name: Install dependencies if: steps.changed_files.outputs.any_changed == 'true' run: pip install yamllint @@ -56,7 +56,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ env.PYVER }} - + - name: Install dependencies run: pip install yamllint @@ -64,11 +64,11 @@ jobs: - name: Get changed files (config) id: changed_files_config if: always() - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 with: files: | ${{ env.CONFIG_FILES_PATH }} - + - name: Run linter (config.yml) if: steps.changed_files_config.outputs.any_changed == 'true' && always() run: | @@ -80,11 +80,11 @@ jobs: - name: Get changed files (conandata) id: changed_files_conandata if: always() - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 with: files: | ${{ env.CONANDATA_FILES_PATH }} - + - name: Run linter (conandata.yml) if: steps.changed_files_conandata.outputs.any_changed == 'true' && always() run: | From c4f45d4ddb33e1ec1fed39359f0c53cc90731280 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 18 Oct 2022 20:24:02 +0200 Subject: [PATCH 071/300] (#13579) Revert "Create dependabot.yml" This reverts commit d78fefe0e2116e4d45deff9a02e59d300ebf622d. --- .github/dependabot.yml | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 90e05c40d04594..00000000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 -updates: - - package-ecosystem: "github-actions" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "weekly" From fcb0b18fa3b2490b256bebb30c9ab65cafe63cb5 Mon Sep 17 00:00:00 2001 From: System-Arch <33330183+System-Arch@users.noreply.github.com> Date: Tue, 18 Oct 2022 15:26:00 -0400 Subject: [PATCH 072/300] (#13357) Declare package_type and prevent Conan 2 errors with self.env_info * Declare package_type and prevent Conan 2 errors with self.env_info * Update recipes/ninja/all/conanfile.py Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Co-authored-by: System-Arch Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/ninja/all/conanfile.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/recipes/ninja/all/conanfile.py b/recipes/ninja/all/conanfile.py index bd89cd7fe4427d..881e7efbf37b88 100644 --- a/recipes/ninja/all/conanfile.py +++ b/recipes/ninja/all/conanfile.py @@ -1,13 +1,15 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get +from conan.tools.scm import Version import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class NinjaConan(ConanFile): name = "ninja" + package_type = "application" description = "Ninja is a small build system with a focus on speed" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" @@ -47,5 +49,6 @@ def package_info(self): self.conf_info.define("tools.cmake.cmaketoolchain:generator", "Ninja") # TODO: to remove in conan v2 - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) - self.env_info.CONAN_CMAKE_GENERATOR = "Ninja" + if Version(conan_version).major < 2: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.CONAN_CMAKE_GENERATOR = "Ninja" From 42393a606606dfa485d1084300000599fc7367a0 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 19 Oct 2022 04:44:43 +0900 Subject: [PATCH 073/300] (#13563) avcpp: add version 2.1.0 and suppport conan v2 * avcpp: add version 2.1.0 and suppport conan v2 * fix source path * link mvec, mfplat library * fix f-string miss Co-authored-by: Chris Mc * add patch description Co-authored-by: Chris Mc --- recipes/avcpp/all/CMakeLists.txt | 10 -- recipes/avcpp/all/conandata.yml | 12 +- recipes/avcpp/all/conanfile.py | 105 ++++++++++-------- .../avcpp/all/patches/2.1.0-fix-ffmpeg.patch | 46 ++++++++ ...ge.patch => cci.20220301-fix-ffmpeg.patch} | 0 recipes/avcpp/all/test_package/CMakeLists.txt | 11 +- recipes/avcpp/all/test_package/conanfile.py | 22 +++- .../avcpp/all/test_v1_package/CMakeLists.txt | 15 +++ .../avcpp/all/test_v1_package/conanfile.py | 16 +++ recipes/avcpp/config.yml | 2 + 10 files changed, 166 insertions(+), 73 deletions(-) delete mode 100644 recipes/avcpp/all/CMakeLists.txt create mode 100644 recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch rename recipes/avcpp/all/patches/{fix-ffmpeg-package.patch => cci.20220301-fix-ffmpeg.patch} (100%) create mode 100644 recipes/avcpp/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/avcpp/all/test_v1_package/conanfile.py diff --git a/recipes/avcpp/all/CMakeLists.txt b/recipes/avcpp/all/CMakeLists.txt deleted file mode 100644 index fcd2addceeac76..00000000000000 --- a/recipes/avcpp/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -set(AVCPP_NOT_SUBPROJECT ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/avcpp/all/conandata.yml b/recipes/avcpp/all/conandata.yml index af831432579cc3..1ba5e69f511c2a 100644 --- a/recipes/avcpp/all/conandata.yml +++ b/recipes/avcpp/all/conandata.yml @@ -1,9 +1,17 @@ sources: + "2.1.0": + url: "https://github.com/h4tr3d/avcpp/archive/refs/tags/v2.1.0.tar.gz" + sha256: "8398217dccb9f5b4cbb41e5bf4f73f47b461ed3ba8c3aefdda9f9dd714649855" "cci.20220301": url: "https://github.com/h4tr3d/avcpp/archive/fd4bc4662eb39853de8fcac4a663bebd0eea30b8.tar.gz" sha256: "e48eae2ec154bc69aed16159c8b18c9ffb4925ba672b022e94a3c9b96782a4bf" patches: + "2.1.0": + - patch_file: "patches/2.1.0-fix-ffmpeg.patch" + patch_description: "fix ffmpeg package name and remove ffmpeg from install targets" + patch_type: "conan" "cci.20220301": - - base_path: "source_subfolder" - patch_file: "patches/fix-ffmpeg-package.patch" + - patch_file: "patches/cci.20220301-fix-ffmpeg.patch" + patch_description: "fix ffmpeg package name and remove ffmpeg from install targets" + patch_type: "conan" diff --git a/recipes/avcpp/all/conanfile.py b/recipes/avcpp/all/conanfile.py index ca7902bd79a4ff..7585987f38a758 100644 --- a/recipes/avcpp/all/conanfile.py +++ b/recipes/avcpp/all/conanfile.py @@ -1,46 +1,45 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class AvcppConan(ConanFile): name = "avcpp" description = "C++ wrapper for FFmpeg" - topics = ("ffmpeg", "cpp") license = "LGPL-2.1", "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/h4tr3d/avcpp/" + topics = ("ffmpeg", "cpp") settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False], + "fPIC": [True, False], "shared": [True, False], } default_options = { - "fPIC": True, + "fPIC": True, "shared": False, } - generators = "cmake", "cmake_find_package_multi" + @property + def _minimum_cpp_standard(self): + return 17 @property - def _compiler_required_cpp17(self): + def _compilers_minimum_version(self): return { - "Visual Studio": "16", "gcc": "8", "clang": "7", "apple-clang": "12.0", } - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,56 +50,66 @@ def configure(self): del self.options.fPIC def validate(self): - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") - - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("ffmpeg/5.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["AV_ENABLE_SHARED"] = self.options.shared - cmake.definitions["AV_ENABLE_STATIC"] = not self.options.shared - cmake.definitions["AV_BUILD_EXAMPLES"] = False - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["AV_ENABLE_SHARED"] = self.options.shared + tc.variables["AV_ENABLE_STATIC"] = not self.options.shared + tc.variables["AV_BUILD_EXAMPLES"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): target_name = "avcpp" if self.options.shared else "avcpp-static" self.cpp_info.set_property("cmake_file_name", "avcpp") - self.cpp_info.set_property("cmake_target_name", "avcpp::{}".format(target_name)) - - self.cpp_info.filenames["cmake_find_package"] = "avcpp" - self.cpp_info.filenames["cmake_find_package_multi"] = "avcpp" - self.cpp_info.names["cmake_find_package"] = "avcpp" - self.cpp_info.names["cmake_find_package_multi"] = "avcpp" + self.cpp_info.set_property("cmake_target_name", f"avcpp::{target_name}") self.cpp_info.components["AvCpp"].names["cmake_find_package"] = target_name self.cpp_info.components["AvCpp"].names["cmake_find_package_multi"] = target_name - self.cpp_info.components["AvCpp"].set_property("cmake_target_name", "avcpp::{}".format(target_name)) + self.cpp_info.components["AvCpp"].set_property("cmake_target_name", f"avcpp::{target_name}") self.cpp_info.components["AvCpp"].libs = ["avcpp", ] self.cpp_info.components["AvCpp"].requires = ["ffmpeg::ffmpeg", ] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["AvCpp"].system_libs = ["mvec"] + if self.settings.os == "Windows": + self.cpp_info.components["AvCpp"].system_libs = ["mfplat"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "avcpp" + self.cpp_info.filenames["cmake_find_package_multi"] = "avcpp" + self.cpp_info.names["cmake_find_package"] = "avcpp" + self.cpp_info.names["cmake_find_package_multi"] = "avcpp" diff --git a/recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch b/recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch new file mode 100644 index 00000000000000..38c60a601238c3 --- /dev/null +++ b/recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch @@ -0,0 +1,46 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 95b1a02..0f31197 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,8 +6,6 @@ endif() + + project(AvCpp LANGUAGES CXX VERSION 2.1.0) + +-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) +- + set(FFMPEG_PKG_CONFIG_SUFFIX "" CACHE STRING "This suffix uses for FFmpeg component names searches by pkg-config") + set(AV_ENABLE_STATIC On CACHE BOOL "Enable static library build (On)") + set(AV_ENABLE_SHARED On CACHE BOOL "Enable shared library build (On)") +@@ -28,8 +26,8 @@ set (AVCPP_WARNING_OPTIONS + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads) + +-find_package(FFmpeg +- COMPONENTS AVCODEC AVFORMAT AVUTIL AVDEVICE AVFILTER SWSCALE SWRESAMPLE REQUIRED) ++find_package(ffmpeg ++ COMPONENTS avcodec avformat avutil avdevice avfilter swscale swresample REQUIRED) + + add_subdirectory(src) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 4c58281..bee779f 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -24,7 +24,7 @@ foreach(TARGET ${AV_TARGETS}) + add_library(${TARGET} ${TYPE} ${AV_SOURCES} ${AV_HEADERS}) + + target_compile_options(${TARGET} PRIVATE ${AVCPP_WARNING_OPTIONS}) +- target_link_libraries(${TARGET} PRIVATE Threads::Threads PUBLIC FFmpeg::FFmpeg) ++ target_link_libraries(${TARGET} PRIVATE Threads::Threads PUBLIC ffmpeg::ffmpeg) + target_include_directories(${TARGET} + PUBLIC + $ +@@ -53,7 +53,7 @@ if (AVCPP_NOT_SUBPROJECT) + # APPEND + # FILE ${CMAKE_CURRENT_BINARY_DIR}/avcpp-targets.cmake) + +- install(TARGETS ${AV_TARGETS} FFmpeg ++ install(TARGETS ${AV_TARGETS} + EXPORT avcpp-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/avcpp/all/patches/fix-ffmpeg-package.patch b/recipes/avcpp/all/patches/cci.20220301-fix-ffmpeg.patch similarity index 100% rename from recipes/avcpp/all/patches/fix-ffmpeg-package.patch rename to recipes/avcpp/all/patches/cci.20220301-fix-ffmpeg.patch diff --git a/recipes/avcpp/all/test_package/CMakeLists.txt b/recipes/avcpp/all/test_package/CMakeLists.txt index a52ed1452c0cbd..7b07f0b83ed625 100644 --- a/recipes/avcpp/all/test_package/CMakeLists.txt +++ b/recipes/avcpp/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(avcpp CONFIG REQUIRED) +find_package(avcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) if (TARGET avcpp::avcpp) - target_link_libraries(${PROJECT_NAME} avcpp::avcpp) + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp) else() - target_link_libraries(${PROJECT_NAME} avcpp::avcpp-static) + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp-static) endif() target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) diff --git a/recipes/avcpp/all/test_package/conanfile.py b/recipes/avcpp/all/test_package/conanfile.py index 6b551939fbde3e..a9fb96656f2039 100644 --- a/recipes/avcpp/all/test_package/conanfile.py +++ b/recipes/avcpp/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class TestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/avcpp/all/test_v1_package/CMakeLists.txt b/recipes/avcpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..053bba6e952b40 --- /dev/null +++ b/recipes/avcpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(avcpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +if (TARGET avcpp::avcpp) + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp-static) +endif() +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) diff --git a/recipes/avcpp/all/test_v1_package/conanfile.py b/recipes/avcpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..6b551939fbde3e --- /dev/null +++ b/recipes/avcpp/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class TestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/avcpp/config.yml b/recipes/avcpp/config.yml index 372dcda16cf255..deb0eb011c7ea1 100644 --- a/recipes/avcpp/config.yml +++ b/recipes/avcpp/config.yml @@ -1,3 +1,5 @@ versions: + "2.1.0": + folder: all "cci.20220301": folder: all From 85be44d9190033d87dd3502966b9257ab5f4e3df Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Oct 2022 23:04:08 +0200 Subject: [PATCH 074/300] (#13560) lmdb: conan v2 support * conan v2 support * bum required_conan_version Co-authored-by: Chris Mc Co-authored-by: Chris Mc --- recipes/lmdb/all/CMakeLists.txt | 21 +++--- recipes/lmdb/all/conanfile.py | 72 ++++++++++--------- recipes/lmdb/all/test_package/CMakeLists.txt | 9 ++- recipes/lmdb/all/test_package/conanfile.py | 22 ++++-- .../lmdb/all/test_v1_package/CMakeLists.txt | 10 +++ recipes/lmdb/all/test_v1_package/conanfile.py | 17 +++++ 6 files changed, 93 insertions(+), 58 deletions(-) create mode 100644 recipes/lmdb/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/lmdb/all/test_v1_package/conanfile.py diff --git a/recipes/lmdb/all/CMakeLists.txt b/recipes/lmdb/all/CMakeLists.txt index 679dd60a12c26d..888afb35a88e01 100644 --- a/recipes/lmdb/all/CMakeLists.txt +++ b/recipes/lmdb/all/CMakeLists.txt @@ -1,25 +1,24 @@ cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) +project(lmdb LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup() +include(GNUInstallDirs) # LMDB library: add_library(lmdb - source_subfolder/lmdb.h - source_subfolder/mdb.c - source_subfolder/midl.c - source_subfolder/midl.h + ${LMDB_SRC_DIR}/lmdb.h + ${LMDB_SRC_DIR}/mdb.c + ${LMDB_SRC_DIR}/midl.c + ${LMDB_SRC_DIR}/midl.h ) set_target_properties(lmdb PROPERTIES - PUBLIC_HEADER source_subfolder/lmdb.h + PUBLIC_HEADER ${LMDB_SRC_DIR}/lmdb.h WINDOWS_EXPORT_ALL_SYMBOLS ON ) -include(FindThreads) -target_link_libraries(lmdb PUBLIC ${CMAKE_THREAD_LIBS_INIT}) +find_package(Threads REQUIRED) +target_link_libraries(lmdb PUBLIC Threads::Threads) install(TARGETS lmdb RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -37,7 +36,7 @@ endif (LMDB_ENABLE_ROBUST_MUTEX) if(NOT WIN32) foreach(TOOL mdb_stat mdb_copy mdb_dump mdb_load) - add_executable(${TOOL} source_subfolder/${TOOL}.c) + add_executable(${TOOL} ${LMDB_SRC_DIR}/${TOOL}.c) target_link_libraries(${TOOL} lmdb) install(TARGETS ${TOOL} DESTINATION ${CMAKE_INSTALL_BINDIR}) endforeach() diff --git a/recipes/lmdb/all/conanfile.py b/recipes/lmdb/all/conanfile.py index b90a6bbeb1c7cd..7700c885b181c3 100644 --- a/recipes/lmdb/all/conanfile.py +++ b/recipes/lmdb/all/conanfile.py @@ -1,7 +1,9 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.29.0" +required_conan_version = ">=1.46.0" class lmdbConan(ConanFile): @@ -10,8 +12,9 @@ class lmdbConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://symas.com/lmdb/" description = "Fast and compat memory-mapped key-value database" - topics = ("LMDB", "database", "key-value", "memory-mapped") - settings = "os", "compiler", "build_type", "arch" + topics = ("database", "key-value", "memory-mapped") + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,18 +25,8 @@ class lmdbConan(ConanFile): "fPIC": True, "enable_robust_mutex": True, } - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + exports_sources = ["CMakeLists.txt"] def config_options(self): if self.settings.os == "Windows": @@ -45,40 +38,49 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - root = "openldap-LMDB_{}".format(self.version) - tools.rename(os.path.join(root, "libraries", "liblmdb"), self._source_subfolder) - tools.rmdir(root) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LMDB_SRC_DIR"] = os.path.join(self.source_folder, "libraries", "liblmdb").replace("\\", "/") + tc.variables["LMDB_ENABLE_ROBUST_MUTEX"] = self.options.enable_robust_mutex + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LMDB_ENABLE_ROBUST_MUTEX"] = self.options.enable_robust_mutex - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=os.path.join(self.source_folder, "libraries", "liblmdb"), dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): + self.cpp_info.set_property("pkg_config_name", "lmdb") self.cpp_info.libs = ["lmdb"] - self.cpp_info.names["pkg_config"] = "lmdb" if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/lmdb/all/test_package/CMakeLists.txt b/recipes/lmdb/all/test_package/CMakeLists.txt index c18f9b2f3fce4e..3342cb59e0fead 100644 --- a/recipes/lmdb/all/test_package/CMakeLists.txt +++ b/recipes/lmdb/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.4) -project(test_package C) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(lmdb REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE lmdb::lmdb) diff --git a/recipes/lmdb/all/test_package/conanfile.py b/recipes/lmdb/all/test_package/conanfile.py index 2ab7e3a608f127..0a6bc68712d901 100644 --- a/recipes/lmdb/all/test_package/conanfile.py +++ b/recipes/lmdb/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" -class LmdbTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lmdb/all/test_v1_package/CMakeLists.txt b/recipes/lmdb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..20645081348a3f --- /dev/null +++ b/recipes/lmdb/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(lmdb REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE lmdb::lmdb) diff --git a/recipes/lmdb/all/test_v1_package/conanfile.py b/recipes/lmdb/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/lmdb/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From f39baf77725386941c9affe69f05c827409d83d0 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 19 Oct 2022 14:06:07 +0900 Subject: [PATCH 075/300] (#13494) aws-c-s3: add version 0.1.49 and support conan v2 * aws-c-s3: add version 0.1.49 and support conan v2 * update required recipe version --- recipes/aws-c-s3/all/CMakeLists.txt | 7 -- recipes/aws-c-s3/all/conandata.yml | 3 + recipes/aws-c-s3/all/conanfile.py | 83 +++++++++++-------- .../aws-c-s3/all/test_package/CMakeLists.txt | 5 +- .../aws-c-s3/all/test_package/conanfile.py | 21 +++-- .../all/test_v1_package/CMakeLists.txt | 10 +++ .../aws-c-s3/all/test_v1_package/conanfile.py | 17 ++++ recipes/aws-c-s3/config.yml | 2 + 8 files changed, 95 insertions(+), 53 deletions(-) delete mode 100644 recipes/aws-c-s3/all/CMakeLists.txt create mode 100644 recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/aws-c-s3/all/test_v1_package/conanfile.py diff --git a/recipes/aws-c-s3/all/CMakeLists.txt b/recipes/aws-c-s3/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c9233..00000000000000 --- a/recipes/aws-c-s3/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-s3/all/conandata.yml b/recipes/aws-c-s3/all/conandata.yml index 4daad0a6b73ccf..af6e82a742aa67 100644 --- a/recipes/aws-c-s3/all/conandata.yml +++ b/recipes/aws-c-s3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.49": + url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.49.tar.gz" + sha256: "71acbba41a02477a6c352172da561bc2138bf239b936490c773d7aaa83afc9ab" "0.1.37": url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.37.tar.gz" sha256: "2c35100c1739300e438d47f49aaa2c374001416a79fe3c6f27d79371fb2ac90b" diff --git a/recipes/aws-c-s3/all/conanfile.py b/recipes/aws-c-s3/all/conanfile.py index 59a016d054869a..131627214ba790 100644 --- a/recipes/aws-c-s3/all/conanfile.py +++ b/recipes/aws-c-s3/all/conanfile.py @@ -1,18 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.47.0" class AwsCS3(ConanFile): name = "aws-c-s3" description = "C99 implementation of the S3 client" - topics = ("aws", "amazon", "cloud", "s3") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-s3" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "s3") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,51 +23,62 @@ class AwsCS3(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") - self.requires("aws-c-auth/0.6.11") - if tools.Version(self.version) >= "0.1.36": - self.requires("aws-checksums/0.1.12") + self.requires("aws-c-common/0.8.2") + if Version(self.version) < "0.1.49": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + self.requires("aws-c-auth/0.6.11") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + self.requires("aws-c-auth/0.6.17") + if Version(self.version) >= "0.1.36": + self.requires("aws-checksums/0.1.13") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-s3")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-s3")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-s3") @@ -88,5 +99,5 @@ def package_info(self): "aws-c-http::aws-c-http-lib", "aws-c-auth::aws-c-auth-lib" ] - if tools.Version(self.version) >= "0.1.36": + if Version(self.version) >= "0.1.36": self.cpp_info.components["aws-c-s3-lib"].requires.append("aws-checksums::aws-checksums-lib") diff --git a/recipes/aws-c-s3/all/test_package/CMakeLists.txt b/recipes/aws-c-s3/all/test_package/CMakeLists.txt index 4af87d8f6333f7..8e0fdd1abc04c0 100644 --- a/recipes/aws-c-s3/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-s3/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-s3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-s3) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-s3) diff --git a/recipes/aws-c-s3/all/test_package/conanfile.py b/recipes/aws-c-s3/all/test_package/conanfile.py index 49a3a66ea5bad4..a9fb96656f2039 100644 --- a/recipes/aws-c-s3/all/test_package/conanfile.py +++ b/recipes/aws-c-s3/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0778b2e2c7246d --- /dev/null +++ b/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-s3 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-s3) diff --git a/recipes/aws-c-s3/all/test_v1_package/conanfile.py b/recipes/aws-c-s3/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..49a3a66ea5bad4 --- /dev/null +++ b/recipes/aws-c-s3/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-s3/config.yml b/recipes/aws-c-s3/config.yml index 86679f6500b252..182095498622bf 100644 --- a/recipes/aws-c-s3/config.yml +++ b/recipes/aws-c-s3/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.49": + folder: all "0.1.37": folder: all "0.1.29": From 843317aed0272023e4be86eb6616c645f8f9ff8e Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 19 Oct 2022 14:43:49 +0900 Subject: [PATCH 076/300] (#13526) lief: support conan v2 and update dependencies * lief: support conan v2 * fix settings order in test_v1_package * fix validation * add filename definition * don't use collect_libs * don't use collect_libs * use cmake_find_package_multi * drop support libstdc++ * drop support clang and libstdc++ * link math lib * add msvc version check --- recipes/lief/all/CMakeLists.txt | 7 - recipes/lief/all/conandata.yml | 6 - recipes/lief/all/conanfile.py | 143 +++++++++++------- .../lief/all/patches/001_link_to_conan.patch | 80 +++++----- recipes/lief/all/test_package/CMakeLists.txt | 13 +- recipes/lief/all/test_package/conanfile.py | 21 ++- .../lief/all/test_v1_package/CMakeLists.txt | 11 ++ recipes/lief/all/test_v1_package/conanfile.py | 20 +++ 8 files changed, 181 insertions(+), 120 deletions(-) delete mode 100644 recipes/lief/all/CMakeLists.txt create mode 100644 recipes/lief/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/lief/all/test_v1_package/conanfile.py diff --git a/recipes/lief/all/CMakeLists.txt b/recipes/lief/all/CMakeLists.txt deleted file mode 100644 index 30c065f03128e9..00000000000000 --- a/recipes/lief/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/lief/all/conandata.yml b/recipes/lief/all/conandata.yml index 783cb3b5db868d..6bb6d4a4c6bc48 100644 --- a/recipes/lief/all/conandata.yml +++ b/recipes/lief/all/conandata.yml @@ -5,14 +5,8 @@ sources: patches: "0.10.1": - patch_file: "patches/001_link_to_conan.patch" - base_path: "source_subfolder" - patch_file: "patches/002_fix_resources_manager.patch" - base_path: "source_subfolder" - patch_file: "patches/003_fix_json_include_path.patch" - base_path: "source_subfolder" - patch_file: "patches/004_fix_elf_parser.patch" - base_path: "source_subfolder" - patch_file: "patches/005_fix_compiler_detection.patch" - base_path: "source_subfolder" - patch_file: "patches/006_fix_binary_cpp.patch" - base_path: "source_subfolder" diff --git a/recipes/lief/all/conanfile.py b/recipes/lief/all/conanfile.py index 94959a4ba4b2a7..626cc2d07f9f0b 100644 --- a/recipes/lief/all/conanfile.py +++ b/recipes/lief/all/conanfile.py @@ -1,18 +1,23 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.52.0" class LiefConan(ConanFile): name = "lief" description = "Library to Instrument Executable Formats" - topics = ("conan", "lief", "executable", "elf") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lief-project/LIEF" - license = "Apache-2.0" - exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake", - settings = "os", "compiler", "build_type", "arch" + topics = ("executable", "elf", "pe", "mach-o") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -42,80 +47,104 @@ class LiefConan(ConanFile): "with_vdex": True, } - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version.value) <= 14 and self.options.shared: - raise ConanInvalidConfiguration("{} {} does not support Visual Studio <= 14 with shared:True".format(self.name, self.version)) + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + if ((self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) <= "14") + or + (self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) <= "190")) \ + and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not support Visual Studio <= 14 with shared:True") + + if self.info.settings.compiler.get_safe("libcxx") == "libstdc++": + raise ConanInvalidConfiguration(f"{self.ref} does not support libstdc++") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("rang/3.1.0") - self.requires("mbedtls/2.16.3-apache") + self.requires("rang/3.2") + self.requires("mbedtls/3.2.1") if self.options.with_json: - self.requires("nlohmann_json/3.9.1") + self.requires("nlohmann_json/3.11.2") if self.options.with_frozen: - self.requires("frozen/1.0.0") + self.requires("frozen/1.1.1") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "LIEF-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIEF_ART"] = self.options.with_art - self._cmake.definitions["LIEF_DEX"] = self.options.with_dex - self._cmake.definitions["LIEF_ELF"] = self.options.with_elf - self._cmake.definitions["LIEF_OAT"] = self.options.with_oat - self._cmake.definitions["LIEF_PE"] = self.options.with_pe - self._cmake.definitions["LIEF_VDEX"] = self.options.with_vdex - self._cmake.definitions["LIEF_MACHO"] = self.options.with_macho - self._cmake.definitions["LIEF_ENABLE_JSON"] = self.options.with_json - self._cmake.definitions["LIEF_DISABLE_FROZEN"] = not self.options.with_frozen - self._cmake.definitions["LIEF_C_API"] = self.options.with_c_api - self._cmake.definitions["LIEF_EXAMPLES"] = False - self._cmake.definitions["LIEF_TESTS"] = False - self._cmake.definitions["LIEF_DOC"] = False - self._cmake.definitions["LIEF_LOGGING"] = False - self._cmake.definitions["LIEF_PYTHON_API"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIEF_ART"] = self.options.with_art + tc.variables["LIEF_DEX"] = self.options.with_dex + tc.variables["LIEF_ELF"] = self.options.with_elf + tc.variables["LIEF_OAT"] = self.options.with_oat + tc.variables["LIEF_PE"] = self.options.with_pe + tc.variables["LIEF_VDEX"] = self.options.with_vdex + tc.variables["LIEF_MACHO"] = self.options.with_macho + tc.variables["LIEF_ENABLE_JSON"] = self.options.with_json + tc.variables["LIEF_DISABLE_FROZEN"] = not self.options.with_frozen + tc.variables["LIEF_C_API"] = self.options.with_c_api + tc.variables["LIEF_EXAMPLES"] = False + tc.variables["LIEF_TESTS"] = False + tc.variables["LIEF_DOC"] = False + tc.variables["LIEF_LOGGING"] = False + tc.variables["LIEF_PYTHON_API"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.names["pkg_config"] = "lief" - self.cpp_info.names["cmake_find_package"] = "LIEF" - self.cpp_info.names["cmake_find_package_multi"] = "LIEF" - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.defines = ["_GLIBCXX_USE_CXX11_ABI=1"] + self.cpp_info.libs = ["LIEF"] + + self.cpp_info.set_property("cmake_file_name", "LIEF") + self.cpp_info.set_property("cmake_target_name", "LIEF::LIEF") + self.cpp_info.set_property("pkg_config_name", "LIEF") + if self.options.shared: self.cpp_info.defines.append("LIEF_IMPORT") - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.cpp_info.cxxflags += ["/FIiso646.h"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.system_libs = ["ws2_32"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "LIEF" + self.cpp_info.filenames["cmake_find_package_multi"] = "LIEF" + self.cpp_info.names["cmake_find_package"] = "LIEF" + self.cpp_info.names["cmake_find_package_multi"] = "LIEF" + self.cpp_info.names["pkg_config"] = "LIEF" diff --git a/recipes/lief/all/patches/001_link_to_conan.patch b/recipes/lief/all/patches/001_link_to_conan.patch index c70b6f9ecad221..e999cd3dd93177 100644 --- a/recipes/lief/all/patches/001_link_to_conan.patch +++ b/recipes/lief/all/patches/001_link_to_conan.patch @@ -1,6 +1,8 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -5,7 +5,6 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9b168d9..243bbc2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,7 +5,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Modules list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") if (WIN32) @@ -8,8 +10,8 @@ endif() include(CheckCXXCompilerFlag) include(CheckCCompilerFlag) -@@ -49,14 +48,14 @@ - +@@ -49,14 +48,14 @@ endif() + # Dependencies # ============ -set(THIRD_PARTY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/third-party/") @@ -19,17 +21,17 @@ + message(STATUS "Enable Frozen (C++14 support)") + set(LIEF_FROZEN_ENABLED 1) +endif() - + # LIEF Source definition # ====================== -set_source_files_properties(${mbedtls_src_crypto} PROPERTIES GENERATED TRUE) -set_source_files_properties(${mbedtls_src_x509} PROPERTIES GENERATED TRUE) -set_source_files_properties(${mbedtls_src_tls} PROPERTIES GENERATED TRUE) - + if (LIEF_LOGGING) set_source_files_properties(${ELG_SOURCE_DIR}/easylogging++.cc PROPERTIES GENERATED TRUE) -@@ -73,9 +72,6 @@ - +@@ -73,9 +72,6 @@ set(LIEF_PRIVATE_INCLUDE_FILES) + set(LIBLIEF_SOURCE_FILES "${ELG_CC_PATH}" - "${mbedtls_src_crypto}" @@ -38,31 +40,31 @@ "${LIBFUZZER_SRC_FILES}" "${CMAKE_CURRENT_SOURCE_DIR}/src/logging.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/exception.cpp" -@@ -126,13 +122,11 @@ +@@ -126,13 +122,11 @@ set(LIEF_INCLUDE_FILES set(LIEF_JSON_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/visitors/json.cpp") set(LIEF_JSON_HDR "${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/json.hpp" - "${LIBJSON_SOURCE_DIR}/json.hpp" ) - + if (LIEF_ENABLE_JSON) list(APPEND LIBLIEF_SOURCE_FILES "${LIEF_JSON_SRC}") list(APPEND LIEF_INC_FILES "${LIEF_JSON_HDR}") - list(APPEND LIEF_PUBLIC_INCLUDE_DIR "${LIBJSON_SOURCE_DIR}/") endif() - + source_group("Header Files" FILES ${LIEF_INC_FILES}) -@@ -224,9 +218,6 @@ - +@@ -224,9 +218,6 @@ endif() + # Frozen Configuration # ==================== -if (LIEF_FROZEN_ENABLED) - list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${FROZEN_INCLUDE_DIR}") -endif() - + # OAT part # ======== -@@ -292,19 +283,15 @@ +@@ -292,19 +283,15 @@ list(APPEND LIEF_PUBLIC_INCLUDE_DIR list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${LIEF_PUBLIC_INCLUDE_DIR}" "${LIEF_PUBLIC_INCLUDE_DIR}" @@ -73,8 +75,8 @@ "${ELG_SOURCE_DIR}" - "${MBEDTLS_INCLUDE_DIRS}" ) - - + + # Grouping external projects # ========================== -source_group("mbedtls\\crypto" FILES ${mbedtls_src_crypto}) @@ -83,38 +85,42 @@ if (LIEF_LOGGING) source_group("easylogging" FILES ${ELG_SOURCE_DIR}/easylogging++.cc) endif() -@@ -316,7 +303,7 @@ +@@ -316,7 +303,8 @@ target_include_directories(LIB_LIEF PRIVATE "${LIEF_PRIVATE_INCLUDE_DIR}") - + if (LIEF_ENABLE_JSON) - add_dependencies(LIB_LIEF lief_libjson) -+ target_link_libraries(LIB_LIEF CONAN_PKG::nlohmann_json) ++ find_package(nlohmann_json REQUIRED CONFIG) ++ target_link_libraries(LIB_LIEF nlohmann_json::nlohmann_json) endif() - + if (LIEF_LOGGING) -@@ -324,18 +311,17 @@ +@@ -324,18 +312,20 @@ if (LIEF_LOGGING) endif() - + if (LIEF_FROZEN_ENABLED) - add_dependencies(LIB_LIEF lief_frozen) -+ target_link_libraries(LIB_LIEF CONAN_PKG::frozen) ++ find_package(frozen REQUIRED CONFIG) ++ target_link_libraries(LIB_LIEF frozen::frozen) endif() - + -add_dependencies(LIB_LIEF lief_rang_cpp_color) -+target_link_libraries(LIB_LIEF CONAN_PKG::rang) - ++find_package(rang REQUIRED CONFIG) ++target_link_libraries(LIB_LIEF rang::rang) + -add_dependencies(LIB_LIEF lief_mbed_tls) -+target_link_libraries(LIB_LIEF CONAN_PKG::mbedtls) - ++find_package(MbedTLS REQUIRED CONFIG) ++target_link_libraries(LIB_LIEF MbedTLS::mbedtls) + # Flags definition # ---------------- set_property(TARGET LIB_LIEF PROPERTY CXX_STANDARD 11) set_property(TARGET LIB_LIEF PROPERTY CXX_STANDARD_REQUIRED ON) -set_property(TARGET LIB_LIEF PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET LIB_LIEF PROPERTY CXX_VISIBILITY_PRESET hidden) - + target_compile_definitions(LIB_LIEF PUBLIC -D_GLIBCXX_USE_CXX11_ABI=1) -@@ -345,11 +331,6 @@ +@@ -345,11 +335,6 @@ target_compile_definitions(LIB_LIEF PUBLIC -D_GLIBCXX_USE_CXX11_ABI=1) # with the SpcSpAgencyInfo Critical Extension, which mbed TLS doesn't # support, so set MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION to # have it skip this extension. @@ -123,11 +129,11 @@ - -DMBEDTLS_MD4_C - -DMBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION -) - - + + # ASAN - LSAN - TSAN - USAN -@@ -512,16 +493,16 @@ - +@@ -512,16 +497,16 @@ endif() + install(TARGETS LIB_LIEF ARCHIVE - DESTINATION lib @@ -139,7 +145,7 @@ - DESTINATION lib + DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries) - + install( DIRECTORY ${LIEF_PUBLIC_INCLUDE_DIR} - DESTINATION include diff --git a/recipes/lief/all/test_package/CMakeLists.txt b/recipes/lief/all/test_package/CMakeLists.txt index 2c5505ca7220d9..6f9bbaa261abb4 100644 --- a/recipes/lief/all/test_package/CMakeLists.txt +++ b/recipes/lief/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.0) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(LIEF REQUIRED CONFIG) -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE LIEF::LIEF) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/lief/all/test_package/conanfile.py b/recipes/lief/all/test_package/conanfile.py index f98baa955fbcd8..5bef6136fec8ee 100644 --- a/recipes/lief/all/test_package/conanfile.py +++ b/recipes/lief/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,9 +21,9 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") arg_path = bin_path if self.settings.os == "Windows": arg_path += ".exe" - self.run("{0} {1}".format(bin_path, arg_path), run_environment=True) + self.run(f"{bin_path} {arg_path}", env="conanrun") diff --git a/recipes/lief/all/test_v1_package/CMakeLists.txt b/recipes/lief/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..7778f7e7ac904a --- /dev/null +++ b/recipes/lief/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(LIEF REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE LIEF::LIEF) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/lief/all/test_v1_package/conanfile.py b/recipes/lief/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..326a291210aff0 --- /dev/null +++ b/recipes/lief/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + arg_path = bin_path + if self.settings.os == "Windows": + arg_path += ".exe" + self.run(f"{bin_path} {arg_path}", run_environment=True) From e18b9c9364e6e1c946bc78f839d5fade6c5c003b Mon Sep 17 00:00:00 2001 From: theirix Date: Wed, 19 Oct 2022 09:05:26 +0300 Subject: [PATCH 077/300] (#13575) Add libde265/1.0.9 recipe * Add libde265 1.0.9 * Drop pylint skip-file exclusion --- recipes/libde265/all/conandata.yml | 5 +++++ recipes/libde265/all/test_v1_package/conanfile.py | 1 - recipes/libde265/config.yml | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/recipes/libde265/all/conandata.yml b/recipes/libde265/all/conandata.yml index ea045a30196d1d..47d525a12ed762 100644 --- a/recipes/libde265/all/conandata.yml +++ b/recipes/libde265/all/conandata.yml @@ -1,8 +1,13 @@ sources: + "1.0.9": + url: "https://github.com/strukturag/libde265/archive/v1.0.9.tar.gz" + sha256: "153554f407718a75f1e0ae197d35b43147ce282118a54f894554dbe27c32163d" "1.0.8": url: "https://github.com/strukturag/libde265/archive/v1.0.8.tar.gz" sha256: "c5ab61185f283f46388c700c43dc08606b0e260cd53f06b967ec0ad7a809ff11" patches: + "1.0.9": + - patch_file: "patches/0002-fix-out-of-source-build.patch" "1.0.8": - patch_file: "patches/0001-optional-sdl.patch" - patch_file: "patches/0002-fix-out-of-source-build.patch" diff --git a/recipes/libde265/all/test_v1_package/conanfile.py b/recipes/libde265/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/libde265/all/test_v1_package/conanfile.py +++ b/recipes/libde265/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/libde265/config.yml b/recipes/libde265/config.yml index 28e3ee22ca8ac7..1c656ce0b375f6 100644 --- a/recipes/libde265/config.yml +++ b/recipes/libde265/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.9": + folder: all "1.0.8": folder: all From aa8b85a6e230b02a6e21a1a523823cde56d716d5 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Wed, 19 Oct 2022 02:44:32 -0500 Subject: [PATCH 078/300] (#13488) wayland: Modernize test package * wayland: Modernize test package Update test package for Conan V2. Test wayland as a build requirement. This is a common use case for wayland-scanner. Use PkgConfigDeps build context to find wayland-scanner. * Add check for build profile --- recipes/wayland/all/test_package/conanfile.py | 53 ++++++++++++++----- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/recipes/wayland/all/test_package/conanfile.py b/recipes/wayland/all/test_package/conanfile.py index bcb69ca93c05f4..3752c2672501d0 100644 --- a/recipes/wayland/all/test_package/conanfile.py +++ b/recipes/wayland/all/test_package/conanfile.py @@ -1,28 +1,55 @@ import os from conan import ConanFile -from conan.tools.build import cross_building -from conan.tools.cmake import CMake -from conan.tools.gnu import PkgConfig +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import PkgConfig, PkgConfigDeps from conan.tools.layout import cmake_layout class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "CMakeToolchain", "CMakeDeps", "PkgConfigDeps", "VirtualRunEnv" + test_type = "explicit" + + @property + def _has_build_profile(self): + return hasattr(self, "settings_build") + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + self.tool_requires("pkgconf/1.9.3") def layout(self): cmake_layout(self) + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + pkg_config_deps = PkgConfigDeps(self) + if self._has_build_profile: + pkg_config_deps.build_context_activated = ["wayland"] + pkg_config_deps.build_context_suffix = {"wayland": "_BUILD"} + pkg_config_deps.generate() + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + def build(self): - if not cross_building(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - pkg_config = PkgConfig(self, "wayland-scanner", self.generators_folder) - self.run('%s --version' % pkg_config.variables["wayland_scanner"], env="conanrun") + cmake = CMake(self) + cmake.configure() + cmake.build() + + if self._has_build_profile: + pkg_config = PkgConfig(self, "wayland-scanner_BUILD", self.generators_folder) + wayland_scanner = pkg_config.variables["wayland_scanner"] + self.run(f"{wayland_scanner} --version", env="conanrun") def test(self): - if not cross_building(self): - cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(cmd, env="conanrun") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") From d30e231d6a57f9b0a463e9bb42f1b071788cd3ed Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 19 Oct 2022 10:25:30 +0200 Subject: [PATCH 079/300] (#13581) strawberryperl: few improvements * few improvements * cleanup Co-authored-by: Chris Mc * test user.strawberryperl:perl conf Co-authored-by: Chris Mc * self.conf.get instead of self.conf_info.get * more robust conan version check * revert test of user.strawberryperl:perl it's broken in test package before conan 1.53.0 Co-authored-by: Chris Mc --- recipes/strawberryperl/all/conanfile.py | 26 +++++++++---------- .../all/test_package/conanfile.py | 12 +++------ 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/recipes/strawberryperl/all/conanfile.py b/recipes/strawberryperl/all/conanfile.py index b665fe8420bef3..e5d600869e82fa 100644 --- a/recipes/strawberryperl/all/conanfile.py +++ b/recipes/strawberryperl/all/conanfile.py @@ -1,21 +1,19 @@ -import os -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, copy, rmdir +from conan.tools.files import copy, get, rmdir from conan.tools.scm import Version +import os -from conans import __version__ as conan_version - -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class StrawberryPerlConan(ConanFile): name = "strawberryperl" - description = "Strawberry Perl for Windows. Useful as build_require" + description = "Strawberry Perl for Windows." license = ("Artistic-1.0", "GPL-1.0") homepage = "http://strawberryperl.com" url = "https://github.com/conan-io/conan-center-index" - topics = ("installer", "perl", "windows") + topics = ("perl", "interpreter", "windows") settings = "os", "arch", "compiler", "build_type" def layout(self): @@ -29,6 +27,9 @@ def validate(self): if self.info.settings.os != "Windows": raise ConanInvalidConfiguration("Strawberry Perl is only intended to be used on Windows.") + def source(self): + pass + def build(self): get(self, **self.conan_data["sources"][self.version][str(self.settings.arch)], destination=self.build_folder) @@ -43,12 +44,11 @@ def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] + perl_path = os.path.join(self.package_folder, "bin", "perl.exe").replace("\\", "/") + self.conf_info.define("user.strawberryperl:perl", perl_path) + # TODO remove once conan v2 is the only support and recipes have been migrated - if Version(conan_version) < "2.0.0-beta": + if Version(conan_version).major < 2: bin_path = os.path.join(self.package_folder, "bin") self.env_info.PATH.append(bin_path) - - perl_path = os.path.join(self.package_folder, "bin", "perl.exe").replace("\\", "/") - self.conf_info.define("user.strawberryperl:perl", perl_path) - if Version(conan_version) < "2.0.0-beta": self.user_info.perl = perl_path diff --git a/recipes/strawberryperl/all/test_package/conanfile.py b/recipes/strawberryperl/all/test_package/conanfile.py index 85800c3ed5d5ad..8cd67438d10ce6 100644 --- a/recipes/strawberryperl/all/test_package/conanfile.py +++ b/recipes/strawberryperl/all/test_package/conanfile.py @@ -1,8 +1,5 @@ -import os from conan import ConanFile -from conan.tools.build import can_run -from conan.tools.env import VirtualBuildEnv -from conan.tools.scm import Version +import os class TestPackageConan(ConanFile): @@ -14,7 +11,6 @@ def build_requirements(self): self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - self.run("perl --version") - perl_script = os.path.join(self.source_folder, "list_files.pl") - self.run(f"perl {perl_script}", env="conanbuild") + self.run("perl --version") + perl_script = os.path.join(self.source_folder, "list_files.pl") + self.run(f"perl {perl_script}") From ce26ee8d069c0927829c6d96d595521f7c3c6838 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 19 Oct 2022 17:44:34 +0900 Subject: [PATCH 080/300] (#13299) opentelemetry-cpp: add version 1.6.1 and support conan v2 * opentelemetry-cpp: add version 1.6.1 and support conan v2 * use f-string * delete unused module * use check_min_vs --- recipes/opentelemetry-cpp/all/CMakeLists.txt | 7 - recipes/opentelemetry-cpp/all/conandata.yml | 24 ++- recipes/opentelemetry-cpp/all/conanfile.py | 145 +++++++++--------- .../all/patches/1.0.1-0001-fix-cmake.patch | 28 ++++ .../all/patches/1.2.0-0001-fix-cmake.patch | 15 ++ .../all/patches/1.3.0-0001-fix-cmake.patch | 23 ++- .../all/patches/1.4.0-0001-fix-cmake.patch | 15 ++ .../all/patches/1.6.1-0001-fix-cmake.patch | 27 ++++ .../all/test_package/CMakeLists.txt | 8 +- .../all/test_package/conanfile.py | 22 ++- .../all/test_v1_package/CMakeLists.txt | 12 ++ .../all/test_v1_package/conanfile.py | 18 +++ recipes/opentelemetry-cpp/config.yml | 2 + 13 files changed, 248 insertions(+), 98 deletions(-) delete mode 100644 recipes/opentelemetry-cpp/all/CMakeLists.txt create mode 100644 recipes/opentelemetry-cpp/all/patches/1.0.1-0001-fix-cmake.patch create mode 100644 recipes/opentelemetry-cpp/all/patches/1.2.0-0001-fix-cmake.patch create mode 100644 recipes/opentelemetry-cpp/all/patches/1.6.1-0001-fix-cmake.patch create mode 100644 recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py diff --git a/recipes/opentelemetry-cpp/all/CMakeLists.txt b/recipes/opentelemetry-cpp/all/CMakeLists.txt deleted file mode 100644 index c921d02a0d877e..00000000000000 --- a/recipes/opentelemetry-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/opentelemetry-cpp/all/conandata.yml b/recipes/opentelemetry-cpp/all/conandata.yml index d77f0da9d79fd4..ff38a16b0e5feb 100644 --- a/recipes/opentelemetry-cpp/all/conandata.yml +++ b/recipes/opentelemetry-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.6.1": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.6.1.tar.gz" + sha256: "1fc371be049b3220b8b9571c8b713f03e9a84f3c5684363f64ccc814638391a5" "1.4.1": url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.4.1.tar.gz" sha256: "301b1ab74a664723560f46c29f228360aff1e2d63e930b963755ea077ae67524" @@ -16,12 +19,27 @@ sources: sha256: "32f12ff15ec257e3462883f84bc291c2d5dc30055604c12ec4b46a36dfa3f189" patches: + "1.6.1": + - patch_file: "patches/1.6.1-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries" + patch_type: "backport" "1.4.1": - patch_file: "patches/1.4.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "fix lack of linking libraries" + patch_type: "backport" "1.4.0": - patch_file: "patches/1.4.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "fix lack of linking libraries" + patch_type: "backport" "1.3.0": - patch_file: "patches/1.3.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "fix lack of linking libraries" + patch_type: "backport" + "1.2.0": + - patch_file: "patches/1.2.0-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries" + patch_type: "backport" + "1.0.1": + - patch_file: "patches/1.0.1-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries" + patch_type: "backport" diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index 432efd2d1ecdee..47723bf6d9c506 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -1,12 +1,15 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file, save +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import check_min_vs + import os import textwrap -import functools -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class OpenTelemetryCppConan(ConanFile): name = "opentelemetry-cpp" @@ -24,13 +27,14 @@ class OpenTelemetryCppConan(ConanFile): "fPIC": True, "shared": False, } - generators = "cmake", "cmake_find_package_multi" short_paths = True + @property + def _minimum_cpp_standard(self): + return 11 + def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,33 +42,41 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("abseil/20211102.0") - self.requires("grpc/1.45.2") - self.requires("libcurl/7.83.1") - self.requires("nlohmann_json/3.10.5") - self.requires("openssl/1.1.1o") - self.requires("opentelemetry-proto/0.18.0") - self.requires("protobuf/3.21.1") - self.requires("thrift/0.15.0") - if tools.Version(self.version) >= "1.3.0": - self.requires("boost/1.79.0") + self.requires("abseil/20220623.0") + self.requires("grpc/1.48.0") + self.requires("libcurl/7.85.0") + self.requires("nlohmann_json/3.11.2") + self.requires("openssl/1.1.1q") + if Version(self.version) <= "1.4.1": + self.requires("opentelemetry-proto/0.11.0") + else: + self.requires("opentelemetry-proto/0.19.0") + self.requires("protobuf/3.21.4") + self.requires("thrift/0.17.0") + if Version(self.version) >= "1.3.0": + self.requires("boost/1.80.0") def validate(self): - if self.settings.arch != "x86_64": - raise ConanInvalidConfiguration("Architecture not supported") + if self.info.settings.arch != "x86_64": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support architecture : {self.info.settings.arch}") - if (self.settings.compiler == "Visual Studio" and - tools.Version(self.settings.compiler.version) < "16"): - raise ConanInvalidConfiguration("Visual Studio 2019 or higher required") + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, "192") if self.settings.os != "Linux" and self.options.shared: - raise ConanInvalidConfiguration("Building shared libraries is only supported on Linux") + raise ConanInvalidConfiguration(f"{self.ref} supports building shared libraries only on Linux") - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ set(OPENTELEMETRY_CPP_INCLUDE_DIRS ${opentelemetry-cpp_INCLUDE_DIRS} ${opentelemetry-cpp_INCLUDE_DIRS_RELEASE} @@ -73,79 +85,68 @@ def _create_cmake_module_variables(module_file): ${opentelemetry-cpp_INCLUDE_DIRS_DEBUG}) set(OPENTELEMETRY_CPP_LIBRARIES opentelemetry-cpp::opentelemetry-cpp) """) - tools.save(module_file, content) - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + save(self, module_file, content) def source(self): - tools.get( - **self.conan_data["sources"][self.version], - destination=self._source_subfolder, - strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - defs = { - "BUILD_TESTING": False, - "WITH_ABSEIL": True, - "WITH_ETW": True, - "WITH_EXAMPLES": False, - "WITH_JAEGER": True, - "WITH_OTLP": True, - "WITH_ZIPKIN": True, - } - cmake.configure(defs=defs, build_folder=self._build_subfolder) - return cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["WITH_ABSEIL"] = True + tc.variables["WITH_ETW"] = True + tc.variables["WITH_EXAMPLES"] = False + tc.variables["WITH_JAEGER"] = True + tc.variables["WITH_OTLP"] = True + tc.variables["WITH_ZIPKIN"] = True + tc.generate() + + tc = CMakeDeps(self) + tc.generate() def _patch_sources(self): protos_path = self.deps_user_info["opentelemetry-proto"].proto_root.replace("\\", "/") protos_cmake_path = os.path.join( - self._source_subfolder, + self.source_folder, "cmake", "opentelemetry-proto.cmake") - if tools.Version(self.version) >= "1.1.0": - tools.replace_in_file( + if Version(self.version) >= "1.1.0": + replace_in_file(self, protos_cmake_path, "if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)", "if(1)") - tools.replace_in_file( + replace_in_file(self, protos_cmake_path, "set(PROTO_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto\")", f"set(PROTO_PATH \"{protos_path}\")") - tools.rmdir(os.path.join(self._source_subfolder, "api", "include", "opentelemetry", "nostd", "absl")) + rmdir(self, os.path.join(self.source_folder, "api", "include", "opentelemetry", "nostd", "absl")) - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._otel_cmake_variables_path) ) @property def _module_subfolder(self): - return os.path.join("lib", "cmake") + return os.path.join(self.package_folder, "lib", "cmake") @property def _otel_cmake_variables_path(self): return os.path.join(self._module_subfolder, - "conan-official-{}-variables.cmake".format(self.name)) + f"conan-official-{self.name}-variables.cmake") @property def _otel_build_modules(self): @@ -153,7 +154,7 @@ def _otel_build_modules(self): @property def _http_client_name(self): - return "http_client_curl" if tools.Version(self.version) < "1.3.0" else "opentelemetry_http_client_curl" + return "http_client_curl" if Version(self.version) < "1.3.0" else "opentelemetry_http_client_curl" @property def _otel_libraries(self): @@ -206,7 +207,7 @@ def package_info(self): "opentelemetry_resources", "thrift::thrift", ]) - if tools.Version(self.version) >= "1.3.0": + if Version(self.version) >= "1.3.0": self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.extend([ "boost::locale", ]) diff --git a/recipes/opentelemetry-cpp/all/patches/1.0.1-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.0.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..ecdbb0cf0f9fc6 --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.0.1-0001-fix-cmake.patch @@ -0,0 +1,28 @@ +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 9fb6f49..1f1547e 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -162,6 +162,10 @@ else() # cmake 3.8 or lower + target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(BUILD_SHARED_LIBS) + set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() +diff --git a/exporters/zipkin/CMakeLists.txt b/exporters/zipkin/CMakeLists.txt +index 2316860..8995b31 100644 +--- a/exporters/zipkin/CMakeLists.txt ++++ b/exporters/zipkin/CMakeLists.txt +@@ -21,7 +21,7 @@ add_library(opentelemetry_exporter_zipkin_trace src/zipkin_exporter.cc + src/recordable.cc) + + target_link_libraries(opentelemetry_exporter_zipkin_trace +- PUBLIC opentelemetry_trace http_client_curl) ++ PUBLIC opentelemetry_trace http_client_curl nlohmann_json::nlohmann_json) + + install( + TARGETS opentelemetry_exporter_zipkin_trace diff --git a/recipes/opentelemetry-cpp/all/patches/1.2.0-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.2.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..275e2c9b44a66f --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.2.0-0001-fix-cmake.patch @@ -0,0 +1,15 @@ +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 8d8f868..2a78f98 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -214,6 +214,10 @@ else() + ${METRICS_SERVICE_PB_CPP_FILE}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(needs_proto_download) + add_dependencies(opentelemetry_proto opentelemetry-proto) + endif() diff --git a/recipes/opentelemetry-cpp/all/patches/1.3.0-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.3.0-0001-fix-cmake.patch index cca97cf74351f2..ce868fbedca221 100644 --- a/recipes/opentelemetry-cpp/all/patches/1.3.0-0001-fix-cmake.patch +++ b/recipes/opentelemetry-cpp/all/patches/1.3.0-0001-fix-cmake.patch @@ -1,7 +1,7 @@ -diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt -index 09c21fd..a8d7d16 100644 ---- a/a/CMakeLists.txt -+++ b/b/CMakeLists.txt +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 09c21fd..a8d7d16 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -203,7 +203,6 @@ if(WITH_JAEGER) find_package(Thrift QUIET) if(Thrift_FOUND) @@ -10,3 +10,18 @@ index 09c21fd..a8d7d16 100644 else() # Install Thrift and propagate via vcpkg toolchain file if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 8d8f868..2a78f98 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -214,6 +214,10 @@ else() + ${METRICS_SERVICE_PB_CPP_FILE}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(needs_proto_download) + add_dependencies(opentelemetry_proto opentelemetry-proto) + endif() diff --git a/recipes/opentelemetry-cpp/all/patches/1.4.0-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.4.0-0001-fix-cmake.patch index de56d2c7118c62..1fcf5a04277381 100644 --- a/recipes/opentelemetry-cpp/all/patches/1.4.0-0001-fix-cmake.patch +++ b/recipes/opentelemetry-cpp/all/patches/1.4.0-0001-fix-cmake.patch @@ -10,3 +10,18 @@ index 6d2b274..4611a6b 100755 else() # Install Thrift and propagate via vcpkg toolchain file if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 37d45da..89395c0 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -215,6 +215,10 @@ else() + ${METRICS_SERVICE_PB_CPP_FILE}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(needs_proto_download) + add_dependencies(opentelemetry_proto opentelemetry-proto) + endif() diff --git a/recipes/opentelemetry-cpp/all/patches/1.6.1-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.6.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..b3391855652c43 --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.6.1-0001-fix-cmake.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a1b6934..d4f5251 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -209,7 +209,6 @@ if(WITH_JAEGER) + find_package(Thrift QUIET) + if(Thrift_FOUND) + find_package(Boost REQUIRED) +- include_directories(${Boost_INCLUDE_DIR}) + else() + # Install Thrift and propagate via vcpkg toolchain file + if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 629ea81..3b09b92 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -242,6 +242,10 @@ else() # cmake 3.8 or lower + target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(BUILD_SHARED_LIBS) + set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() diff --git a/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt b/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt index 85330da09a2aa8..53dd5c5a1c6f72 100644 --- a/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt +++ b/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt @@ -1,13 +1,9 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(opentelemetry-cpp REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS}) -target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${OPENTELEMETRY_CPP_LIBRARIES}) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE opentelemetry-cpp::opentelemetry-cpp) target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/opentelemetry-cpp/all/test_package/conanfile.py b/recipes/opentelemetry-cpp/all/test_package/conanfile.py index 1bf1c7e26255d4..a9fb96656f2039 100644 --- a/recipes/opentelemetry-cpp/all/test_package/conanfile.py +++ b/recipes/opentelemetry-cpp/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt b/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..432e5d7c64ed45 --- /dev/null +++ b/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(opentelemetry-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE opentelemetry-cpp::opentelemetry-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py b/recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opentelemetry-cpp/config.yml b/recipes/opentelemetry-cpp/config.yml index 8a2917f4530760..d9469bdd59f649 100644 --- a/recipes/opentelemetry-cpp/config.yml +++ b/recipes/opentelemetry-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "1.6.1": + folder: all "1.4.1": folder: all "1.4.0": From 64298d88fc26d2aadcf287f243721898d4debc87 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Wed, 19 Oct 2022 04:45:00 -0500 Subject: [PATCH 081/300] (#13487) wayland-protocols: Conan V2 * wayland-protocols: Conan V2 Update for Conan V2. Use build context for PkgConfigDeps in test package. * Update Meson * Add check for build profile --- recipes/wayland-protocols/all/conanfile.py | 71 ++++++++----------- .../all/test_package/conanfile.py | 48 +++++++++---- .../all/test_package/meson.build | 12 +++- .../all/test_package/meson_options.txt | 1 + .../all/test_v1_package/conanfile.py | 27 +++++++ .../all/test_v1_package/meson.build | 30 ++++++++ 6 files changed, 134 insertions(+), 55 deletions(-) create mode 100644 recipes/wayland-protocols/all/test_package/meson_options.txt create mode 100644 recipes/wayland-protocols/all/test_v1_package/conanfile.py create mode 100644 recipes/wayland-protocols/all/test_v1_package/meson.build diff --git a/recipes/wayland-protocols/all/conanfile.py b/recipes/wayland-protocols/all/conanfile.py index ccf5e12a5f5b4f..9d4353094f0199 100644 --- a/recipes/wayland-protocols/all/conanfile.py +++ b/recipes/wayland-protocols/all/conanfile.py @@ -1,9 +1,13 @@ from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -from conans import Meson, tools import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class WaylandProtocolsConan(ConanFile): @@ -13,64 +17,51 @@ class WaylandProtocolsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.freedesktop.org/wayland/wayland-protocols" license = "MIT" - settings = "os", "arch", "compiler", "build_type" - _meson = None - def package_id(self): - self.info.header_only() - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + self.info.clear() def validate(self): if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Wayland-protocols can be built on Linux only") + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.build_requires("meson/0.63.0") + self.tool_requires("meson/0.63.3") + + def layout(self): + basic_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["datadir"] = os.path.join(self.package_folder, "res") + tc.project_options["tests"] = "false" + tc.generate() + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() def _patch_sources(self): - if tools.Version(self.version) <= 1.23: + if Version(self.version) <= "1.23": # fixed upstream in https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/113 - tools.replace_in_file(os.path.join(self._source_subfolder, "meson.build"), - "dep_scanner = dependency('wayland-scanner', native: true)", - "#dep_scanner = dependency('wayland-scanner', native: true)") - - def _configure_meson(self): - if not self._meson: - defs = { - "tests": "false", - } - self._meson = Meson(self) - self._meson.configure( - source_folder=self._source_subfolder, - build_folder=self._build_subfolder, - defs=defs, - args=[f'--datadir={self.package_folder}/res'], - ) - return self._meson + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "dep_scanner = dependency('wayland-scanner', native: true)", + "#dep_scanner = dependency('wayland-scanner', native: true)") def build(self): self._patch_sources() - meson = self._configure_meson() + meson = Meson(self) + meson.configure() meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) meson.install() - tools.rmdir(os.path.join(self.package_folder, "res", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "res", "pkgconfig")) def package_info(self): pkgconfig_variables = { diff --git a/recipes/wayland-protocols/all/test_package/conanfile.py b/recipes/wayland-protocols/all/test_package/conanfile.py index 88f036db9bd022..1dc365f849fd51 100644 --- a/recipes/wayland-protocols/all/test_package/conanfile.py +++ b/recipes/wayland-protocols/all/test_package/conanfile.py @@ -1,27 +1,51 @@ -from conans import Meson, tools from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "pkg_config" + test_type = "explicit" - def build_requirements(self): - self.build_requires("wayland/1.21.0") - self.build_requires("meson/0.63.0") + @property + def _has_build_profile(self): + return hasattr(self, "settings_build") def requirements(self): + self.requires(self.tested_reference_str) self.requires("wayland/1.21.0") + def build_requirements(self): + self.tool_requires("meson/0.63.3") + self.tool_requires("pkgconf/1.9.3") + self.tool_requires("wayland/1.21.0") + + def layout(self): + basic_layout(self) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["build.pkg_config_path"] = self.generators_folder + tc.project_options["has_build_profile"] = self._has_build_profile + tc.generate() + pkg_config_deps = PkgConfigDeps(self) + if self._has_build_profile: + pkg_config_deps.build_context_activated = ["wayland"] + pkg_config_deps.build_context_suffix = {"wayland": "_BUILD"} + pkg_config_deps.generate() + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + def build(self): meson = Meson(self) - env_build = tools.RunEnvironment(self) - with tools.environment_append(env_build.vars): - meson.configure() - meson.build() + meson.configure() + meson.build() def test(self): - if not cross_building(self): - self.run(os.path.join(".", "test_package"), run_environment=True) + if can_run(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/wayland-protocols/all/test_package/meson.build b/recipes/wayland-protocols/all/test_package/meson.build index fb3bbdfc775660..a79bb8c0c5c35c 100644 --- a/recipes/wayland-protocols/all/test_package/meson.build +++ b/recipes/wayland-protocols/all/test_package/meson.build @@ -4,14 +4,20 @@ wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: wayland_protocols_dep = dependency('wayland-protocols', required: true) wayland_protocols_datadir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir') -wayland_scanner = find_program('wayland-scanner') +if get_option('has_build_profile') + wayland_scanner_dep = dependency('wayland-scanner_BUILD', native: true) + wayland_scanner_for_build = find_program(wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner')) +else + wayland_scanner_for_build = find_program('wayland-scanner') +endif + wayland_scanner_code_gen = generator( - wayland_scanner, + wayland_scanner_for_build, output: '@BASENAME@-protocol.c', arguments: ['code', '@INPUT@', '@OUTPUT@'], ) wayland_scanner_client_header_gen = generator( - wayland_scanner, + wayland_scanner_for_build, output: '@BASENAME@-client-protocol.h', arguments: ['client-header', '@INPUT@', '@OUTPUT@'], ) diff --git a/recipes/wayland-protocols/all/test_package/meson_options.txt b/recipes/wayland-protocols/all/test_package/meson_options.txt new file mode 100644 index 00000000000000..15a4dceff2c0d1 --- /dev/null +++ b/recipes/wayland-protocols/all/test_package/meson_options.txt @@ -0,0 +1 @@ +option('has_build_profile', type : 'boolean', value : false) diff --git a/recipes/wayland-protocols/all/test_v1_package/conanfile.py b/recipes/wayland-protocols/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..58abdcba1c74d4 --- /dev/null +++ b/recipes/wayland-protocols/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conans import Meson, tools +from conan import ConanFile +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "pkg_config" + + def build_requirements(self): + self.build_requires("wayland/1.21.0") + self.build_requires("meson/0.63.3") + + def requirements(self): + self.requires("wayland/1.21.0") + + def build(self): + meson = Meson(self) + env_build = tools.RunEnvironment(self) + with tools.environment_append(env_build.vars): + meson.configure() + meson.build() + + def test(self): + if not cross_building(self): + self.run(os.path.join(".", "test_package"), run_environment=True) diff --git a/recipes/wayland-protocols/all/test_v1_package/meson.build b/recipes/wayland-protocols/all/test_v1_package/meson.build new file mode 100644 index 00000000000000..d1776cc1915fd7 --- /dev/null +++ b/recipes/wayland-protocols/all/test_v1_package/meson.build @@ -0,0 +1,30 @@ +project('test_wayland_protocols', 'c') + +wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: true) +wayland_protocols_dep = dependency('wayland-protocols', required: true) +wayland_protocols_datadir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir') + +wayland_scanner = find_program('wayland-scanner') +wayland_scanner_code_gen = generator( + wayland_scanner, + output: '@BASENAME@-protocol.c', + arguments: ['code', '@INPUT@', '@OUTPUT@'], +) +wayland_scanner_client_header_gen = generator( + wayland_scanner, + output: '@BASENAME@-client-protocol.h', + arguments: ['client-header', '@INPUT@', '@OUTPUT@'], +) + +xdg_shell_xml = wayland_protocols_datadir/'stable/xdg-shell/xdg-shell.xml' + +xdg_shell_sources = [ + wayland_scanner_code_gen.process(xdg_shell_xml), + wayland_scanner_client_header_gen.process(xdg_shell_xml), +] + +executable('test_package', + '../test_package/test_package.c', + xdg_shell_sources, + dependencies: [wayland_client_dep], + link_args : '-lrt') From ca6b7e7030c4daae77efddb1ad09eb383e1788cc Mon Sep 17 00:00:00 2001 From: sujankota Date: Wed, 19 Oct 2022 08:04:09 -0400 Subject: [PATCH 082/300] (#13598) opentdf-client: add version 1.3.2 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/opentdf-client/all/conandata.yml | 3 +++ recipes/opentdf-client/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/opentdf-client/all/conandata.yml b/recipes/opentdf-client/all/conandata.yml index 0cad19d535f112..9fede5e2ebc2dc 100644 --- a/recipes/opentdf-client/all/conandata.yml +++ b/recipes/opentdf-client/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.2": + url: "https://github.com/opentdf/client-cpp/archive/1.3.2.tar.gz" + sha256: "d9a38d3aa6114159c90e0c254c78ddda921e2d520851e4def57f3cd26c564b16" "1.2.0": url: "https://github.com/opentdf/client-cpp/archive/1.2.0.tar.gz" sha256: "15828038809ed291ff7881206a675abc5162e1175c8b515363b9c584aebb08f7" diff --git a/recipes/opentdf-client/config.yml b/recipes/opentdf-client/config.yml index a4bdd24b34b436..37ebecaa11ef68 100644 --- a/recipes/opentdf-client/config.yml +++ b/recipes/opentdf-client/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.2": + folder: all "1.2.0": folder: all "1.1.6": From 5253b77d58deb856ec92ad01bf84fb682035d170 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 19 Oct 2022 16:05:02 +0200 Subject: [PATCH 083/300] (#13597) zlib: fix lib name on windows for other compilers than msvc/clang-cl/mingw * fix lib name on windows if not cl like or mingw * modernize a little bit more --- recipes/zlib/all/conanfile.py | 27 ++++++++++--------- .../all/patches/1.2.13/0001-Fix-cmake.patch | 2 +- .../all/patches/1.2.x/0001-fix-cmake.patch | 2 +- recipes/zlib/all/test_package/conanfile.py | 7 ++--- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/recipes/zlib/all/conanfile.py b/recipes/zlib/all/conanfile.py index 74c193ad9cba7c..9ae111c632353c 100644 --- a/recipes/zlib/all/conanfile.py +++ b/recipes/zlib/all/conanfile.py @@ -1,11 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, load, replace_in_file, save -from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, load, replace_in_file, save from conan.tools.scm import Version import os -required_conan_version = ">=1.49.0" +required_conan_version = ">=1.52.0" class ZlibConan(ConanFile): @@ -28,12 +27,11 @@ class ZlibConan(ConanFile): } @property - def _is_clang_cl(self): - return self.settings.os == "Windows" and self.settings.compiler == "clang" + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -41,15 +39,18 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: - del self.settings.compiler.libcxx + del self.settings.compiler.libcxx except Exception: - pass + pass try: - del self.settings.compiler.cppstd + del self.settings.compiler.cppstd except Exception: - pass + pass def layout(self): cmake_layout(self, src_folder="src") @@ -103,7 +104,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "ZLIB") self.cpp_info.set_property("cmake_target_name", "ZLIB::ZLIB") self.cpp_info.set_property("pkg_config_name", "zlib") - if is_msvc(self) or self._is_clang_cl: + if self.settings.os == "Windows" and not self._is_mingw: libname = "zdll" if self.options.shared else "zlib" else: libname = "z" diff --git a/recipes/zlib/all/patches/1.2.13/0001-Fix-cmake.patch b/recipes/zlib/all/patches/1.2.13/0001-Fix-cmake.patch index ede4babb2e94c0..a0748ec590d905 100644 --- a/recipes/zlib/all/patches/1.2.13/0001-Fix-cmake.patch +++ b/recipes/zlib/all/patches/1.2.13/0001-Fix-cmake.patch @@ -75,7 +75,7 @@ index b412dc7..a5284ed 100644 endif() -if(UNIX) -+if(MSVC) ++if(WIN32 AND NOT MINGW) + if(BUILD_SHARED_LIBS) + set_target_properties(zlib PROPERTIES ARCHIVE_OUTPUT_NAME zdll) + endif() diff --git a/recipes/zlib/all/patches/1.2.x/0001-fix-cmake.patch b/recipes/zlib/all/patches/1.2.x/0001-fix-cmake.patch index 9a3627d41b04c5..f99f0b52196825 100644 --- a/recipes/zlib/all/patches/1.2.x/0001-fix-cmake.patch +++ b/recipes/zlib/all/patches/1.2.x/0001-fix-cmake.patch @@ -64,7 +64,7 @@ endif() -if(UNIX) -+if(MSVC) ++if(WIN32 AND NOT MINGW) + if(BUILD_SHARED_LIBS) + set_target_properties(zlib PROPERTIES ARCHIVE_OUTPUT_NAME zdll) + endif() diff --git a/recipes/zlib/all/test_package/conanfile.py b/recipes/zlib/all/test_package/conanfile.py index d120a992c06a69..0a6bc68712d901 100644 --- a/recipes/zlib/all/test_package/conanfile.py +++ b/recipes/zlib/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() From 5c33ec9fe0f9beb29bd372dd7517e7c35db03257 Mon Sep 17 00:00:00 2001 From: tuduongquyet <78657396+tuduongquyet@users.noreply.github.com> Date: Wed, 19 Oct 2022 22:44:39 +0700 Subject: [PATCH 084/300] (#11877) add marisa/0.2.6 recipe * add marisa recipe * fix patch * add le * add le * remove pc file * Update recipes/marisa/all/conanfile.py Co-authored-by: Chris Mc Co-authored-by: Chris Mc --- recipes/marisa/all/CMakeLists.txt | 7 + recipes/marisa/all/conandata.yml | 8 ++ recipes/marisa/all/conanfile.py | 87 +++++++++++++ .../marisa/all/patches/0001-add-cmake.patch | 120 ++++++++++++++++++ .../marisa/all/test_package/CMakeLists.txt | 10 ++ recipes/marisa/all/test_package/conanfile.py | 18 +++ .../marisa/all/test_package/test_package.cpp | 12 ++ recipes/marisa/config.yml | 3 + 8 files changed, 265 insertions(+) create mode 100644 recipes/marisa/all/CMakeLists.txt create mode 100644 recipes/marisa/all/conandata.yml create mode 100644 recipes/marisa/all/conanfile.py create mode 100644 recipes/marisa/all/patches/0001-add-cmake.patch create mode 100644 recipes/marisa/all/test_package/CMakeLists.txt create mode 100644 recipes/marisa/all/test_package/conanfile.py create mode 100644 recipes/marisa/all/test_package/test_package.cpp create mode 100644 recipes/marisa/config.yml diff --git a/recipes/marisa/all/CMakeLists.txt b/recipes/marisa/all/CMakeLists.txt new file mode 100644 index 00000000000000..84887fbda2ddf1 --- /dev/null +++ b/recipes/marisa/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup(KEEP_RPATHS) + +add_subdirectory(source_subfolder) diff --git a/recipes/marisa/all/conandata.yml b/recipes/marisa/all/conandata.yml new file mode 100644 index 00000000000000..087e45138b4998 --- /dev/null +++ b/recipes/marisa/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "0.2.6": + url: "https://github.com/s-yata/marisa-trie/archive/refs/tags/v0.2.6.tar.gz" + sha256: "1063a27c789e75afa2ee6f1716cc6a5486631dcfcb7f4d56d6485d2462e566de" +patches: + "0.2.6": + - patch_file: "patches/0001-add-cmake.patch" + base_path: "source_subfolder" diff --git a/recipes/marisa/all/conanfile.py b/recipes/marisa/all/conanfile.py new file mode 100644 index 00000000000000..13b534d613bd93 --- /dev/null +++ b/recipes/marisa/all/conanfile.py @@ -0,0 +1,87 @@ +import os +from conan import ConanFile, tools +from conan.tools.files import apply_conandata_patches +from conans import CMake + +required_conan_version = ">=1.45.0" + + +class MarisaConan(ConanFile): + name = "marisa" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/s-yata/marisa-trie" + description = "Matching Algorithm with Recursively Implemented StorAge " + license = ("BSD-2-Clause", "LGPL-2.1") + topics = ("algorithm", "dictionary", "marisa") + exports_sources = "patches/**", "CMakeLists.txt" + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "tools": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "tools": True, + } + + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def source(self): + tools.files.get(**self.conan_data["sources"][self.version], + conanfile=self, destination=self._source_subfolder, strip_root=True) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + + self._cmake.definitions["BUILD_TOOLS"] = self.options.tools + + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def build(self): + apply_conandata_patches(self) + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy(pattern="COPYING.md", dst="licenses", + src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.files.rmdir(self, os.path.join( + self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "marisa" + self.cpp_info.names["cmake_find_package_multi"] = "marisa" + self.cpp_info.names["pkgconfig"] = "marisa" + self.cpp_info.libs = ["marisa"] + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["m"] + + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH env var with : '{bin_path}'") + self.env_info.PATH.append(bin_path) diff --git a/recipes/marisa/all/patches/0001-add-cmake.patch b/recipes/marisa/all/patches/0001-add-cmake.patch new file mode 100644 index 00000000000000..4635c52208c27a --- /dev/null +++ b/recipes/marisa/all/patches/0001-add-cmake.patch @@ -0,0 +1,120 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..c7e4c0e +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,114 @@ ++cmake_minimum_required(VERSION 3.1) ++project(marisa CXX) ++ ++include(GNUInstallDirs) ++ ++option(BUILD_SHARED_LIBS "Build as shared library" OFF) ++option(BUILD_TOOLS "Build tools" ON) ++option(ENABLE_TESTS "Build and run tests" ON) ++ ++if(BUILD_SHARED_LIBS) ++ set(MARISA_LIBRARY_TYPE SHARED) ++else() ++ set(MARISA_LIBRARY_TYPE STATIC) ++endif(BUILD_SHARED_LIBS) ++ ++set(CMAKE_CXX_STANDARD 11) ++ ++if(NOT CMAKE_BUILD_TYPE) ++ set(CMAKE_BUILD_TYPE Debug) ++endif() ++ ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") ++ ++if(NOT MSVC) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++ -Wextra -Wconversion") ++endif() ++ ++if(BUILD_SHARED_LIBS AND MSVC) ++ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++endif() ++ ++include_directories("${PROJECT_SOURCE_DIR}/include") ++include_directories("${PROJECT_SOURCE_DIR}/lib") ++ ++set(HDR_COMPAT ++ include/marisa.h) ++ ++set(HDR_PUBLIC ++ include/marisa/agent.h ++ include/marisa/base.h ++ include/marisa/exception.h ++ include/marisa/iostream.h ++ include/marisa/key.h ++ include/marisa/keyset.h ++ include/marisa/query.h ++ include/marisa/scoped-array.h ++ include/marisa/scoped-ptr.h ++ include/marisa/stdio.h ++ include/marisa/trie.h) ++add_library(marisa ${MARISA_LIBRARY_TYPE} ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/io/mapper.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/io/reader.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/io/writer.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/trie/tail.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/trie/louds-trie.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/vector/bit-vector.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/keyset.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/trie.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/agent.cc") ++ ++install(TARGETS marisa ++ RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ ++if(BUILD_TOOLS) ++ add_library(cmdopt OBJECT "${PROJECT_SOURCE_DIR}/tools/cmdopt.cc") ++ set(TOOLS ++ marisa-benchmark ++ marisa-build ++ marisa-common-prefix-search ++ marisa-dump ++ marisa-lookup ++ marisa-predictive-search ++ marisa-reverse-lookup ++ ) ++ ++ foreach(TOOL ${TOOLS}) ++ add_executable(${TOOL} "${PROJECT_SOURCE_DIR}/tools/${TOOL}.cc") ++ target_link_libraries(${TOOL} PRIVATE marisa cmdopt) ++ install(TARGETS ${TOOL} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) ++ endforeach(TOOL) ++endif() ++ ++if(ENABLE_TESTS) ++ enable_testing() ++ set(TESTS ++ base-test ++ io-test ++ trie-test ++ vector-test ++ marisa-test ++ ) ++ ++ foreach(TEST ${TESTS}) ++ add_executable(${TEST} "${PROJECT_SOURCE_DIR}/tests/${TEST}.cc") ++ target_link_libraries(${TEST} PRIVATE marisa) ++ add_test(${TEST} ${TEST}) ++ endforeach(TEST) ++endif() ++ ++configure_file( ++ ${PROJECT_SOURCE_DIR}/marisa.pc.in ++ ${PROJECT_BINARY_DIR}/marisa.pc ++ @ONLY) ++install(FILES ${PROJECT_BINARY_DIR}/marisa.pc ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++ ++install(FILES ${HDR_COMPAT} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++ ++install(FILES ${HDR_PUBLIC} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/marisa) diff --git a/recipes/marisa/all/test_package/CMakeLists.txt b/recipes/marisa/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..9bae1c0958b767 --- /dev/null +++ b/recipes/marisa/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(marisa REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} marisa::marisa) diff --git a/recipes/marisa/all/test_package/conanfile.py b/recipes/marisa/all/test_package/conanfile.py new file mode 100644 index 00000000000000..251bf8ae3e3ddc --- /dev/null +++ b/recipes/marisa/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +import os +from conans import CMake, ConanFile, tools +from conan.tools.build import cross_building + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/marisa/all/test_package/test_package.cpp b/recipes/marisa/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..ba90951dd5e1b0 --- /dev/null +++ b/recipes/marisa/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include "marisa.h" + + +int main() { + int x = 100; + int y = 200; + + marisa::swap(x, y); + + return EXIT_SUCCESS; +} diff --git a/recipes/marisa/config.yml b/recipes/marisa/config.yml new file mode 100644 index 00000000000000..070a32463b25e0 --- /dev/null +++ b/recipes/marisa/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.6": + folder: all From ba368057edf9a82b3d1a136bccbea560fca5a010 Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 20 Oct 2022 01:06:20 +0900 Subject: [PATCH 085/300] (#13196) usockets: add version 0.8.2 and support conan v2 * usockets: add version 0.8.2 and support conan v2 * fix import error * fix msbuild error * use require when eventloop == boost * revert conanfile.py * fix ConanInvalidConfiguration path * remove lto * apply msvc patch in 0.8.2 * apply reviews * fix for conan v2 linter * fix cross_building condition --- recipes/usockets/all/conandata.yml | 62 +++++--- recipes/usockets/all/conanfile.py | 133 +++++++++--------- .../all/patches/0001-makefile_0.8.2.patch | 39 +++++ .../usockets/all/test_package/CMakeLists.txt | 11 +- .../usockets/all/test_package/conanfile.py | 10 +- recipes/usockets/config.yml | 8 +- 6 files changed, 168 insertions(+), 95 deletions(-) create mode 100644 recipes/usockets/all/patches/0001-makefile_0.8.2.patch diff --git a/recipes/usockets/all/conandata.yml b/recipes/usockets/all/conandata.yml index 6134ecad920ae4..c851ea9d76dea5 100644 --- a/recipes/usockets/all/conandata.yml +++ b/recipes/usockets/all/conandata.yml @@ -1,34 +1,62 @@ sources: - "0.4.0": - url: "https://github.com/uNetworking/uSockets/archive/v0.4.0.tar.gz" - sha256: "f9f15b395def578cc79a5b32abc64fa9cff5dac873062911f515b984b90f7cc2" - "0.6.0": - url: "https://github.com/uNetworking/uSockets/archive/v0.6.0.tar.gz" - sha256: "999387d3653b2bc663c34aa7e973358ac4c4897dccd644553a5caab843a978a1" - "0.7.1": - url: "https://github.com/uNetworking/uSockets/archive/v0.7.1.tar.gz" - sha256: "1fdc5376e5ef9acf4fb673fcd5fd191da9b8d59a319e9ec7922872070a3dd21c" + "0.8.2": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.2.tar.gz" + sha256: "c17fc99773a30552cdd7741ff98af177eeecb26b89fc38011b430956b3b2eca5" "0.8.1": url: "https://github.com/uNetworking/uSockets/archive/v0.8.1.tar.gz" sha256: "3b33b5924a92577854e2326b3e2d393849ec00beb865a1271bf24c0f210cc1d6" -patches: + "0.7.1": + url: "https://github.com/uNetworking/uSockets/archive/v0.7.1.tar.gz" + sha256: "1fdc5376e5ef9acf4fb673fcd5fd191da9b8d59a319e9ec7922872070a3dd21c" + "0.6.0": + url: "https://github.com/uNetworking/uSockets/archive/v0.6.0.tar.gz" + sha256: "999387d3653b2bc663c34aa7e973358ac4c4897dccd644553a5caab843a978a1" "0.4.0": - - patch_file: "patches/0001-makefile.patch" + url: "https://github.com/uNetworking/uSockets/archive/v0.4.0.tar.gz" + sha256: "f9f15b395def578cc79a5b32abc64fa9cff5dac873062911f515b984b90f7cc2" +patches: + "0.8.2": + - patch_file: "patches/0001-makefile_0.8.2.patch" base_path: "source_subfolder" - - patch_file: "patches/0002-vcxproj.patch" + patch_description: "remove lto options" + patch_type: "portability" + - patch_file: "patches/0002-vcxproj_0.8.1.patch" base_path: "source_subfolder" - "0.6.0": + patch_description: "build static library" + patch_type: "conan" + "0.8.1": + - patch_file: "patches/0001-makefile_0.8.1.patch" + base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" + - patch_file: "patches/0002-vcxproj_0.8.1.patch" + base_path: "source_subfolder" + patch_description: "build static library" + patch_type: "conan" + "0.7.1": - patch_file: "patches/0001-makefile_0.6.0.patch" base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" - patch_file: "patches/0002-vcxproj.patch" base_path: "source_subfolder" - "0.7.1": + patch_description: "build static library" + patch_type: "conan" + "0.6.0": - patch_file: "patches/0001-makefile_0.6.0.patch" base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" - patch_file: "patches/0002-vcxproj.patch" base_path: "source_subfolder" - "0.8.1": - - patch_file: "patches/0001-makefile_0.8.1.patch" + patch_description: "build static library" + patch_type: "conan" + "0.4.0": + - patch_file: "patches/0001-makefile.patch" base_path: "source_subfolder" - - patch_file: "patches/0002-vcxproj_0.8.1.patch" + patch_description: "remove lto options" + patch_type: "portability" + - patch_file: "patches/0002-vcxproj.patch" base_path: "source_subfolder" + patch_description: "build static library" + patch_type: "conan" diff --git a/recipes/usockets/all/conanfile.py b/recipes/usockets/all/conanfile.py index 21f31328b479e0..9e34c8b2bca1ce 100644 --- a/recipes/usockets/all/conanfile.py +++ b/recipes/usockets/all/conanfile.py @@ -1,35 +1,44 @@ -import os +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, chdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +from conans import MSBuild, AutoToolsBuildEnvironment -from conans import ConanFile, tools, MSBuild, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +import os +required_conan_version = ">=1.52.0" class UsocketsConan(ConanFile): name = "usockets" - url = "https://github.com/conan-io/conan-center-index" description = "Miniscule cross-platform eventing, networking & crypto for async applications" license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/uNetworking/uSockets" - topics = ("conan", "socket", "network", "web") + topics = ("socket", "network", "web") settings = "os", "arch", "compiler", "build_type" - options = {"fPIC": [True, False], - "with_ssl": [False, "openssl", "wolfssl"], - "with_libuv": [True, False, "deprecated"], - "eventloop": ["syscall", "libuv", "gcd", "boost"]} - default_options = {"fPIC": True, - "with_ssl": False, - "with_libuv": "deprecated", - "eventloop": "syscall"} - exports_sources = "patches/**" + options = { + "fPIC": [True, False], + "with_ssl": [False, "openssl", "wolfssl"], + "eventloop": ["syscall", "libuv", "gcd", "boost"], + } + default_options = { + "fPIC": True, + "with_ssl": False, + "eventloop": "syscall", + } @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + version = False + if self.options.eventloop == "boost": + version = "14" - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - self.options.eventloop = "libuv" + # OpenSSL wrapper of uSockets uses C++17 features. + if self.options.with_ssl == "openssl": + version = "17" + + return version def _minimum_compilers_version(self, cppstd): standards = { @@ -49,61 +58,57 @@ def _minimum_compilers_version(self, cppstd): return standards.get(cppstd) or {} @property - def _cppstd(self): - version = False - if self.options.eventloop == "boost": - version = "14" + def _source_subfolder(self): + return "source_subfolder" - # OpenSSL wrapper of uSockets uses C++17 features. - if self.options.with_ssl == "openssl": - version = "17" + def export_sources(self): + export_conandata_patches(self) - return version + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + self.options.eventloop = "libuv" def validate(self): - if self.options.eventloop == "syscall" and self.settings.os == "Windows": + if self.options.eventloop == "syscall" and self.info.settings.os == "Windows": raise ConanInvalidConfiguration("syscall is not supported on Windows") - if self.options.eventloop == "gcd" and (self.settings.os != "Linux" or self.settings.compiler != "clang"): + if self.options.eventloop == "gcd" and (self.info.settings.os != "Linux" or self.info.settings.compiler != "clang"): raise ConanInvalidConfiguration("eventloop=gcd is only supported on Linux with clang") - if tools.Version(self.version) < "0.8.0" and self.options.eventloop not in ("syscall", "libuv", "gcd"): + if Version(self.version) < "0.8.0" and self.options.eventloop not in ("syscall", "libuv", "gcd"): raise ConanInvalidConfiguration(f"eventloop={self.options.eventloop} is not supported with {self.name}/{self.version}") - if tools.Version(self.version) >= "0.5.0" and self.options.with_ssl == "wolfssl": + if Version(self.version) >= "0.5.0" and self.options.with_ssl == "wolfssl": raise ConanInvalidConfiguration(f"with_ssl={self.options.with_ssl} is not supported with {self.name}/{self.version}. https://github.com/uNetworking/uSockets/issues/147") if self.options.with_ssl == "wolfssl" and not self.options["wolfssl"].opensslextra: raise ConanInvalidConfiguration("wolfssl needs opensslextra option enabled for usockets") - if not self.options.with_libuv and self.settings.os == "Windows": - raise ConanInvalidConfiguration("uSockets in Windows uses libuv by default. After 0.8.0, you can choose boost.asio by eventloop=boost.") - - cppstd = self._cppstd + cppstd = self._minimum_cpp_standard if not cppstd: return - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, cppstd) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, cppstd) - minimum_version = self._minimum_compilers_version(cppstd).get(str(self.settings.compiler), False) + minimum_version = self._minimum_compilers_version(cppstd).get(str(self.info.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: + if Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("{} requires C++{}, which your compiler does not support.".format(self.name, cppstd)) else: self.output.warn("{0} requires C++{1}. Your compiler is unknown. Assuming it supports C++{1}.".format(self.name, cppstd)) def configure(self): - if bool(self._cppstd) == False: - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - - if self.options.with_libuv != "deprecated": - self.output.warn("with_libuv is deprecated, use 'eventloop' instead.") - if self.options.with_libuv == True: - self.options.eventloop = "libuv" - else: - self.options.eventloop = "syscall" + if bool(self._minimum_cpp_standard) == False: + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def requirements(self): if self.options.with_ssl == "openssl": @@ -116,25 +121,23 @@ def requirements(self): elif self.options.eventloop == "gcd": self.requires("libdispatch/5.3.2") elif self.options.eventloop == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("uSockets-%s" % self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + apply_conandata_patches(self) def _build_msvc(self): - with tools.chdir(os.path.join(self._source_subfolder)): + with chdir(self, os.path.join(self._source_subfolder)): msbuild = MSBuild(self) msbuild.build(project_file="uSockets.vcxproj", platforms={"x86": "Win32"}) def _build_configure(self): autotools = AutoToolsBuildEnvironment(self) autotools.fpic = self.options.get_safe("fPIC", False) - with tools.chdir(self._source_subfolder): + with chdir(self, self._source_subfolder): args = [] if self.options.with_ssl == "openssl": args.append("WITH_OPENSSL=1") @@ -148,7 +151,7 @@ def _build_configure(self): elif self.options.eventloop == "boost": args.append("WITH_ASIO=1") - args.extend("{}={}".format(key, value) for key, value in autotools.vars.items()) + args.extend(f"{key}={value}" for key, value in autotools.vars.items()) autotools.make(target="default", args=args) def build(self): @@ -159,16 +162,12 @@ def build(self): self._build_configure() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", src=os.path.join(self._source_subfolder, "src"), dst="include", keep_path=True) - self.copy(pattern="*.a", src=self._source_subfolder, dst="lib", keep_path=False) - self.copy(pattern="*.lib", src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._source_subfolder) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._source_subfolder, "src"), keep_path=True) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self._source_subfolder, keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self._source_subfolder, keep_path=False) # drop internal headers - tools.rmdir(os.path.join(self.package_folder, "include", "internal")) - - def package_id(self): - # Deprecated options - del self.info.options.with_libuv + rmdir(self, os.path.join(self.package_folder, "include", "internal")) def package_info(self): self.cpp_info.libs = ["uSockets"] diff --git a/recipes/usockets/all/patches/0001-makefile_0.8.2.patch b/recipes/usockets/all/patches/0001-makefile_0.8.2.patch new file mode 100644 index 00000000000000..aafe333e3b357c --- /dev/null +++ b/recipes/usockets/all/patches/0001-makefile_0.8.2.patch @@ -0,0 +1,39 @@ +diff --git a/Makefile b/Makefile +index 8bf11b3..9577ee7 100644 +--- a/Makefile ++++ b/Makefile +@@ -58,20 +58,20 @@ endif + # By default we build the uSockets.a static library + default: + rm -f *.o +- $(CC) $(CFLAGS) -flto -O3 -c src/*.c src/eventing/*.c src/crypto/*.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) -O3 -c src/*.c src/eventing/*.c src/crypto/*.c + # Also link in Boost Asio support + ifeq ($(WITH_ASIO),1) +- $(CXX) $(CXXFLAGS) -Isrc -std=c++14 -flto -O3 -c src/eventing/asio.cpp ++ $(CXX) $(CXXFLAGS) -Isrc -std=c++14 $(CPPFLAGS) -O3 -c src/eventing/asio.cpp + endif + + # For now we do rely on C++17 for OpenSSL support but we will be porting this work to C11 + ifeq ($(WITH_OPENSSL),1) +- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp ++ $(CXX) $(CXXFLAGS) -std=c++17 $(CPPFLAGS) -O3 -c src/crypto/*.cpp + endif + ifeq ($(WITH_BORINGSSL),1) +- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp ++ $(CXX) $(CXXFLAGS) -std=c++17 $(CPPFLAGS) -O3 -c src/crypto/*.cpp + endif +- $(AR) rvs uSockets.a *.o ++ $(AR) rvs libuSockets.a *.o + + # BoringSSL needs cmake and golang + .PHONY: boringssl +@@ -81,7 +81,7 @@ boringssl: + # Builds all examples + .PHONY: examples + examples: default +- for f in examples/*.c; do $(CC) -flto -O3 $(CFLAGS) -o $$(basename "$$f" ".c") "$$f" $(LDFLAGS); done ++ for f in examples/*.c; do $(CC) $(CPPFLAGS) -O3 $(CFLAGS) -o $$(basename "$$f" ".c") "$$f" $(LDFLAGS); done + + swift_examples: + swiftc -O -I . examples/swift_http_server/main.swift uSockets.a -o swift_http_server diff --git a/recipes/usockets/all/test_package/CMakeLists.txt b/recipes/usockets/all/test_package/CMakeLists.txt index 196188113685c8..8502a8260d7cec 100644 --- a/recipes/usockets/all/test_package/CMakeLists.txt +++ b/recipes/usockets/all/test_package/CMakeLists.txt @@ -1,8 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) + +find_package(usockets REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE usockets::usockets) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/usockets/all/test_package/conanfile.py b/recipes/usockets/all/test_package/conanfile.py index bd7165a553cf41..7895db93c24a6e 100644 --- a/recipes/usockets/all/test_package/conanfile.py +++ b/recipes/usockets/all/test_package/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) @@ -12,6 +14,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/usockets/config.yml b/recipes/usockets/config.yml index ed051b80517fba..76b81d9ebd6902 100644 --- a/recipes/usockets/config.yml +++ b/recipes/usockets/config.yml @@ -1,9 +1,11 @@ versions: - "0.4.0": + "0.8.2": folder: all - "0.6.0": + "0.8.1": folder: all "0.7.1": folder: all - "0.8.1": + "0.6.0": + folder: all + "0.4.0": folder: all From fdba1998257b2089b0b0f869a772f211cfbc2485 Mon Sep 17 00:00:00 2001 From: cguentherTUChemnitz Date: Wed, 19 Oct 2022 18:25:18 +0200 Subject: [PATCH 086/300] (#13582) onetbb: Android: workaround for current AndroidNDK builds * onetbb: Android: fix current AndroidNDK builds by patching away the leading emptyspace entry in generated ^Cags.make and link.txt * go for upstream patch backporting * Update recipes/onetbb/all/conanfile.py Co-authored-by: Chris Mc * review-change: update conan version requirement, providing export_conandata_patches Co-authored-by: Chris Mc --- recipes/onetbb/all/conandata.yml | 11 +++++++++++ recipes/onetbb/all/conanfile.py | 8 ++++++-- .../fix-overeager-stripping-of-compile-flag.diff | 13 +++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 recipes/onetbb/all/patches/fix-overeager-stripping-of-compile-flag.diff diff --git a/recipes/onetbb/all/conandata.yml b/recipes/onetbb/all/conandata.yml index 82844371591768..1e589ce6c49484 100644 --- a/recipes/onetbb/all/conandata.yml +++ b/recipes/onetbb/all/conandata.yml @@ -5,3 +5,14 @@ sources: "2021.3.0": url: "https://github.com/oneapi-src/oneTBB/archive/v2021.3.0.tar.gz" sha256: "8f616561603695bbb83871875d2c6051ea28f8187dbe59299961369904d1d49e" +patches: + "2021.6.0": + - patch_description: "cherry-pick upstream patch: avoid android compile errors for current NDKs on releases <= 2021.6.0" + patch_type: "backport" + patch_source: "https://github.com/oneapi-src/oneTBB/pull/716.diff" + patch_file: "patches/fix-overeager-stripping-of-compile-flag.diff" + "2021.3.0": + - patch_description: "cherry-pick upstream patch: avoid android compile errors for current NDKs on releases <= 2021.6.0" + patch_type: "backport" + patch_source: "https://github.com/oneapi-src/oneTBB/pull/716.diff" + patch_file: "patches/fix-overeager-stripping-of-compile-flag.diff" diff --git a/recipes/onetbb/all/conanfile.py b/recipes/onetbb/all/conanfile.py index c0f1359419b8c5..240acbbc36f0d4 100644 --- a/recipes/onetbb/all/conanfile.py +++ b/recipes/onetbb/all/conanfile.py @@ -2,12 +2,12 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import copy, get, load, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, load, rmdir from conan.tools.scm import Version import os import re -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class OneTBBConan(ConanFile): @@ -46,6 +46,9 @@ def config_options(self): del self.options.shared del self.options.fPIC + def export_sources(self): + export_conandata_patches(self) + def configure(self): if self.options.get_safe("shared", True): del self.options.fPIC @@ -97,6 +100,7 @@ def generate(self): toolchain.generate() def build(self): + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() diff --git a/recipes/onetbb/all/patches/fix-overeager-stripping-of-compile-flag.diff b/recipes/onetbb/all/patches/fix-overeager-stripping-of-compile-flag.diff new file mode 100644 index 00000000000000..914764c6a369d6 --- /dev/null +++ b/recipes/onetbb/all/patches/fix-overeager-stripping-of-compile-flag.diff @@ -0,0 +1,13 @@ +diff --git a/cmake/utils.cmake b/cmake/utils.cmake +index f74abfcf9..a090bacbb 100644 +--- a/cmake/utils.cmake ++++ b/cmake/utils.cmake +@@ -18,7 +18,7 @@ macro(tbb_remove_compile_flag flag) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_OPTIONS ${_tbb_compile_options}) + unset(_tbb_compile_options) + if (CMAKE_CXX_FLAGS) +- string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) ++ string(REGEX REPLACE "(^|[ \t\r\n]+)${flag}($|[ \t\r\n]+)" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + endif() + endmacro() + From c7c4025ff4e19459311015cfeaa21c14dd56f022 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Wed, 19 Oct 2022 18:45:00 +0200 Subject: [PATCH 087/300] (#13595) add xtrans/system * add xtrans/system * Update conanfile.py * Update conanfile.py * Update recipes/xtrans/all/test_package/conanfile.py Co-authored-by: Jordan Williams Co-authored-by: Jordan Williams --- recipes/xtrans/all/conanfile.py | 51 +++++++++++++++++++ recipes/xtrans/all/test_package/conanfile.py | 25 +++++++++ .../xtrans/all/test_v1_package/conanfile.py | 13 +++++ recipes/xtrans/config.yml | 3 ++ 4 files changed, 92 insertions(+) create mode 100644 recipes/xtrans/all/conanfile.py create mode 100644 recipes/xtrans/all/test_package/conanfile.py create mode 100644 recipes/xtrans/all/test_v1_package/conanfile.py create mode 100644 recipes/xtrans/config.yml diff --git a/recipes/xtrans/all/conanfile.py b/recipes/xtrans/all/conanfile.py new file mode 100644 index 00000000000000..a420c87bd7d015 --- /dev/null +++ b/recipes/xtrans/all/conanfile.py @@ -0,0 +1,51 @@ +from conan import ConanFile +from conan.tools.gnu import PkgConfig +from conan.tools.system import package_manager +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.47" + + +class XtransConan(ConanFile): + name = "xtrans" + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + homepage = "https://www.x.org/wiki/" + description = "X Network Transport layer shared code" + settings = "os", "compiler", "build_type" # no arch here, because the xtrans system package is arch independant + topics = ("x11", "xorg") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") + + def package_id(self): + self.info.header_only() + + def system_requirements(self): + apt = package_manager.Apt(self) + apt.install(["xtrans-dev"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["xorg-x11-xtrans-devel"], update=True, check=True) + + dnf = package_manager.Dnf(self) + dnf.install(["xorg-x11-xtrans-devel"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["xtrans"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["xtrans"], update=True, check=True) + + package_manager.Pkg(self).install(["xtrans"], update=True, check=True) + + def package_info(self): + pkg_config = PkgConfig(self, "xtrans") + pkg_config.fill_cpp_info( + self.cpp_info, is_system=self.settings.os != "FreeBSD") + self.cpp_info.version = pkg_config.version + self.cpp_info.set_property("pkg_config_name", "xtrans") + self.cpp_info.set_property("component_version", pkg_config.version) + self.cpp_info.set_property("pkg_config_custom_content", + "\n".join(f"{key}={value}" for key, value in pkg_config.variables.items() if key not in ["pcfiledir","prefix", "includedir"])) diff --git a/recipes/xtrans/all/test_package/conanfile.py b/recipes/xtrans/all/test_package/conanfile.py new file mode 100644 index 00000000000000..1b04b27a310a78 --- /dev/null +++ b/recipes/xtrans/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + basic_layout(self) + + def generate(self): + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + + def build(self): + pass + + def test(self): + pkg_config = self.conf_info.get("tools.gnu:pkg_config", default="pkg-config") + self.run(f"{pkg_config} --validate xtrans") diff --git a/recipes/xtrans/all/test_v1_package/conanfile.py b/recipes/xtrans/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c20eb932e465e3 --- /dev/null +++ b/recipes/xtrans/all/test_v1_package/conanfile.py @@ -0,0 +1,13 @@ +from conans import ConanFile +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "pkg_config" + + def build(self): + pass + + def test(self): + self.run("pkg-config --validate ./xtrans.pc") diff --git a/recipes/xtrans/config.yml b/recipes/xtrans/config.yml new file mode 100644 index 00000000000000..76a338dd54ceec --- /dev/null +++ b/recipes/xtrans/config.yml @@ -0,0 +1,3 @@ +versions: + "system": + folder: "all" From 842c55bbf1fe733aed598663b13a68cf2bb01b8d Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Wed, 19 Oct 2022 10:05:35 -0700 Subject: [PATCH 088/300] (#13490) docs: v2 migration guidence for `conf_info` * docs: v2 migration guidence for `conf_info` * Update docs/v2_migration.md Co-authored-by: Jordan Williams * example + notes about why to avoid it Co-authored-by: Jordan Williams --- docs/v2_migration.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/docs/v2_migration.md b/docs/v2_migration.md index 700c20b79ae13c..f14a69ce855cc0 100644 --- a/docs/v2_migration.md +++ b/docs/v2_migration.md @@ -54,6 +54,39 @@ When different build tools are use, at least one layout needs to be set. The `src_folder` must be the same when using different layouts and should not depend on settings or options. +## New conf_info properties + +As described in the documentation `self.user_info` has been depreated and you are now required to use +`self.conf_info` to define individual properties to expose to downstream recipes. +The [2.0 migrations docs](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#removed-self-user-info) +should cover the technical details, however for ConanCenterIndex we need to make sure there are no collisions +`conf_info` must be named `user.:`. + +For usage options of `conf_info`, the [documenation](https://docs.conan.io/en/latest/reference/config_files/global_conf.html?highlight=conf_info#configuration-in-your-recipes) + +In ConanCenterIndex this will typically looks like: + +- defining a value + ```py + def package_info(self): + tool_path = os.path.join(self.package_folder, "bin", "tool") + self.conf_info.define("user.pkg:tool", tool_path) + ``` +- using a value + ```py + #generators = "VirtualBuildEnv", "VirtualRunEnv" + + def build_requirements(self): + self.tool_requires("tool/0.1") + + def build(self): + tool_path = self.conf_info.get("user.pkg:tool") + self.run(f"{tool_path} --build") + ``` +> **Note**: This should only be used when absolutely required. In the vast majority of cases, the new +> ["Environments"](https://docs.conan.io/en/latest/reference/conanfile/tools/env/environment.html?highlight=Virtual) +> will include the `self.cpp_info.bindirs` which will provide access to the tools in the correct scopes. + ## New cpp_info set_property model New Conan generators like From 3d29d5da2304e22c09b8244dab5d970191e3bbac Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 19 Oct 2022 19:25:11 +0200 Subject: [PATCH 089/300] (#13603) [docs] Add Meson template * Add Meson template Signed-off-by: Uilian Ries * Use only meson Signed-off-by: Uilian Ries * Use only one meson file Signed-off-by: Uilian Ries * rename test package Signed-off-by: Uilian Ries * install pkgconf Signed-off-by: Uilian Ries * Fix tool_requires Signed-off-by: Uilian Ries Signed-off-by: Uilian Ries --- docs/package_templates/README.md | 4 + .../meson_package/all/conandata.yml | 27 +++ .../meson_package/all/conanfile.py | 164 ++++++++++++++++++ .../all/test_package/conanfile.py | 34 ++++ .../all/test_package/meson.build | 5 + .../all/test_package/test_package.cpp | 18 ++ .../all/test_v1_package/conanfile.py | 24 +++ .../meson_package/config.yml | 6 + 8 files changed, 282 insertions(+) create mode 100644 docs/package_templates/meson_package/all/conandata.yml create mode 100644 docs/package_templates/meson_package/all/conanfile.py create mode 100644 docs/package_templates/meson_package/all/test_package/conanfile.py create mode 100644 docs/package_templates/meson_package/all/test_package/meson.build create mode 100644 docs/package_templates/meson_package/all/test_package/test_package.cpp create mode 100644 docs/package_templates/meson_package/all/test_v1_package/conanfile.py create mode 100644 docs/package_templates/meson_package/config.yml diff --git a/docs/package_templates/README.md b/docs/package_templates/README.md index 635023cac662c4..76d696e57b0a06 100644 --- a/docs/package_templates/README.md +++ b/docs/package_templates/README.md @@ -21,3 +21,7 @@ It's listed under [msbuild_package](msbuild_package) folder. It fits projects wh #### Prebuilt tool package It's listed under [prebuilt_tool_package](prebuilt_tool_package) folder. It fits projects which only copy generated binaries (executables and libraries). + +#### Meson package + +It's listed under [meson_package](meson_package) folder. It fits projects which use `Meson` to be built. diff --git a/docs/package_templates/meson_package/all/conandata.yml b/docs/package_templates/meson_package/all/conandata.yml new file mode 100644 index 00000000000000..a5aa8737e0c0ad --- /dev/null +++ b/docs/package_templates/meson_package/all/conandata.yml @@ -0,0 +1,27 @@ +sources: + # Newer versions at the top + "1.2.0": + url: [ + "https://mirror1.net/package-1.2.0.tar.gz", + "https://mirror2.net/package-1.2.0.tar.gz", + ] + sha256: "________________________________________________________________" + "1.1.0": + url: [ + "https://mirror1.net/package-1.1.0.tar.gz", + "https://mirror2.net/package-1.1.0.tar.gz", + ] + sha256: "________________________________________________________________" +patches: + # Newer versions at the top + "1.1.0": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "correct the order of cmake min and project" + patch_type: "backport" + patch_source: "https://github.com/owner/package/pulls/42" + sha256: "________________________________________________________________" + - patch_file: "patches/0002-fix-linux.patch" + patch_description: "add missing header to support linux" + patch_type: "portability" + patch_source: "https://github.com/owner/package/issues/0" + sha256: "________________________________________________________________" diff --git a/docs/package_templates/meson_package/all/conanfile.py b/docs/package_templates/meson_package/all/conanfile.py new file mode 100644 index 00000000000000..5305b9ba492e77 --- /dev/null +++ b/docs/package_templates/meson_package/all/conanfile.py @@ -0,0 +1,164 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.gnu import PkgConfigDeps +from conan.tools.meson import Meson, MesonToolchain, MesonDeps +from conan.tools.env import VirtualBuildEnv +import os + + +required_conan_version = ">=1.52.0" + +# +# INFO: Please, remove all comments before pushing your PR! +# + + +class PackageConan(ConanFile): + name = "package" + description = "short description" + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/project/package" + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("topic1", "topic2", "topic3") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _minimum_cpp_standard(self): + return 17 + + # in case the project requires C++14/17/20/... the minimum compiler version should be listed + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + # no exports_sources attribute, but export_sources(self) method instead + # this allows finer grain exportation of patches per version + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + # once removed by config_options, need try..except for a second del + del self.options.fPIC + except Exception: + pass + # for plain C projects only + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + # src_folder must use the same source folder name the project + basic_layout(self, src_folder="src") + + def requirements(self): + # prefer self.requires method instead of requires attribute + self.requires("dependency/0.8.1") + + def validate(self): + # validate the minimum cpp standard supported. For C++ projects only + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + # in case it does not work in another configuration, it should validated here too + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on Visual Studio and msvc.") + + # if another tool than the compiler or Meson is required to build the project (pkgconf, bison, flex etc) + def build_requirements(self): + # Meson package is no installed by default on ConanCenterIndex CI + self.tool_requires("meson/0.63.3") + # pkgconf is largely used by Meson, in case needed on Windows, it should be added are build requirement + self.tool_requires("pkgconf/1.9.3") + # Meson uses Ninja as backend by default. Ninja package is not installed by default on ConanCenterIndex + if not self.conf.get("tools.meson.mesontoolchain:backend", default=False, check_type=str): + self.tool_requires("ninja/1.11.1") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + # default_library and b_staticpic are automatically parsed when self.options.shared and self.options.fpic exist + # buildtype is automatically parsed for self.settings + tc = MesonToolchain(self) + # In case need to pass definitions directly to the compiler + tc.preprocessor_definitions["MYDEFINE"] = "MYDEF_VALUE" + # Meson project options may vary their types + tc.project_options["tests"] = False + tc.generate() + # In case there are dependencies listed on requirements, PkgConfigDeps should be used + tc = PkgConfigDeps(self) + tc.generate() + # Sometimes, when PkgConfigDeps is not enough to find requirements, MesonDeps should solve it + tc = MesonDeps(self) + tc.generate() + # In case there are dependencies listed on build_requirements, VirtualBuildEnv should be used + tc = VirtualBuildEnv(self) + tc.generate(scope="build") + + def _patch_sources(self): + apply_conandata_patches(self) + # remove bundled xxhash + rm(self, "whateer.*", os.path.join(self.source_folder, "lib")) + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "...", "") + + def build(self): + self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + meson = Meson(self) + meson.install() + + # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + # avoid collect_libs(), prefer explicit library name instead + self.cpp_info.libs = ["package_lib"] + # if package provides a pkgconfig file (package.pc, usually installed in /lib/pkgconfig/) + self.cpp_info.set_property("pkg_config_name", "package") + # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) diff --git a/docs/package_templates/meson_package/all/test_package/conanfile.py b/docs/package_templates/meson_package/all/test_package/conanfile.py new file mode 100644 index 00000000000000..4738b8f8b2267f --- /dev/null +++ b/docs/package_templates/meson_package/all/test_package/conanfile.py @@ -0,0 +1,34 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "PkgConfigDeps", "MesonToolchain", "VirtualRunEnv", "VirtualBuildEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.tool_requires("meson/0.63.3") + self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.meson.mesontoolchain:backend", default=False, check_type=str): + self.tools_requires("ninja/1.11.1") + + def layout(self): + basic_layout(self) + + def build(self): + cmake = Meson(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/docs/package_templates/meson_package/all/test_package/meson.build b/docs/package_templates/meson_package/all/test_package/meson.build new file mode 100644 index 00000000000000..481f6cfd116c14 --- /dev/null +++ b/docs/package_templates/meson_package/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'cpp') +package_dep = dependency('package') +executable('test_package', + sources : ['test_package.cpp'], + dependencies : [package_dep]) diff --git a/docs/package_templates/meson_package/all/test_package/test_package.cpp b/docs/package_templates/meson_package/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..315875d9547773 --- /dev/null +++ b/docs/package_templates/meson_package/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include +#include +#include "package/foobar.hpp" + + +int main(void) { + /* + * Create a minimal usage for the target project here. + * Avoid big examples, bigger than 100 lines. + * Avoid networking connections. + * Avoid background apps or servers. + * The propose is testing the generated artifacts only. + */ + + foobar.print_version(); + + return EXIT_SUCCESS; +} diff --git a/docs/package_templates/meson_package/all/test_v1_package/conanfile.py b/docs/package_templates/meson_package/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c571ed9e8d113f --- /dev/null +++ b/docs/package_templates/meson_package/all/test_v1_package/conanfile.py @@ -0,0 +1,24 @@ +from conans import ConanFile, Meson +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "pkg_config" + + def build_requirements(self): + self.build_requires("pkgconf/1.9.3") + self.build_requires("meson/0.63.3") + self.build_requires("ninja/1.11.1") + + def build(self): + meson = Meson(self) + meson.configure(build_folder="bin", source_folder="../test_package") + meson.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/docs/package_templates/meson_package/config.yml b/docs/package_templates/meson_package/config.yml new file mode 100644 index 00000000000000..a885cbf942a741 --- /dev/null +++ b/docs/package_templates/meson_package/config.yml @@ -0,0 +1,6 @@ +versions: + # Newer versions at the top + "1.2.0": + folder: all + "1.1.0": + folder: all From 1bf681de2cf9a5e71eef47c49c01060031fb23a3 Mon Sep 17 00:00:00 2001 From: Ahajha <44127594+Ahajha@users.noreply.github.com> Date: Wed, 19 Oct 2022 14:05:47 -0400 Subject: [PATCH 090/300] (#13591) Add vulkan-headers 1.3.231 --- recipes/vulkan-headers/all/conandata.yml | 3 +++ recipes/vulkan-headers/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/vulkan-headers/all/conandata.yml b/recipes/vulkan-headers/all/conandata.yml index 95d82ebb73d005..d7718cb9466ca7 100644 --- a/recipes/vulkan-headers/all/conandata.yml +++ b/recipes/vulkan-headers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.3.231.tar.gz" + sha256: "4cb1c0aeb858e1a4955a736b86b0da8511ca8701222e9a252adcf093d40a8d28" "1.3.224.1": url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.224.1.tar.gz" sha256: "628bd5943c0d007c192769480e789801a088f892445c80cb336fc9b6d236c5ef" diff --git a/recipes/vulkan-headers/config.yml b/recipes/vulkan-headers/config.yml index 4dd6e6190dc8f5..8dff9a04482258 100644 --- a/recipes/vulkan-headers/config.yml +++ b/recipes/vulkan-headers/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231": + folder: all "1.3.224.1": folder: all "1.3.224.0": From a0cdbcb4a717c863fa5c3a82a5bcef9f1b04aad1 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Wed, 19 Oct 2022 21:05:17 +0200 Subject: [PATCH 091/300] (#13570) opengl: use new system helpers * use new system helpers * fixup * Update conanfile.py --- recipes/opengl/all/conanfile.py | 56 +++++++++++++++++---------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/recipes/opengl/all/conanfile.py b/recipes/opengl/all/conanfile.py index 09a72805491dee..bff45b47153335 100644 --- a/recipes/opengl/all/conanfile.py +++ b/recipes/opengl/all/conanfile.py @@ -1,7 +1,10 @@ from conan import ConanFile from conan.errors import ConanException +from conan.tools.system import package_manager from conans import tools +required_conan_version = ">=1.47" + class SysConfigOpenGLConan(ConanFile): name = "opengl" @@ -37,33 +40,32 @@ def _fill_cppinfo_from_pkgconfig(self, name): self.cpp_info.cxxflags.extend(cflags) def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - if tools.os_info.linux_distro == "fedora" and tools.os_info.os_version >= "32": - packages = ["libglvnd-devel"] - else: - packages = ["mesa-libGL-devel"] - elif tools.os_info.with_apt: - ubuntu_20_or_later = tools.os_info.linux_distro == "ubuntu" and tools.os_info.os_version >= "20" - debian_11_or_later = tools.os_info.linux_distro == "debian" and tools.os_info.os_version >= "11" - pop_os_20_or_later = tools.os_info.linux_distro == "pop" and tools.os_info.os_version >= "20" - if ubuntu_20_or_later or debian_11_or_later or pop_os_20_or_later: - packages = ["libgl-dev"] - else: - packages = ["libgl1-mesa-dev"] - elif tools.os_info.with_pacman: - packages = ["libglvnd"] - elif tools.os_info.with_zypper: - packages = ["Mesa-libGL-devel"] - else: - self.output.warn("Don't know how to install OpenGL for your distro.") - elif tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libglvnd"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + if tools.os_info.linux_distro == "fedora" and tools.os_info.os_version >= "32": + dnf.install(["libglvnd-devel"], update=True, check=True) + else: + dnf.install(["mesa-libGL-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["mesa-libGL-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + ubuntu_20_or_later = tools.os_info.linux_distro == "ubuntu" and tools.os_info.os_version >= "20" + debian_11_or_later = tools.os_info.linux_distro == "debian" and tools.os_info.os_version >= "11" + pop_os_20_or_later = tools.os_info.linux_distro == "pop" and tools.os_info.os_version >= "20" + if ubuntu_20_or_later or debian_11_or_later or pop_os_20_or_later: + apt.install(["libgl-dev"], update=True, check=True) + else: + apt.install(["libgl1-mesa-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libglvnd"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["Mesa-libGL-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libglvnd"], update=True, check=True) def package_info(self): # TODO: Workaround for #2311 until a better solution can be found From 46a73a7e544dae4f4a78007f3c02a6c14dbe005e Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Wed, 19 Oct 2022 21:26:18 +0200 Subject: [PATCH 092/300] (#13592) xorg: remove xkeyboard-config and xtrans * xorg: split system packages according to arch * Update conanfile.py * Update conanfile.py --- recipes/xorg/all/conanfile.py | 38 +++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/recipes/xorg/all/conanfile.py b/recipes/xorg/all/conanfile.py index c1f209e672558d..6182a830106182 100644 --- a/recipes/xorg/all/conanfile.py +++ b/recipes/xorg/all/conanfile.py @@ -28,52 +28,56 @@ def system_requirements(self): "libxcomposite-dev", "libxcursor-dev", "libxdamage-dev", "libxdmcp-dev", "libxext-dev", "libxfixes-dev", "libxi-dev", "libxinerama-dev", "libxkbfile-dev", "libxmu-dev", "libxmuu-dev", "libxpm-dev", "libxrandr-dev", "libxrender-dev", "libxres-dev", "libxss-dev", "libxt-dev", "libxtst-dev", - "libxv-dev", "libxvmc-dev", "libxxf86vm-dev", "xtrans-dev", "libxcb-render0-dev", + "libxv-dev", "libxvmc-dev", "libxxf86vm-dev", "libxcb-render0-dev", "libxcb-render-util0-dev", "libxcb-xkb-dev", "libxcb-icccm4-dev", "libxcb-image0-dev", "libxcb-keysyms1-dev", "libxcb-randr0-dev", "libxcb-shape0-dev", "libxcb-sync-dev", "libxcb-xfixes0-dev", - "libxcb-xinerama0-dev", "xkb-data", "libxcb-dri3-dev", "uuid-dev"], update=True, check=True) + "libxcb-xinerama0-dev", "libxcb-dri3-dev", "uuid-dev"], update=True, check=True) apt.install_substitutes( ["libxcb-util-dev"], ["libxcb-util0-dev"], update=True, check=True) - package_manager.Yum(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + yum = package_manager.Yum(self) + yum.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel", - "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", + "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", - "xcb-util-devel", "libuuid-devel", "xkeyboard-config-devel"], update=True, check=True) + "xcb-util-devel", "libuuid-devel"], update=True, check=True) - package_manager.Dnf(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + dnf = package_manager.Dnf(self) + dnf.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel", - "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", + "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", - "xcb-util-devel", "libuuid-devel", "xkeyboard-config-devel"], update=True, check=True) + "xcb-util-devel", "libuuid-devel"], update=True, check=True) - package_manager.Zypper(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + zypper = package_manager.Zypper(self) + zypper.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel", - "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", + "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", - "xcb-util-devel", "libuuid-devel", "xkeyboard-config"], update=True, check=True) + "xcb-util-devel", "libuuid-devel"], update=True, check=True) - package_manager.PacMan(self).install(["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", + pacman = package_manager.PacMan(self) + pacman.install(["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", - "libxss", "libxvmc", "xtrans", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", - "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util", "util-linux-libs"], update=True, check=True) + "libxss", "libxvmc", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", + "libxxf86vm", "libxv", "xcb-util", "util-linux-libs"], update=True, check=True) package_manager.Pkg(self).install(["libX11", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", - "libXScrnSaver", "libxvmc", "xtrans", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", + "libXScrnSaver", "libxvmc", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util"], update=True, check=True) def package_info(self): for name in ["x11", "x11-xcb", "fontenc", "ice", "sm", "xau", "xaw7", "xcomposite", "xcursor", "xdamage", "xdmcp", "xext", "xfixes", "xi", "xinerama", "xkbfile", "xmu", "xmuu", "xpm", "xrandr", "xrender", "xres", - "xscrnsaver", "xt", "xtst", "xv", "xvmc", "xxf86vm", "xtrans", + "xscrnsaver", "xt", "xtst", "xv", "xvmc", "xxf86vm", "xcb-xkb", "xcb-icccm", "xcb-image", "xcb-keysyms", "xcb-randr", "xcb-render", "xcb-renderutil", "xcb-shape", "xcb-shm", "xcb-sync", "xcb-xfixes", - "xcb-xinerama", "xcb", "xkeyboard-config", "xcb-atom", "xcb-aux", "xcb-event", "xcb-util", + "xcb-xinerama", "xcb", "xcb-atom", "xcb-aux", "xcb-event", "xcb-util", "xcb-dri3"] + ([] if self.settings.os == "FreeBSD" else ["uuid"]): pkg_config = PkgConfig(self, name) pkg_config.fill_cpp_info( From 39f4ce873378df145f01b52df0c5ba5592867b87 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 19 Oct 2022 21:44:39 +0200 Subject: [PATCH 093/300] (#13599) alac: improvements for conan 2.x client --- recipes/alac/all/CMakeLists.txt | 8 ++++---- recipes/alac/all/conanfile.py | 17 ++++++++++------- recipes/alac/all/test_package/CMakeLists.txt | 2 +- recipes/alac/all/test_package/conanfile.py | 11 ++++++----- recipes/alac/all/test_v1_package/CMakeLists.txt | 2 +- recipes/alac/all/test_v1_package/conanfile.py | 1 - 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/recipes/alac/all/CMakeLists.txt b/recipes/alac/all/CMakeLists.txt index 824a71b493f3a3..fe2d89ad21170c 100644 --- a/recipes/alac/all/CMakeLists.txt +++ b/recipes/alac/all/CMakeLists.txt @@ -3,11 +3,11 @@ project(alac LANGUAGES C CXX) include(GNUInstallDirs) -file(GLOB ALAC_LIB_SRCS src/codec/*.c src/codec/*.cpp) -file(GLOB ALAC_LIB_PUBLIC_HDRS src/codec/ALAC*.h) +file(GLOB ALAC_LIB_SRCS ${ALAC_SRC_DIR}/codec/*.c ${ALAC_SRC_DIR}/codec/*.cpp) +file(GLOB ALAC_LIB_PUBLIC_HDRS ${ALAC_SRC_DIR}/codec/ALAC*.h) add_library(alac ${ALAC_LIB_SRCS}) -target_include_directories(alac PUBLIC src/codec) +target_include_directories(alac PUBLIC ${ALAC_SRC_DIR}/codec) set_property(TARGET alac PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_compile_definitions(alac PRIVATE @@ -21,7 +21,7 @@ install(TARGETS alac ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(ALAC_BUILD_UTILITY) - file(GLOB ALAC_CONVERTER_SRCS src/convert-utility/*.cpp) + file(GLOB ALAC_CONVERTER_SRCS ${ALAC_SRC_DIR}/convert-utility/*.cpp) add_executable(alacconvert ${ALAC_CONVERTER_SRCS}) target_link_libraries(alacconvert PRIVATE alac) diff --git a/recipes/alac/all/conanfile.py b/recipes/alac/all/conanfile.py index 1c265220e3e81f..03e8814c8b1fd4 100644 --- a/recipes/alac/all/conanfile.py +++ b/recipes/alac/all/conanfile.py @@ -1,9 +1,10 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get +from conan.tools.scm import Version import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class AlacConan(ConanFile): @@ -35,7 +36,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def layout(self): cmake_layout(self, src_folder="src") @@ -46,6 +50,7 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + tc.variables["ALAC_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.variables["ALAC_BUILD_UTILITY"] = self.options.utility tc.generate() @@ -62,7 +67,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["alac"] - if self.options.utility: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + if Version(conan_version).major < 2 and self.options.utility: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/alac/all/test_package/CMakeLists.txt b/recipes/alac/all/test_package/CMakeLists.txt index 20135a2b359e35..237396b4c33235 100644 --- a/recipes/alac/all/test_package/CMakeLists.txt +++ b/recipes/alac/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) find_package(alac REQUIRED CONFIG) diff --git a/recipes/alac/all/test_package/conanfile.py b/recipes/alac/all/test_package/conanfile.py index 3a8c6c5442b33b..0a6bc68712d901 100644 --- a/recipes/alac/all/test_package/conanfile.py +++ b/recipes/alac/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/alac/all/test_v1_package/CMakeLists.txt b/recipes/alac/all/test_v1_package/CMakeLists.txt index 00f950dcb21f67..6e042a1c741811 100644 --- a/recipes/alac/all/test_v1_package/CMakeLists.txt +++ b/recipes/alac/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) diff --git a/recipes/alac/all/test_v1_package/conanfile.py b/recipes/alac/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/alac/all/test_v1_package/conanfile.py +++ b/recipes/alac/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os From 60a4b62b6a09f582ddede0e0b1a894c2b2a887e0 Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 20 Oct 2022 05:04:19 +0900 Subject: [PATCH 094/300] (#13610) docs: remove lines to make frameworkdirs and resdirs empty on header_only template --- docs/package_templates/header_only/all/conanfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/package_templates/header_only/all/conanfile.py b/docs/package_templates/header_only/all/conanfile.py index 51cc820f18cfac..a9310252571ff4 100644 --- a/docs/package_templates/header_only/all/conanfile.py +++ b/docs/package_templates/header_only/all/conanfile.py @@ -96,9 +96,7 @@ def package(self): def package_info(self): # folders not used for header-only self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # if package has an official FindPACKAGE.cmake listed in https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#find-modules # examples: bzip2, freetype, gdal, icu, libcurl, libjpeg, libpng, libtiff, openssl, sqlite3, zlib... From 3906097007c4804eacf7f7ed233a9f7d97049118 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Wed, 19 Oct 2022 22:24:44 +0200 Subject: [PATCH 095/300] (#13594) add xkeyboard-config/system * add xkeyboard-config/system * Update conanfile.py * Update conanfile.py * Update conanfile.py * Apply suggestions from code review Co-authored-by: Jordan Williams Co-authored-by: Jordan Williams --- recipes/xkeyboard-config/all/conanfile.py | 50 +++++++++++++++++++ .../all/test_package/conanfile.py | 23 +++++++++ .../all/test_v1_package/conanfile.py | 13 +++++ recipes/xkeyboard-config/config.yml | 3 ++ 4 files changed, 89 insertions(+) create mode 100644 recipes/xkeyboard-config/all/conanfile.py create mode 100644 recipes/xkeyboard-config/all/test_package/conanfile.py create mode 100644 recipes/xkeyboard-config/all/test_v1_package/conanfile.py create mode 100644 recipes/xkeyboard-config/config.yml diff --git a/recipes/xkeyboard-config/all/conanfile.py b/recipes/xkeyboard-config/all/conanfile.py new file mode 100644 index 00000000000000..a9f2fc053956cc --- /dev/null +++ b/recipes/xkeyboard-config/all/conanfile.py @@ -0,0 +1,50 @@ +from conan import ConanFile +from conan.tools.gnu import PkgConfig +from conan.tools.system import package_manager +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.47" + + +class XkeyboardConfigConan(ConanFile): + name = "xkeyboard-config" + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + homepage = "https://www.freedesktop.org/wiki/Software/XKeyboardConfig/" + description = "The non-arch keyboard configuration database for X Window." + settings = "os", "compiler", "build_type" # no arch here, because the xkeyboard-config system package is arch independant + topics = ("x11", "xorg", "keyboard") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") + + def package_id(self): + self.info.header_only() + + def system_requirements(self): + apt = package_manager.Apt(self) + apt.install(["xkb-data"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["xkeyboard-config-devel"], update=True, check=True) + + dnf = package_manager.Dnf(self) + dnf.install(["xkeyboard-config-devel"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["xkeyboard-config"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["xkeyboard-config"], update=True, check=True) + + package_manager.Pkg(self).install(["xkeyboard-config"], update=True, check=True) + + def package_info(self): + pkg_config = PkgConfig(self, "xkeyboard-config") + pkg_config.fill_cpp_info( + self.cpp_info, is_system=self.settings.os != "FreeBSD") + self.cpp_info.set_property("pkg_config_name", "xkeyboard-config") + self.cpp_info.set_property("component_version", pkg_config.version) + self.cpp_info.set_property("pkg_config_custom_content", + "\n".join(f"{key}={value}" for key, value in pkg_config.variables.items() if key not in ["pcfiledir","prefix", "includedir"])) diff --git a/recipes/xkeyboard-config/all/test_package/conanfile.py b/recipes/xkeyboard-config/all/test_package/conanfile.py new file mode 100644 index 00000000000000..5ce13b9d34b6d4 --- /dev/null +++ b/recipes/xkeyboard-config/all/test_package/conanfile.py @@ -0,0 +1,23 @@ +from conan import ConanFile +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + basic_layout(self) + + def generate(self): + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + + def test(self): + pkg_config = self.conf_info.get("tools.gnu:pkg_config", default="pkg-config") + self.run(f"{pkg_config} --validate xkeyboard-config") diff --git a/recipes/xkeyboard-config/all/test_v1_package/conanfile.py b/recipes/xkeyboard-config/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..510f8a18553914 --- /dev/null +++ b/recipes/xkeyboard-config/all/test_v1_package/conanfile.py @@ -0,0 +1,13 @@ +from conans import ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "pkg_config" + + def build(self): + pass + + def test(self): + self.run("pkg-config --validate ./xkeyboard-config.pc") diff --git a/recipes/xkeyboard-config/config.yml b/recipes/xkeyboard-config/config.yml new file mode 100644 index 00000000000000..76a338dd54ceec --- /dev/null +++ b/recipes/xkeyboard-config/config.yml @@ -0,0 +1,3 @@ +versions: + "system": + folder: "all" From 111b041a4c931581416cd41f20496d735bab3667 Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 20 Oct 2022 05:44:34 +0900 Subject: [PATCH 096/300] (#13609) aws-c-mqtt: change dependant recipe version for aws-crt-cpp --- recipes/aws-c-mqtt/all/conanfile.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/recipes/aws-c-mqtt/all/conanfile.py b/recipes/aws-c-mqtt/all/conanfile.py index 6c335e69cc40c9..4edb02ac94d9fe 100644 --- a/recipes/aws-c-mqtt/all/conanfile.py +++ b/recipes/aws-c-mqtt/all/conanfile.py @@ -1,11 +1,7 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file -from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, rmdir from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.env import VirtualBuildEnv import os @@ -51,8 +47,12 @@ def configure(self): def requirements(self): self.requires("aws-c-common/0.8.2") self.requires("aws-c-cal/0.5.13") - self.requires("aws-c-io/0.13.4") - self.requires("aws-c-http/0.6.22") + if Version(self.version) < "0.7.12": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") def layout(self): cmake_layout(self, src_folder="src") From 7154dbe7cf2618faeff1804730978c99651ee145 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 19 Oct 2022 23:26:29 +0200 Subject: [PATCH 097/300] (#13600) emsdk: fixes for conan 2.x client --- recipes/emsdk/all/conanfile.py | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 8f8aa6a455299b..b9f626ca08eefd 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -1,12 +1,13 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.build import cross_building from conan.tools.env import Environment from conan.tools.files import chdir, copy, get, replace_in_file from conan.tools.layout import basic_layout +from conan.tools.scm import Version import json import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class EmSDKConan(ConanFile): @@ -24,6 +25,9 @@ class EmSDKConan(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): self.requires("nodejs/16.3.0") # self.requires("python") # FIXME: Not available as Conan package @@ -33,9 +37,6 @@ def package_id(self): del self.info.settings.compiler del self.info.settings.build_type - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -71,8 +72,7 @@ def generate(self): env.define_path("EMSCRIPTEN", self._emscripten) env.define_path("EM_CONFIG", self._em_config) env.define_path("EM_CACHE", self._em_cache) - envvars = env.vars(self, scope="emsdk") - envvars.save_script("emsdk_env_file") + env.vars(self, scope="emsdk").save_script("emsdk_env_file") @staticmethod def _chmod_plus_x(filename): @@ -176,16 +176,16 @@ def package_info(self): os.path.join("bin", "upstream", "lib", "cmake", "llvm"), ] - # TODO: conan v1 stuff, to remove in conan v2? - self.env_info.PATH.extend(self._paths) - self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain - self.env_info.EMSDK = self._emsdk - self.env_info.EMSCRIPTEN = self._emscripten - self.env_info.EM_CONFIG = self._em_config - self.env_info.EM_CACHE = self._em_cache - self.env_info.CC = self._define_tool_var("emcc") - self.env_info.CXX = self._define_tool_var("em++") - self.env_info.AR = self._define_tool_var("emar") - self.env_info.NM = self._define_tool_var("emnm") - self.env_info.RANLIB = self._define_tool_var("emranlib") - self.env_info.STRIP = self._define_tool_var("emstrip") + if Version(conan_version).major < 2: + self.env_info.PATH.extend(self._paths) + self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain + self.env_info.EMSDK = self._emsdk + self.env_info.EMSCRIPTEN = self._emscripten + self.env_info.EM_CONFIG = self._em_config + self.env_info.EM_CACHE = self._em_cache + self.env_info.CC = self._define_tool_var("emcc") + self.env_info.CXX = self._define_tool_var("em++") + self.env_info.AR = self._define_tool_var("emar") + self.env_info.NM = self._define_tool_var("emnm") + self.env_info.RANLIB = self._define_tool_var("emranlib") + self.env_info.STRIP = self._define_tool_var("emstrip") From a85bc262f961f766ac38949314705715c473cd5a Mon Sep 17 00:00:00 2001 From: Quentin Chateau Date: Thu, 20 Oct 2022 00:24:31 +0100 Subject: [PATCH 098/300] (#13615) amqp-cpp: add version 4.3.18 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) --- recipes/amqp-cpp/all/conandata.yml | 6 ++++++ recipes/amqp-cpp/config.yml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/recipes/amqp-cpp/all/conandata.yml b/recipes/amqp-cpp/all/conandata.yml index b1762b6aca57f8..2543d0dc3e3ba0 100644 --- a/recipes/amqp-cpp/all/conandata.yml +++ b/recipes/amqp-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.3.18": + url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.18.tar.gz" + sha256: "cc2c1fc5da00a1778c2804306e06bdedc782a5f74762b9d9b442d3a498dd0c4f" "4.3.16": url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.16.tar.gz" sha256: "66c96e0db1efec9e7ddcf7240ff59a073d68c09752bd3e94b8bc4c506441fbf7" @@ -21,6 +24,9 @@ sources: url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.1.5.tar.gz" sha256: "9840c7fb17bb0c0b601d269e528b7f9cac5ec008dcf8d66bef22434423b468aa" patches: + "4.3.18": + - patch_file: "patches/0001-cmake-openssl-install-directories.patch" + base_path: "source_subfolder" "4.3.16": - patch_file: "patches/0001-cmake-openssl-install-directories.patch" base_path: "source_subfolder" diff --git a/recipes/amqp-cpp/config.yml b/recipes/amqp-cpp/config.yml index 25894cbf035c2f..81db570a6cd83f 100644 --- a/recipes/amqp-cpp/config.yml +++ b/recipes/amqp-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "4.3.18": + folder: all "4.3.16": folder: all "4.3.11": From caff0f9a73cac6775746f9903fd9d524fb6513d5 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Thu, 20 Oct 2022 09:04:58 +0200 Subject: [PATCH 099/300] (#13624) harfbuzz: add version 5.3.1 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/harfbuzz/all/conandata.yml | 6 ++++++ recipes/harfbuzz/config.yml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/recipes/harfbuzz/all/conandata.yml b/recipes/harfbuzz/all/conandata.yml index f77bff879e408e..c11b81c2d63a53 100644 --- a/recipes/harfbuzz/all/conandata.yml +++ b/recipes/harfbuzz/all/conandata.yml @@ -14,6 +14,9 @@ sources: "5.3.0": url: "https://github.com/harfbuzz/harfbuzz/archive/5.3.0.tar.gz" sha256: "94712b8cdae68f0b585ec8e3cd8c5160fdc241218119572236497a62dae770de" + "5.3.1": + url: "https://github.com/harfbuzz/harfbuzz/archive/5.3.1.tar.gz" + sha256: "77c8c903f4539b050a6d3a5be79705c7ccf7b1cb66d68152a651486e261edbd2" patches: "3.2.0": - patch_file: "patches/icu-3.0.x.patch" @@ -30,3 +33,6 @@ patches: "5.3.0": - patch_file: "patches/icu-5.2.x.patch" base_path: "source_subfolder" + "5.3.1": + - patch_file: "patches/icu-5.2.x.patch" + base_path: "source_subfolder" diff --git a/recipes/harfbuzz/config.yml b/recipes/harfbuzz/config.yml index 864b963b7b4b17..72fcc32e115378 100644 --- a/recipes/harfbuzz/config.yml +++ b/recipes/harfbuzz/config.yml @@ -9,3 +9,5 @@ versions: folder: all "5.3.0": folder: all + "5.3.1": + folder: all From c7c1d8fd7d5b69ad8750ee5fcf96176f79f9ef69 Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 20 Oct 2022 16:44:06 +0900 Subject: [PATCH 100/300] (#13499) glaze: add recipe * glaze: add recipe * fix license filename * update required gcc version * update required gcc version * update required conan version Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * update to 0.0.7 * update compiler minimum version * drop support apple-clang * only libdirs is set empty Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * fix recipe name Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * update conan version Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * support apple-clang >= 13.1 * use loose_lt_semvar * fix _min_cppstd * try to fix error C2039 * revert test_package Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/glaze/all/conandata.yml | 4 + recipes/glaze/all/conanfile.py | 81 +++++++++++++++++++ recipes/glaze/all/test_package/CMakeLists.txt | 9 +++ recipes/glaze/all/test_package/conanfile.py | 26 ++++++ .../glaze/all/test_package/test_package.cpp | 33 ++++++++ .../glaze/all/test_v1_package/CMakeLists.txt | 12 +++ .../glaze/all/test_v1_package/conanfile.py | 18 +++++ recipes/glaze/config.yml | 3 + 8 files changed, 186 insertions(+) create mode 100644 recipes/glaze/all/conandata.yml create mode 100644 recipes/glaze/all/conanfile.py create mode 100644 recipes/glaze/all/test_package/CMakeLists.txt create mode 100644 recipes/glaze/all/test_package/conanfile.py create mode 100644 recipes/glaze/all/test_package/test_package.cpp create mode 100644 recipes/glaze/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/glaze/all/test_v1_package/conanfile.py create mode 100644 recipes/glaze/config.yml diff --git a/recipes/glaze/all/conandata.yml b/recipes/glaze/all/conandata.yml new file mode 100644 index 00000000000000..3c9390d824cd89 --- /dev/null +++ b/recipes/glaze/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.0.7": + url: "https://github.com/stephenberry/glaze/archive/refs/tags/v0.0.7.tar.gz" + sha256: "124f7e8fea58c012b548ba1b643684fe428c7dbfeb8d8a5f701eb7db4356a759" diff --git a/recipes/glaze/all/conanfile.py b/recipes/glaze/all/conanfile.py new file mode 100644 index 00000000000000..48e0bafc31ad8d --- /dev/null +++ b/recipes/glaze/all/conanfile.py @@ -0,0 +1,81 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.51.1" + +class GlazeConan(ConanFile): + name = "glaze" + description = "Extremely fast, in memory, JSON and interface library for modern C++" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/stephenberry/glaze" + topics = ("json", "memory", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_cpp_standard(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "11", + "clang": "12", + "apple-clang": "13.1", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("fmt/9.1.0") + self.requires("fast_float/3.5.1") + self.requires("frozen/1.1.1") + self.requires("nanorange/20200505") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._minimum_cpp_standard}, which your compiler does not support.", + ) + + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/glaze/all/test_package/CMakeLists.txt b/recipes/glaze/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..fb31b1bd6ba68a --- /dev/null +++ b/recipes/glaze/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package CXX) + +find_package(glaze REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE glaze::glaze) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/glaze/all/test_package/conanfile.py b/recipes/glaze/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/glaze/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/glaze/all/test_package/test_package.cpp b/recipes/glaze/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..19dbb41c1ae8f2 --- /dev/null +++ b/recipes/glaze/all/test_package/test_package.cpp @@ -0,0 +1,33 @@ +#include "glaze/glaze.hpp" +#include "glaze/json/json_ptr.hpp" +#include "glaze/api/impl.hpp" + +struct my_struct +{ + int i = 287; + double d = 3.14; + std::string hello = "Hello World"; + std::array arr = { 1, 2, 3 }; +}; + +template <> +struct glz::meta { + using T = my_struct; + static constexpr auto value = object( + "i", &T::i, + "d", &T::d, + "hello", &T::hello, + "arr", &T::arr + ); +}; + +int main(void) { + std::string buffer = R"({"i":287,"d":3.14,"hello":"Hello World","arr":[1,2,3]})"; + auto s = glz::read_json(buffer); + + (void)s.d; + (void)s.hello; + (void)s.arr; + + return 0; +} diff --git a/recipes/glaze/all/test_v1_package/CMakeLists.txt b/recipes/glaze/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..c8562496a9de83 --- /dev/null +++ b/recipes/glaze/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(glaze REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE glaze::glaze) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/glaze/all/test_v1_package/conanfile.py b/recipes/glaze/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/glaze/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/glaze/config.yml b/recipes/glaze/config.yml new file mode 100644 index 00000000000000..3b1adbf0ba92f5 --- /dev/null +++ b/recipes/glaze/config.yml @@ -0,0 +1,3 @@ +versions: + "0.0.7": + folder: all From 9c774bfc60da85e5ae3be4f469f115ef9492ef68 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 20 Oct 2022 10:24:27 +0200 Subject: [PATCH 101/300] (#13611) [docs] Regenerate tables of contents Co-authored-by: conan-center-bot --- docs/v2_migration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/v2_migration.md b/docs/v2_migration.md index f14a69ce855cc0..2d2430b246c1f0 100644 --- a/docs/v2_migration.md +++ b/docs/v2_migration.md @@ -10,6 +10,7 @@ Conan v2 in pull requests. * [Using Layout](#using-layout) * [With New Generators](#with-new-generators) * [With Multiple Build Helpers](#with-multiple-build-helpers) + * [New conf_info properties](#new-conf_info-properties) * [New cpp_info set_property model](#new-cpp_info-set_property-model) * [CMakeDeps](#cmakedeps) * [Update required_conan_version to ">=1.43.0"](#update-required_conan_version-to-1430) From 1739efa84bd8f198cc1e5b162e16935f5647c0a6 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 20 Oct 2022 11:24:00 +0200 Subject: [PATCH 102/300] (#13617) zopfli: fixes for conan v2 client --- recipes/zopfli/all/conanfile.py | 25 +++++++++----------- recipes/zopfli/all/test_package/conanfile.py | 7 +++--- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/recipes/zopfli/all/conanfile.py b/recipes/zopfli/all/conanfile.py index 8427cd77b7996d..1f0b88e5124353 100644 --- a/recipes/zopfli/all/conanfile.py +++ b/recipes/zopfli/all/conanfile.py @@ -1,9 +1,10 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class ZopfliConan(ConanFile): @@ -33,7 +34,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: del self.settings.compiler.libcxx except Exception: @@ -82,14 +86,7 @@ def package_info(self): self.cpp_info.components["libzopflipng"].libs = ["zopflipng"] self.cpp_info.components["libzopflipng"].requires = ["libzopfli"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bin_path}") - self.env_info.PATH.append(bin_path) - - # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.names["cmake_find_package"] = "Zopfli" - self.cpp_info.names["cmake_find_package_multi"] = "Zopfli" - self.cpp_info.components["libzopfli"].names["cmake_find_package"] = "libzopfli" - self.cpp_info.components["libzopfli"].names["cmake_find_package_multi"] = "libzopfli" - self.cpp_info.components["libzopflipng"].names["cmake_find_package"] = "libzopflipng" - self.cpp_info.components["libzopflipng"].names["cmake_find_package_multi"] = "libzopflipng" + if Version(conan_version).major < 2: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.cpp_info.names["cmake_find_package"] = "Zopfli" + self.cpp_info.names["cmake_find_package_multi"] = "Zopfli" diff --git a/recipes/zopfli/all/test_package/conanfile.py b/recipes/zopfli/all/test_package/conanfile.py index d120a992c06a69..0a6bc68712d901 100644 --- a/recipes/zopfli/all/test_package/conanfile.py +++ b/recipes/zopfli/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() From c2c60d9c04c8c0fa8bb80e12796aed967cbb2c98 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 20 Oct 2022 12:24:17 +0200 Subject: [PATCH 103/300] (#13616) xerces-c: hotfix - honor `shared=False` option * honor shared=False option * improve conan v2 client support --- recipes/xerces-c/all/conanfile.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/recipes/xerces-c/all/conanfile.py b/recipes/xerces-c/all/conanfile.py index de59d70169466c..30133690332a3d 100644 --- a/recipes/xerces-c/all/conanfile.py +++ b/recipes/xerces-c/all/conanfile.py @@ -1,8 +1,9 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration from conan.tools.env import VirtualBuildEnv from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os required_conan_version = ">=1.52.0" @@ -82,11 +83,7 @@ def _validate(self, option, value, os): OS(es) that `value` is valid on """ if self.info.settings.os not in os and getattr(self.info.options, option) == value: - raise ConanInvalidConfiguration( - "Option '{option}={value}' is only supported on {os}".format( - option=option, value=value, os=os - ) - ) + raise ConanInvalidConfiguration(f"Option '{option}={value}' is only supported on {os}") def validate(self): if self.info.settings.os not in ("Windows", "Macos", "Linux"): @@ -113,6 +110,8 @@ def generate(self): env = VirtualBuildEnv(self) env.generate() tc = CMakeToolchain(self) + # Because upstream overrides BUILD_SHARED_LIBS as a CACHE variable + tc.cache_variables["BUILD_SHARED_LIBS"] = "ON" if self.options.shared else "OFF" # https://xerces.apache.org/xerces-c/build-3.html tc.variables["network-accessor"] = self.options.network_accessor tc.variables["transcoder"] = self.options.transcoder @@ -153,5 +152,6 @@ def package_info(self): elif self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - self.cpp_info.names["cmake_find_package"] = "XercesC" - self.cpp_info.names["cmake_find_package_multi"] = "XercesC" + if Version(conan_version).major < 2: + self.cpp_info.names["cmake_find_package"] = "XercesC" + self.cpp_info.names["cmake_find_package_multi"] = "XercesC" From c50e33ce20fe4436fe57ae0654bb6c7efe660c42 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Thu, 20 Oct 2022 13:05:08 +0200 Subject: [PATCH 104/300] (#13604) xkbcommon: finer grain requirements --- recipes/xkbcommon/all/conanfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/xkbcommon/all/conanfile.py b/recipes/xkbcommon/all/conanfile.py index 633209750e95b6..f4a785f15eee62 100644 --- a/recipes/xkbcommon/all/conanfile.py +++ b/recipes/xkbcommon/all/conanfile.py @@ -53,7 +53,9 @@ def configure(self): del self.settings.compiler.cppstd def requirements(self): - self.requires("xorg/system") + self.requires("xkeyboard-config/system") + if self.options.with_x11: + self.requires("xorg/system") if self.options.get_safe("xkbregistry"): self.requires("libxml2/2.9.14") if self.options.get_safe("with_wayland"): @@ -121,7 +123,7 @@ def package(self): def package_info(self): self.cpp_info.components["libxkbcommon"].set_property("pkg_config_name", "xkbcommon") self.cpp_info.components["libxkbcommon"].libs = ["xkbcommon"] - self.cpp_info.components["libxkbcommon"].requires = ["xorg::xkeyboard-config"] + self.cpp_info.components["libxkbcommon"].requires = ["xkeyboard-config::xkeyboard-config"] self.cpp_info.components["libxkbcommon"].resdirs = ["res"] if self.options.with_x11: From 7c6b9e4606b22281b00557b6e8ee8e09f6a99c54 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 20 Oct 2022 15:25:10 +0200 Subject: [PATCH 105/300] (#13564) Add libmicrohttpd/0.9.75 recipe * Add libmicrohttpd/0.9.75 recipe * libmicrohttpd: fix test-package directory name * libmicrohttpd: fix test_package + address feedback * libmicrohttpd: 1.52.0 will do * libmicrohttpd: experimental patch to fix VS2017 * libmicrohttpd: fix MSVC MT * libmicrohttpd: use conantoolchain.props * libmicrohttpd: clean-up * Turns out conan knew how to do it after all * Use PkgConfigDeps * catch removing fPIC * Set win_bash attribute * Use conan vs AutotoolsToolchain + Autotools * Apply suggestions from code review Co-authored-by: Uilian Ries Co-authored-by: Jordan Williams * copy LICENSE from source_folder Co-authored-by: Uilian Ries Co-authored-by: Jordan Williams --- recipes/libmicrohttpd/all/conandata.yml | 9 + recipes/libmicrohttpd/all/conanfile.py | 199 ++++++++++++++++++ .../0.9.75-0001-msbuild-RuntimeLibrary.patch | 35 +++ .../all/test_package/CMakeLists.txt | 7 + .../all/test_package/conanfile.py | 30 +++ .../all/test_package/test_package.c | 74 +++++++ .../all/test_v1_package/CMakeLists.txt | 10 + .../all/test_v1_package/conanfile.py | 17 ++ recipes/libmicrohttpd/config.yml | 3 + 9 files changed, 384 insertions(+) create mode 100644 recipes/libmicrohttpd/all/conandata.yml create mode 100644 recipes/libmicrohttpd/all/conanfile.py create mode 100644 recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch create mode 100644 recipes/libmicrohttpd/all/test_package/CMakeLists.txt create mode 100644 recipes/libmicrohttpd/all/test_package/conanfile.py create mode 100644 recipes/libmicrohttpd/all/test_package/test_package.c create mode 100644 recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libmicrohttpd/all/test_v1_package/conanfile.py create mode 100644 recipes/libmicrohttpd/config.yml diff --git a/recipes/libmicrohttpd/all/conandata.yml b/recipes/libmicrohttpd/all/conandata.yml new file mode 100644 index 00000000000000..baf8560b8d3f1c --- /dev/null +++ b/recipes/libmicrohttpd/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.9.75": + url: "https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.75.tar.gz" + sha256: "9278907a6f571b391aab9644fd646a5108ed97311ec66f6359cebbedb0a4e3bb" +patches: + "0.9.75": + - patch_file: "patches/0.9.75-0001-msbuild-RuntimeLibrary.patch" + patch_description: "Remove RuntimeLibrary from vcxproject + use conantoolchain.props" + patch_type: "conan" diff --git a/recipes/libmicrohttpd/all/conanfile.py b/recipes/libmicrohttpd/all/conanfile.py new file mode 100644 index 00000000000000..8c7a9d8fa18cba --- /dev/null +++ b/recipes/libmicrohttpd/all/conanfile.py @@ -0,0 +1,199 @@ +from conan import ConanFile, Version +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.microsoft import MSBuild, MSBuildToolchain, is_msvc, vs_layout +from conan.tools.layout import basic_layout +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.52.0" + + +class LibmicrohttpdConan(ConanFile): + name = "libmicrohttpd" + description = "A small C library that is supposed to make it easy to run an HTTP server" + homepage = "https://www.gnu.org/software/libmicrohttpd/" + topics = ("httpd", "server", "service") + license = "LGPL-2.1" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_https": [True, False], + "with_error_messages": [True, False], + "with_postprocessor": [True, False], + "with_digest_authentification": [True, False], + "epoll": [True, False], + "with_zlib": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_https": False, # FIXME: should be True, but gnutls is not yet available in cci + "with_error_messages": True, + "with_postprocessor": True, + "with_digest_authentification": True, + "epoll": True, + "with_zlib": True, + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def config_options(self): + if self.settings.os != "Linux": + try: + del self.options.fPIC + except Exception: + pass + del self.options.epoll + if is_msvc(self): + del self.options.with_https + del self.options.with_error_messages + del self.options.with_postprocessor + del self.options.with_digest_authentification + del self.options.with_zlib + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def validate(self): + if is_msvc(self): + if self.info.settings.arch not in ("x86", "x86_64"): + raise ConanInvalidConfiguration("Unsupported architecture (only x86 and x86_64 are supported)") + if self.info.settings.build_type not in ("Release", "Debug"): + raise ConanInvalidConfiguration("Unsupported build type (only Release and Debug are supported)") + + def requirements(self): + if self.options.get_safe("with_zlib", False): + self.requires("zlib/1.2.13") + if self.options.get_safe("with_https", False): + raise ConanInvalidConfiguration("gnutls is not (yet) available in cci") + + def build_requirements(self): + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + if is_msvc(self): + vs_layout(self) + else: + basic_layout(self) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msvc_configuration + tc.generate() + else: + yes_no = lambda v: "yes" if v else "no" + pkg = PkgConfigDeps(self) + pkg.generate() + autotools = AutotoolsToolchain(self) + autotools.configure_args.extend([ + f"--enable-shared={yes_no(self.options.shared)}", + f"--enable-static={yes_no(not self.options.shared)}", + f"--enable-https={yes_no(self.options.with_https)}", + f"--enable-messages={yes_no(self.options.with_error_messages)}", + f"--enable-postprocessor={yes_no(self.options.with_postprocessor)}", + f"--enable-dauth={yes_no(self.options.with_digest_authentification)}", + f"--enable-epoll={yes_no(self.options.get_safe('epoll'))}", + "--disable-doc", + "--disable-examples", + "--disable-curl", + ]) + if self.settings.os == "Windows": + if self.options.with_zlib: + # This fixes libtool refusing to build a shared library when it sees `-lz` + libdir = self.deps_cpp_info["zlib"].lib_paths[0] + autotools.extra_ldflags.extend([os.path.join(libdir, lib).replace("\\", "/") for lib in os.listdir(libdir)]) + autotools.generate() + + @property + def _msvc_configuration(self): + return f"{self.settings.build_type}-{'dll' if self.options.shared else 'static'}" + + @property + def _msvc_sln_folder(self): + if self.settings.compiler == "Visual Studio": + if Version(self.settings.compiler.version) >= 16: + subdir = "VS-Any-Version" + else: + subdir = "VS2017" + else: + subdir = "VS-Any-Version" + return os.path.join("w32", subdir) + + @property + def _msvc_arch(self): + return { + "x86": "Win32", + "x86_64": "x64", + }[str(self.settings.arch)] + + def _patch_sources(self): + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + if is_msvc(self): + msbuild = MSBuild(self) + msbuild.build_type = self._msvc_configuration + msbuild.build(sln=os.path.join(self._msvc_sln_folder, "libmicrohttpd.sln"), targets=["libmicrohttpd"]) + else: + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, "*.lib", os.path.join(self.build_folder, self._msvc_sln_folder, "Output", self._msvc_arch), os.path.join(self.package_folder, "lib")) + copy(self, "*.dll", os.path.join(self.build_folder, self._msvc_sln_folder, "Output", self._msvc_arch), os.path.join(self.package_folder, "bin")) + copy(self, "*.h", os.path.join(self.build_folder, self._msvc_sln_folder, "Output", self._msvc_arch), os.path.join(self.package_folder, "include")) + else: + autotools = Autotools(self) + autotools.install() + + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libmicrohttps") + libname = "microhttpd" + if is_msvc(self): + libname = "libmicrohttpd" + if self.options.shared: + libname += "-dll" + if self.settings.build_type == "Debug": + libname += "_d" + self.cpp_info.libs = [libname] + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs = ["pthread"] + elif self.settings.os == "Windows": + if self.options.shared: + self.cpp_info.defines.append("MHD_W32DLL") + self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch b/recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch new file mode 100644 index 00000000000000..b3dc82df26fa99 --- /dev/null +++ b/recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch @@ -0,0 +1,35 @@ +--- w32/common/common-build-settings.vcxproj ++++ w32/common/common-build-settings.vcxproj +@@ -5,7 +5,7 @@ + Only 0 and 1 are used currently --> + 0 + 1 +- ++ + + $(SolutionDir);$(MhdW32Common);$(MhdSrc)include;$(IncludePath) + +--- w32/common/libmicrohttpd-build-settings.vcxproj ++++ w32/common/libmicrohttpd-build-settings.vcxproj +@@ -31,8 +31,8 @@ + + + _LIB;MHD_W32LIB;%(PreprocessorDefinitions) +- MultiThreadedDebug +- MultiThreaded ++ + + + Ws2_32.lib +@@ -45,8 +45,8 @@ + + + _USRDLL;MHD_W32DLL;%(PreprocessorDefinitions) +- MultiThreadedDebugDLL +- MultiThreadedDLL ++ + + + Ws2_32.lib;%(AdditionalDependencies) diff --git a/recipes/libmicrohttpd/all/test_package/CMakeLists.txt b/recipes/libmicrohttpd/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..534adba0c584fa --- /dev/null +++ b/recipes/libmicrohttpd/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libmicrohttpd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libmicrohttpd::libmicrohttpd) diff --git a/recipes/libmicrohttpd/all/test_package/conanfile.py b/recipes/libmicrohttpd/all/test_package/conanfile.py new file mode 100644 index 00000000000000..f72d1f660e19fb --- /dev/null +++ b/recipes/libmicrohttpd/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmicrohttpd/all/test_package/test_package.c b/recipes/libmicrohttpd/all/test_package/test_package.c new file mode 100644 index 00000000000000..cb40829c7a43b5 --- /dev/null +++ b/recipes/libmicrohttpd/all/test_package/test_package.c @@ -0,0 +1,74 @@ +#include +#include +#include +#include + +#define PORT 8888 +#define PAGE \ + "" \ + "" \ + "libmicrohttpd demo" \ + "" \ + "" \ + "libmicrohttpd demo" \ + "" \ + "" + +static enum MHD_Result ahc_echo(void * cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + long unsigned int *upload_data_size, + void **con_cls) { + struct MHD_Response *response; + int ret; + + if (strcmp(method, "GET") != 0) { + /** + * unexpected method + */ + return MHD_NO; + } + if (*con_cls == NULL) { + /** + * The first time only the headers are valid, + * do not respond in the first round. + * But accept the connection. + */ + *con_cls = connection; + return MHD_YES; + } + if (*upload_data_size != 0) { + /** + * upload data in a GET!? + */ + return MHD_NO; + } + response = MHD_create_response_from_buffer(strlen(PAGE), (void*)PAGE, MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); + MHD_destroy_response(response); + return ret; +} + +int main(int argc, char *argv[]) { + struct MHD_Daemon *daemon; + + // Don't open a port and do not block so CI isn't interrupted. +#if 0 + daemon = MHD_start_daemon(MHD_USE_INTERNAL_POLLING_THREAD, + PORT, NULL, NULL, + &ahc_echo, NULL, MHD_OPTION_END); + if (daemon == NULL) { + return 1; + } + + (void)getchar(); +#else + daemon = NULL; +#endif + + MHD_stop_daemon(daemon); + return 0; +} diff --git a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0b95e58322269d --- /dev/null +++ b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(libmicrohttpd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libmicrohttpd::libmicrohttpd) diff --git a/recipes/libmicrohttpd/all/test_v1_package/conanfile.py b/recipes/libmicrohttpd/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libmicrohttpd/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libmicrohttpd/config.yml b/recipes/libmicrohttpd/config.yml new file mode 100644 index 00000000000000..48e6a23d34df6e --- /dev/null +++ b/recipes/libmicrohttpd/config.yml @@ -0,0 +1,3 @@ +versions: + "0.9.75": + folder: all From f0cdd767dc5b25acace1b82b22eea3bc3cb3b66c Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 20 Oct 2022 22:44:49 +0900 Subject: [PATCH 106/300] (#13608) aws-c-event-stream: change dependant recipe version for aws-crt-cpp * aws-c-event-stream: change dependant recipe version for aws-crt-cpp * link aws-c-io/0.13.4 on aws-c-event-stream/0.2.12 * fix condition for aws-c-io --- recipes/aws-c-event-stream/all/conanfile.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/recipes/aws-c-event-stream/all/conanfile.py b/recipes/aws-c-event-stream/all/conanfile.py index aa10e76f282620..25bb2fd989f0ad 100644 --- a/recipes/aws-c-event-stream/all/conanfile.py +++ b/recipes/aws-c-event-stream/all/conanfile.py @@ -52,7 +52,10 @@ def requirements(self): self.requires("aws-checksums/0.1.13") self.requires("aws-c-common/0.8.2") if Version(self.version) >= "0.2": - self.requires("aws-c-io/0.13.4") + if Version(self.version) < "0.2.11": + self.requires("aws-c-io/0.10.20") + else: + self.requires("aws-c-io/0.13.4") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -83,13 +86,15 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-event-stream") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-event-stream") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-event-stream" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-event-stream" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["aws-c-event-stream-lib"].names["cmake_find_package"] = "aws-c-event-stream" self.cpp_info.components["aws-c-event-stream-lib"].names["cmake_find_package_multi"] = "aws-c-event-stream" self.cpp_info.components["aws-c-event-stream-lib"].libs = ["aws-c-event-stream"] self.cpp_info.components["aws-c-event-stream-lib"].requires = ["aws-c-common::aws-c-common-lib", "aws-checksums::aws-checksums"] if Version(self.version) >= "0.2": self.cpp_info.components["aws-c-event-stream-lib"].requires.append("aws-c-io::aws-c-io-lib") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "aws-c-event-stream" + self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-event-stream" + self.cpp_info.names["cmake_find_package"] = "AWS" + self.cpp_info.names["cmake_find_package_multi"] = "AWS" From 86de5edf37c74befdcd1a318bee352d15a01e675 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 20 Oct 2022 16:25:52 +0200 Subject: [PATCH 107/300] (#13618) spdlog: several fixes for conan v2 client * several fixes for conan v2 client * remove skip pylint * minor changes in test package * typo --- recipes/spdlog/all/conanfile.py | 83 ++++++++----------- .../spdlog/all/test_package/CMakeLists.txt | 6 +- recipes/spdlog/all/test_package/conanfile.py | 8 +- .../spdlog/all/test_v1_package/CMakeLists.txt | 6 +- .../spdlog/all/test_v1_package/conanfile.py | 1 - 5 files changed, 46 insertions(+), 58 deletions(-) diff --git a/recipes/spdlog/all/conanfile.py b/recipes/spdlog/all/conanfile.py index 587094502d41f9..5bafad4b2bab49 100644 --- a/recipes/spdlog/all/conanfile.py +++ b/recipes/spdlog/all/conanfile.py @@ -1,18 +1,13 @@ -from conan import ConanFile +from conan import ConanFile, conan_version +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout from conan.tools.files import get, copy, rmdir, replace_in_file -from conan.tools.scm import Version from conan.tools.microsoft import is_msvc_static_runtime -from conan.tools.build import check_min_cppstd -from conan.errors import ConanInvalidConfiguration - -# TODO: Need to be ported for Conan 2.0 -from conans import __version__ as conan_version - +from conan.tools.scm import Version import os - -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class SpdlogConan(ConanFile): @@ -45,46 +40,45 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.shared: - del self.options.fPIC + if self.options.shared or self.options.header_only: + try: + del self.options.fPIC + except Exception: + pass if self.options.header_only: del self.options.shared - del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - # TODO: Remove in Conan 2.0 - 1.x self.requires does not support transitive_headers - requires = lambda ref: self.requires(ref, transitive_headers=True) if Version(conan_version) >= "2.0.0-beta" else self.requires(ref) if Version(self.version) >= "1.10.0": - requires("fmt/8.1.1") + self.requires("fmt/8.1.1", transitive_headers=True) elif Version(self.version) >= "1.9.0": - requires("fmt/8.0.1") + self.requires("fmt/8.0.1", transitive_headers=True) elif Version(self.version) >= "1.7.0": - requires("fmt/7.1.3") + self.requires("fmt/7.1.3", transitive_headers=True) elif Version(self.version) >= "1.5.0": - requires("fmt/6.2.1") + self.requires("fmt/6.2.1", transitive_headers=True) else: - requires("fmt/6.0.0") + self.requires("fmt/6.0.0", transitive_headers=True) def package_id(self): if self.info.options.header_only: self.info.clear() - def validate(self): + @property + def _info(self): # FIXME: Conan 1.x is not able to parse self.info.xxx as Conan 2.x when is header-only - if Version(conan_version) >= "2.0.0-beta": - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) - if self.info.settings.os != "Windows" and (self.info.options.wchar_support or self.info.options.wchar_filenames): - raise ConanInvalidConfiguration("wchar is only supported under windows") - if not self.info.options.header_only and self.info.options.shared and is_msvc_static_runtime(self): - raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") - else: - if self.settings.compiler.cppstd: - check_min_cppstd(self, 11) - if self.settings.os != "Windows" and (self.options.wchar_support or self.options.wchar_filenames): - raise ConanInvalidConfiguration("wchar is only supported under windows") - if self.options.get_safe("shared") and is_msvc_static_runtime(self): - raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") + return self if Version(conan_version).major < 2 else self.info + + def validate(self): + if self._info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self._info.settings.os != "Windows" and (self._info.options.wchar_support or self._info.options.wchar_filenames): + raise ConanInvalidConfiguration("wchar is only supported under windows") + if self._info.options.get_safe("shared") and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -112,9 +106,6 @@ def generate(self): cmake_deps = CMakeDeps(self) cmake_deps.generate() - def layout(self): - cmake_layout(self, src_folder="src") - def _disable_werror(self): replace_in_file(self, os.path.join(self.source_folder, "cmake", "utils.cmake"), "/WX", "") @@ -137,21 +128,13 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "spdlog", "cmake")) def package_info(self): - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "spdlog" - self.cpp_info.names["cmake_find_package_multi"] = "spdlog" - target = "spdlog_header_only" if self.options.header_only else "spdlog" self.cpp_info.set_property("cmake_file_name", "spdlog") self.cpp_info.set_property("cmake_target_name", f"spdlog::{target}") self.cpp_info.set_property("pkg_config_name", "spdlog") - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["libspdlog"].names["cmake_find_package"] = target - self.cpp_info.components["libspdlog"].names["cmake_find_package_multi"] = target - + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["libspdlog"].set_property("cmake_target_name", f"spdlog::{target}") - self.cpp_info.components["libspdlog"].defines.append("SPDLOG_FMT_EXTERNAL") self.cpp_info.components["libspdlog"].requires = ["fmt::fmt"] @@ -169,3 +152,9 @@ def package_info(self): self.cpp_info.components["libspdlog"].system_libs = ["pthread"] if self.options.header_only and self.settings.os in ("iOS", "tvOS", "watchOS"): self.cpp_info.components["libspdlog"].defines.append("SPDLOG_NO_TLS") + + if Version(conan_version).major < 2: + self.cpp_info.names["cmake_find_package"] = "spdlog" + self.cpp_info.names["cmake_find_package_multi"] = "spdlog" + self.cpp_info.components["libspdlog"].names["cmake_find_package"] = target + self.cpp_info.components["libspdlog"].names["cmake_find_package_multi"] = target diff --git a/recipes/spdlog/all/test_package/CMakeLists.txt b/recipes/spdlog/all/test_package/CMakeLists.txt index ea09f0379c1df4..d31b151d6390c7 100644 --- a/recipes/spdlog/all/test_package/CMakeLists.txt +++ b/recipes/spdlog/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(spdlog REQUIRED CONFIG) @@ -9,4 +9,4 @@ if(SPDLOG_HEADER_ONLY) else() target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog) endif() -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/spdlog/all/test_package/conanfile.py b/recipes/spdlog/all/test_package/conanfile.py index 955c3ad982c558..81d7c956cf9d2f 100644 --- a/recipes/spdlog/all/test_package/conanfile.py +++ b/recipes/spdlog/all/test_package/conanfile.py @@ -7,9 +7,12 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" + def layout(self): + cmake_layout(self) + def requirements(self): self.requires(self.tested_reference_str) @@ -18,9 +21,6 @@ def generate(self): tc.variables["SPDLOG_HEADER_ONLY"] = self.dependencies["spdlog"].options.header_only tc.generate() - def layout(self): - cmake_layout(self) - def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/spdlog/all/test_v1_package/CMakeLists.txt b/recipes/spdlog/all/test_v1_package/CMakeLists.txt index cd849cdc0106b4..d4c436ff651fbb 100644 --- a/recipes/spdlog/all/test_v1_package/CMakeLists.txt +++ b/recipes/spdlog/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) @@ -12,4 +12,4 @@ if(TARGET spdlog::spdlog_header_only) else() target_link_libraries(${PROJECT_NAME} spdlog::spdlog) endif() -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/spdlog/all/test_v1_package/conanfile.py b/recipes/spdlog/all/test_v1_package/conanfile.py index 7f150735d0b8a9..30ca1d12b0933d 100644 --- a/recipes/spdlog/all/test_v1_package/conanfile.py +++ b/recipes/spdlog/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os From 26482f91372185694dce3fff8bd2ae0711a49622 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 21 Oct 2022 10:25:16 +0200 Subject: [PATCH 108/300] (#13629) meson-template: several improvements - remove ninja from tool_requires, it's the job of meson recipe to require ninja or not - fix install_name of shared libs on macOS - do not add pkgconf to tool_requires if 'tools.gnu:pkg_config' config is set --- .../meson_package/all/conanfile.py | 34 ++++++++++--------- .../all/test_package/conanfile.py | 17 +++++----- .../all/test_v1_package/conanfile.py | 3 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/docs/package_templates/meson_package/all/conanfile.py b/docs/package_templates/meson_package/all/conanfile.py index 5305b9ba492e77..53a839176b8f24 100644 --- a/docs/package_templates/meson_package/all/conanfile.py +++ b/docs/package_templates/meson_package/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import check_min_vs, is_msvc -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.build import check_min_cppstd -from conan.tools.layout import basic_layout -from conan.tools.scm import Version +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain, MesonDeps -from conan.tools.env import VirtualBuildEnv +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version import os @@ -39,7 +40,7 @@ class PackageConan(ConanFile): } @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 17 # in case the project requires C++14/17/20/... the minimum compiler version should be listed @@ -87,14 +88,14 @@ def requirements(self): def validate(self): # validate the minimum cpp standard supported. For C++ projects only - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, self._minimum_cpp_standard) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) check_min_vs(self, 191) if not is_msvc(self): minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) # in case it does not work in another configuration, it should validated here too if is_msvc(self) and self.info.options.shared: @@ -102,13 +103,11 @@ def validate(self): # if another tool than the compiler or Meson is required to build the project (pkgconf, bison, flex etc) def build_requirements(self): - # Meson package is no installed by default on ConanCenterIndex CI + # CCI policy assumes that Meson may not be installed on consumers machine self.tool_requires("meson/0.63.3") - # pkgconf is largely used by Meson, in case needed on Windows, it should be added are build requirement - self.tool_requires("pkgconf/1.9.3") - # Meson uses Ninja as backend by default. Ninja package is not installed by default on ConanCenterIndex - if not self.conf.get("tools.meson.mesontoolchain:backend", default=False, check_type=str): - self.tool_requires("ninja/1.11.1") + # pkgconf is largely used by Meson, it should be added in build requirement when there are dependencies + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -130,7 +129,7 @@ def generate(self): tc.generate() # In case there are dependencies listed on build_requirements, VirtualBuildEnv should be used tc = VirtualBuildEnv(self) - tc.generate(scope="build") + tc.generate() def _patch_sources(self): apply_conandata_patches(self) @@ -154,6 +153,9 @@ def package(self): rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + # In shared lib/executable files, meson set install_name (macOS) to lib dir absolute path instead of @rpath, it's not relocatable, so fix it + fix_apple_shared_install_name(self) + def package_info(self): # avoid collect_libs(), prefer explicit library name instead self.cpp_info.libs = ["package_lib"] diff --git a/docs/package_templates/meson_package/all/test_package/conanfile.py b/docs/package_templates/meson_package/all/test_package/conanfile.py index 4738b8f8b2267f..287ce44d8a78e4 100644 --- a/docs/package_templates/meson_package/all/test_package/conanfile.py +++ b/docs/package_templates/meson_package/all/test_package/conanfile.py @@ -11,22 +11,21 @@ class TestPackageConan(ConanFile): generators = "PkgConfigDeps", "MesonToolchain", "VirtualRunEnv", "VirtualBuildEnv" test_type = "explicit" + def layout(self): + basic_layout(self) + def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): self.tool_requires("meson/0.63.3") - self.tool_requires("pkgconf/1.9.3") - if not self.conf.get("tools.meson.mesontoolchain:backend", default=False, check_type=str): - self.tools_requires("ninja/1.11.1") - - def layout(self): - basic_layout(self) + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def build(self): - cmake = Meson(self) - cmake.configure() - cmake.build() + meson = Meson(self) + meson.configure() + meson.build() def test(self): if can_run(self): diff --git a/docs/package_templates/meson_package/all/test_v1_package/conanfile.py b/docs/package_templates/meson_package/all/test_v1_package/conanfile.py index c571ed9e8d113f..c5b074313827df 100644 --- a/docs/package_templates/meson_package/all/test_v1_package/conanfile.py +++ b/docs/package_templates/meson_package/all/test_v1_package/conanfile.py @@ -9,9 +9,8 @@ class TestPackageV1Conan(ConanFile): generators = "pkg_config" def build_requirements(self): - self.build_requires("pkgconf/1.9.3") self.build_requires("meson/0.63.3") - self.build_requires("ninja/1.11.1") + self.build_requires("pkgconf/1.9.3") def build(self): meson = Meson(self) From ee8874d1e0eb68c29474cf5d8115554ba6b91fb0 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 21 Oct 2022 19:04:57 +0900 Subject: [PATCH 109/300] (#13633) aws-crt-cpp: add version 0.18.8 and suppport conan v2 * aws-crt-cpp: add version 0.18.8 and support conan v2 * modify mqtt, event-stream version --- recipes/aws-crt-cpp/all/CMakeLists.txt | 10 -- recipes/aws-crt-cpp/all/conandata.yml | 17 ++- recipes/aws-crt-cpp/all/conanfile.py | 105 ++++++++++-------- .../all/test_package/CMakeLists.txt | 9 +- .../aws-crt-cpp/all/test_package/conanfile.py | 21 +++- .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 17 +++ recipes/aws-crt-cpp/config.yml | 2 + 8 files changed, 121 insertions(+), 71 deletions(-) delete mode 100644 recipes/aws-crt-cpp/all/CMakeLists.txt create mode 100644 recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/aws-crt-cpp/all/test_v1_package/conanfile.py diff --git a/recipes/aws-crt-cpp/all/CMakeLists.txt b/recipes/aws-crt-cpp/all/CMakeLists.txt deleted file mode 100644 index 38522bd23de5d8..00000000000000 --- a/recipes/aws-crt-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-crt-cpp/all/conandata.yml b/recipes/aws-crt-cpp/all/conandata.yml index 723445d104dfe7..5615e65f10a0b8 100644 --- a/recipes/aws-crt-cpp/all/conandata.yml +++ b/recipes/aws-crt-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.18.8": + url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.18.8.tar.gz" + sha256: "70ea622cf8c1a7028b24078e909ee5898990444436584178f58d61b50b5b197d" "0.17.23": url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.17.23.tar.gz" sha256: "28061c3efa493519cfae46e4ea96389f03a81eeec7613d7da861dd8c5f4f6598" @@ -9,9 +12,15 @@ sources: url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.14.3.tar.gz" sha256: "3ea16c43e691bab0c373ba1ad072f6535390c516ebda658dfaf4d074d920e0fb" patches: + "0.18.8": + - patch_file: "patches/0.17.23-fix-cast-error.patch" + patch_description: "fix const cast error" + patch_type: "portability" "0.17.23": - - base_path: "source_subfolder" - patch_file: "patches/0.17.23-fix-cast-error.patch" + - patch_file: "patches/0.17.23-fix-cast-error.patch" + patch_description: "fix const cast error" + patch_type: "portability" "0.17.12": - - base_path: "source_subfolder" - patch_file: "patches/0.17.12-fix-cast-error.patch" + - patch_file: "patches/0.17.12-fix-cast-error.patch" + patch_description: "fix const cast error" + patch_type: "portability" diff --git a/recipes/aws-crt-cpp/all/conanfile.py b/recipes/aws-crt-cpp/all/conanfile.py index fb49c50bc21cd2..c70a676efc1024 100644 --- a/recipes/aws-crt-cpp/all/conanfile.py +++ b/recipes/aws-crt-cpp/all/conanfile.py @@ -1,16 +1,20 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class AwsCrtCpp(ConanFile): name = "aws-crt-cpp" description = "C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++." - topics = ("aws", "amazon", "cloud", "wrapper") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-crt-cpp" - license = "Apache-2.0", - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "wrapper") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,16 +25,12 @@ class AwsCrtCpp(ConanFile): "fPIC": True, } - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,55 +38,64 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-event-stream/0.2.7") - self.requires("aws-c-common/0.6.19") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") - self.requires("aws-c-auth/0.6.11") - self.requires("aws-c-mqtt/0.7.10") - self.requires("aws-c-s3/0.1.37") - self.requires("aws-checksums/0.1.12") + self.requires("aws-c-common/0.8.2") + self.requires("aws-checksums/0.1.13") + if Version(self.version) < "0.17.29": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + self.requires("aws-c-auth/0.6.11") + self.requires("aws-c-s3/0.1.37") + self.requires("aws-c-mqtt/0.7.10") + self.requires("aws-c-event-stream/0.2.7") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + self.requires("aws-c-auth/0.6.17") + self.requires("aws-c-s3/0.1.49") + self.requires("aws-c-mqtt/0.7.12") + self.requires("aws-c-event-stream/0.2.15") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["BUILD_DEPS"] = False - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_DEPS"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-crt-cpp")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-crt-cpp")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-crt-cpp") self.cpp_info.set_property("cmake_target_name", "AWS::aws-crt-cpp") - self.cpp_info.filenames["cmake_find_package"] = "aws-crt-cpp" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-crt-cpp" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["aws-crt-cpp-lib"].names["cmake_find_package"] = "aws-crt-cpp" self.cpp_info.components["aws-crt-cpp-lib"].names["cmake_find_package_multi"] = "aws-crt-cpp" self.cpp_info.components["aws-crt-cpp-lib"].libs = ["aws-crt-cpp"] @@ -100,3 +109,9 @@ def package_info(self): "aws-c-s3::aws-c-s3-lib", "aws-checksums::aws-checksums-lib" ] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "aws-crt-cpp" + self.cpp_info.filenames["cmake_find_package_multi"] = "aws-crt-cpp" + self.cpp_info.names["cmake_find_package"] = "AWS" + self.cpp_info.names["cmake_find_package_multi"] = "AWS" diff --git a/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt b/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt index 74debee402ca92..50b34b056a7877 100644 --- a/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt +++ b/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(aws-crt-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} AWS::aws-crt-cpp) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/aws-crt-cpp/all/test_package/conanfile.py b/recipes/aws-crt-cpp/all/test_package/conanfile.py index 49a3a66ea5bad4..a9fb96656f2039 100644 --- a/recipes/aws-crt-cpp/all/test_package/conanfile.py +++ b/recipes/aws-crt-cpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt b/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..31592420f8accb --- /dev/null +++ b/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-crt-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/aws-crt-cpp/all/test_v1_package/conanfile.py b/recipes/aws-crt-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..49a3a66ea5bad4 --- /dev/null +++ b/recipes/aws-crt-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-crt-cpp/config.yml b/recipes/aws-crt-cpp/config.yml index cd074764fbd37d..a2a8f6922a6028 100644 --- a/recipes/aws-crt-cpp/config.yml +++ b/recipes/aws-crt-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "0.18.8": + folder: all "0.17.23": folder: all "0.17.12": From 4b207085b84b5e3225e6ddbfa81e572d77def087 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Fri, 21 Oct 2022 06:07:10 -0500 Subject: [PATCH 110/300] (#13642) wayland-protocols: Check tools.gnu:pkg_config setting --- recipes/wayland-protocols/all/test_package/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/wayland-protocols/all/test_package/conanfile.py b/recipes/wayland-protocols/all/test_package/conanfile.py index 1dc365f849fd51..1466d1f78d85d6 100644 --- a/recipes/wayland-protocols/all/test_package/conanfile.py +++ b/recipes/wayland-protocols/all/test_package/conanfile.py @@ -21,7 +21,8 @@ def requirements(self): def build_requirements(self): self.tool_requires("meson/0.63.3") - self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") self.tool_requires("wayland/1.21.0") def layout(self): From 5d069ecc4ac10fca7a0eb8336b4fbbb5600d2aa1 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Fri, 21 Oct 2022 19:46:22 +0800 Subject: [PATCH 111/300] (#13622) libaec: upgrade for conan v2 * libaec - upgrade for conan v2 * Fix licence copy * Fix test_v1_package - use common file * Fix static/shared a better way * Update recipes/libaec/all/conanfile.py Co-authored-by: Uilian Ries * Update recipes/libaec/all/conanfile.py Co-authored-by: Uilian Ries Co-authored-by: Uilian Ries --- recipes/libaec/all/CMakeLists.txt | 9 -- recipes/libaec/all/conandata.yml | 3 - recipes/libaec/all/conanfile.py | 99 +++++++++---------- .../libaec/all/test_package/CMakeLists.txt | 3 - recipes/libaec/all/test_package/conanfile.py | 28 ++++-- .../libaec/all/test_v1_package/CMakeLists.txt | 10 ++ .../libaec/all/test_v1_package/conanfile.py | 19 ++++ 7 files changed, 97 insertions(+), 74 deletions(-) delete mode 100644 recipes/libaec/all/CMakeLists.txt create mode 100644 recipes/libaec/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libaec/all/test_v1_package/conanfile.py diff --git a/recipes/libaec/all/CMakeLists.txt b/recipes/libaec/all/CMakeLists.txt deleted file mode 100644 index 28b67888084129..00000000000000 --- a/recipes/libaec/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) - -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") - diff --git a/recipes/libaec/all/conandata.yml b/recipes/libaec/all/conandata.yml index 81bd3833b28141..fedb680f0ebb4f 100644 --- a/recipes/libaec/all/conandata.yml +++ b/recipes/libaec/all/conandata.yml @@ -8,9 +8,6 @@ sources: patches: "1.0.4": - patch_file: "patches/1.0.4-0001-Fix-static-library-builds.patch" - base_path: "source_subfolder" - patch_file: "patches/1.0.4-0002-fix-install-ios.patch" - base_path: "source_subfolder" "1.0.6": - patch_file: "patches/1.0.6-0001-fix-library-builds.patch" - base_path: "source_subfolder" diff --git a/recipes/libaec/all/conanfile.py b/recipes/libaec/all/conanfile.py index 5f628637c580f4..943870cdf6a8a5 100644 --- a/recipes/libaec/all/conanfile.py +++ b/recipes/libaec/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class LibaecConan(ConanFile): @@ -11,7 +15,7 @@ class LibaecConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.dkrz.de/k202009/libaec" description = "Adaptive Entropy Coding library" - topics = ("dsp", "libaec", "encoding", "decoding",) + topics = "dsp", "encoding", "decoding" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -21,25 +25,9 @@ class LibaecConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_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"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,14 +35,26 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if tools.Version(self.version) >= "1.0.6" and self._is_msvc: + if Version(self.version) >= "1.0.6" and is_msvc(self): # libaec/1.0.6 uses "restrict" keyword which seems to be supported since Visual Studio 16. - if tools.Version(self.settings.compiler.version) < "16": + if Version(self.settings.compiler.version) < "16": raise ConanInvalidConfiguration("{} does not support Visual Studio {}".format(self.name, self.settings.compiler.version)) # In libaec/1.0.6, fail to build aec_client command with debug and shared settings in Visual Studio. # Temporary, this recipe doesn't support these settings. @@ -62,46 +62,41 @@ def validate(self): raise ConanInvalidConfiguration("{} does not support debug and shared build in Visual Studio(currently)".format(self.name)) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) < "1.0.6": - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "add_subdirectory(tests)", "") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + if Version(self.version) < "1.0.6": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "add_subdirectory(tests)", "") + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - if tools.Version(self.version) < "1.0.6": - self.copy(pattern="Copyright.txt", dst="licenses", src=self._source_subfolder) + if Version(self.version) < "1.0.6": + copy(self, pattern="Copyright.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) else: - 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() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): aec_name = "aec" - if self.settings.os == "Windows" and tools.Version(self.version) >= "1.0.6" and not self.options.shared: + if self.settings.os == "Windows" and Version(self.version) >= "1.0.6" and not self.options.shared: aec_name = "aec_static" szip_name = "sz" if self.settings.os == "Windows": - if tools.Version(self.version) >= "1.0.6": + if Version(self.version) >= "1.0.6": szip_name = "szip" if self.options.shared else "szip_static" elif self.options.shared: szip_name = "szip" diff --git a/recipes/libaec/all/test_package/CMakeLists.txt b/recipes/libaec/all/test_package/CMakeLists.txt index 39f956e39b59ca..f87e0b5ca8eb98 100644 --- a/recipes/libaec/all/test_package/CMakeLists.txt +++ b/recipes/libaec/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1.3) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(libaec CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/libaec/all/test_package/conanfile.py b/recipes/libaec/all/test_package/conanfile.py index b07f7e5f677ac1..75526b1d02b79e 100644 --- a/recipes/libaec/all/test_package/conanfile.py +++ b/recipes/libaec/all/test_package/conanfile.py @@ -1,19 +1,33 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.dependencies["libaec"].ref.version) >= "1.0.6": + tc.variables["CMAKE_C_STANDARD"] = "11" + tc.generate() def build(self): cmake = CMake(self) - if tools.Version(self.deps_cpp_info["libaec"].version) >= "1.0.6": - cmake.definitions["CMAKE_C_STANDARD"] = "11" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libaec/all/test_v1_package/CMakeLists.txt b/recipes/libaec/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..454ad5fbc6eba1 --- /dev/null +++ b/recipes/libaec/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1.3) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libaec CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} libaec::libaec) diff --git a/recipes/libaec/all/test_v1_package/conanfile.py b/recipes/libaec/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..b07f7e5f677ac1 --- /dev/null +++ b/recipes/libaec/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + if tools.Version(self.deps_cpp_info["libaec"].version) >= "1.0.6": + cmake.definitions["CMAKE_C_STANDARD"] = "11" + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 5170e61963f7d5395244791ef5520e99cc4dc39c Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 21 Oct 2022 21:05:33 +0900 Subject: [PATCH 112/300] (#13654) daw_header_libraries: add version 2.72.0 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/daw_header_libraries/all/conandata.yml | 3 +++ recipes/daw_header_libraries/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/daw_header_libraries/all/conandata.yml b/recipes/daw_header_libraries/all/conandata.yml index 46964cc5f776ff..1096c3719c4e74 100644 --- a/recipes/daw_header_libraries/all/conandata.yml +++ b/recipes/daw_header_libraries/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.72.0": + url: "https://github.com/beached/header_libraries/archive/v2.72.0.tar.gz" + sha256: "f681755183af4af35f4741f3bcb7d99c6707911806e39e3acc982f9532aacc08" "2.71.0": url: "https://github.com/beached/header_libraries/archive/v2.71.0.tar.gz" sha256: "50b9ddebdbc808a5714408a45f686fafe9d1d3b78c988df3973c12c9928828b9" diff --git a/recipes/daw_header_libraries/config.yml b/recipes/daw_header_libraries/config.yml index fddfdcec535bcd..2a15faca97b8eb 100644 --- a/recipes/daw_header_libraries/config.yml +++ b/recipes/daw_header_libraries/config.yml @@ -1,4 +1,6 @@ versions: + "2.72.0": + folder: all "2.71.0": folder: all "2.68.3": From f862a06c35869ad48eed0dd71b614e9ea7be92e3 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 21 Oct 2022 14:46:02 +0200 Subject: [PATCH 113/300] (#13601) android-ndk: fix for conan 2.x client * improve support for conan 2.x client * put ndk in bin folder instead of root folder * move update of bindirs after 2 profiles protection * use relative paths in bindirs * add a comment about sysroot * define tools.build:sysroot * cleanup --- recipes/android-ndk/all/conanfile.py | 144 +++++++++++++-------------- 1 file changed, 69 insertions(+), 75 deletions(-) diff --git a/recipes/android-ndk/all/conanfile.py b/recipes/android-ndk/all/conanfile.py index 290a4f0c04da2d..cf7fce07c64ba5 100644 --- a/recipes/android-ndk/all/conanfile.py +++ b/recipes/android-ndk/all/conanfile.py @@ -1,12 +1,13 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration from conan.tools.files import get, download, unzip, load, copy from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os import re import shutil -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class AndroidNDKConan(ConanFile): @@ -38,6 +39,9 @@ def _settings_os_supported(self): def _settings_arch_supported(self): return self.conan_data["sources"][self.version].get(str(self.settings.os), {}).get(str(self._arch)) is not None + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): if self._is_universal2: self.info.settings.arch = "universal:armv8/x86_64" @@ -50,9 +54,6 @@ def validate(self): if not self._settings_arch_supported: raise ConanInvalidConfiguration(f"os,arch={self.settings.os},{self.settings.arch} is not supported by {self.name} (no binaries are available)") - def layout(self): - basic_layout(self, src_folder="src") - def source(self): pass @@ -65,11 +66,11 @@ def build(self): destination=self.source_folder, strip_root=True) def package(self): - copy(self, "*", src=self.source_folder, dst=self.package_folder, keep_path=True) + copy(self, "*", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) copy(self, "*NOTICE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) copy(self, "*NOTICE.toolchain", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - copy(self, "cmake-wrapper.cmd", src=os.path.join(self.source_folder, os.pardir), dst=self.package_folder) - copy(self, "cmake-wrapper", src=os.path.join(self.source_folder, os.pardir), dst=self.package_folder) + copy(self, "cmake-wrapper.cmd", src=os.path.join(self.source_folder, os.pardir), dst=os.path.join(self.package_folder, "bin")) + copy(self, "cmake-wrapper", src=os.path.join(self.source_folder, os.pardir), dst=os.path.join(self.package_folder, "bin")) self._fix_broken_links() self._fix_permissions() @@ -133,7 +134,7 @@ def _ndk_version_minor(self): def _fix_permissions(self): if os.name != "posix": return - for root, _, files in os.walk(self.package_folder): + for root, _, files in os.walk(os.path.join(self.package_folder, "bin")): for filename in files: filename = os.path.join(root, filename) with open(filename, "rb") as f: @@ -169,7 +170,7 @@ def _fix_broken_links(self): f"toolchains/llvm/prebuilt/{platform}-x86_64/x86_64-linux-android/bin/as": "../../bin/x86_64-linux-android-as", f"toolchains/llvm/prebuilt/{platform}-x86_64/i686-linux-android/bin/as": "../../bin/i686-linux-android-as"} for path, target in links.items(): - path = os.path.join(self.package_folder, path) + path = os.path.join(self.package_folder, "bin", path) os.unlink(path) os.symlink(target, path) @@ -177,9 +178,13 @@ def _fix_broken_links(self): def _host(self): return f"{self._platform}-{self._arch}" + @property + def _ndk_root_rel_path(self): + return os.path.join("bin", "toolchains", "llvm", "prebuilt", self._host) + @property def _ndk_root(self): - return os.path.join(self.package_folder, "toolchains", "llvm", "prebuilt", self._host) + return os.path.join(self.package_folder, self._ndk_root_rel_path) def _wrap_executable(self, tool): suffix = ".exe" if self.settings_build.os == "Windows" else "" @@ -220,7 +225,6 @@ def _define_tool_var(self, name, value, bare = False): if not os.path.isfile(path): self.output.error(f"'Environment variable {name} could not be created: '{path}'") return "UNKNOWN" - self.output.info(f"Creating {name} environment variable: {path}") return path def _define_tool_var_naked(self, name, value): @@ -229,7 +233,6 @@ def _define_tool_var_naked(self, name, value): if not os.path.isfile(path): self.output.error(f"'Environment variable {name} could not be created: '{path}'") return "UNKNOWN" - self.output.info(f"Creating {name} environment variable: {path}") return path @staticmethod @@ -239,17 +242,14 @@ def _chmod_plus_x(filename): def package_info(self): self.cpp_info.includedirs = [] - - # test shall pass, so this runs also in the build as build requirement context - # ndk-build: https://developer.android.com/ndk/guides/ndk-build - self.cpp_info.bindirs.append(".") + self.cpp_info.libdirs = [] # You should use the ANDROID_NDK_ROOT environment variable to indicate where the NDK is located. # That's what most NDK-related scripts use (inside the NDK, and outside of it). # https://groups.google.com/g/android-ndk/c/qZjhOaynHXc - self.buildenv_info.define_path("ANDROID_NDK_ROOT", self.package_folder) + self.buildenv_info.define_path("ANDROID_NDK_ROOT", os.path.join(self.package_folder, "bin")) - self.buildenv_info.define_path("ANDROID_NDK_HOME", self.package_folder) + self.buildenv_info.define_path("ANDROID_NDK_HOME", os.path.join(self.package_folder, "bin")) # this is not enough, I can kill that ..... if not hasattr(self, "settings_target"): @@ -265,31 +265,21 @@ def package_info(self): self.output.warn(f"You've added {self.name}/{self.version} as a build requirement, while os={self.settings_target.os} != Android") return + self.cpp_info.bindirs.append(os.path.join(self._ndk_root_rel_path, "bin")) + self.buildenv_info.define_path("NDK_ROOT", self._ndk_root) self.buildenv_info.define("CHOST", self._llvm_triplet) ndk_sysroot = os.path.join(self._ndk_root, "sysroot") + self.conf_info.define("tools.build:sysroot", ndk_sysroot) self.buildenv_info.define_path("SYSROOT", ndk_sysroot) - self.cpp_info.sysroot = ndk_sysroot - self.buildenv_info.define("ANDROID_NATIVE_API_LEVEL", str(self.settings_target.os.api_level)) - # TODO: It's not clear how this all mechanism of cmake-wrapper should be emulated in conan v2, - # and actually if it matters at all. - # Is it not the purpose of the toolchain defined later to pass all these informations? - self._chmod_plus_x(os.path.join(self.package_folder, "cmake-wrapper")) - cmake_wrapper = "cmake-wrapper.cmd" if self.settings.os == "Windows" else "cmake-wrapper" - cmake_wrapper = os.path.join(self.package_folder, cmake_wrapper) - self.output.info(f"Creating CONAN_CMAKE_PROGRAM environment variable: {cmake_wrapper}") - self.env_info.CONAN_CMAKE_PROGRAM = cmake_wrapper - - toolchain = os.path.join(self.package_folder, "build", "cmake", "android.toolchain.cmake") - - #CMakeToolchain automatically adds the standard Android toolchain file that ships with the NDK - #when `tools.android:ndk_path` is provided, so there's no need to add it as a `user_toolchain` - self.conf_info.define("tools.android:ndk_path", self.package_folder) + # CMakeToolchain automatically adds the standard Android toolchain file that ships with the NDK + # when `tools.android:ndk_path` is provided, so it MUST NOT be manually injected here to `tools.cmake.cmaketoolchain:user_toolchain` conf_info + self.conf_info.define("tools.android:ndk_path", os.path.join(self.package_folder, "bin")) self.buildenv_info.define_path("CC", self._define_tool_var("CC", "clang")) self.buildenv_info.define_path("CXX", self._define_tool_var("CXX", "clang++")) @@ -322,47 +312,51 @@ def package_info(self): libcxx_str = str(self.settings_target.compiler.libcxx) self.buildenv_info.define("ANDROID_STL", libcxx_str if libcxx_str.startswith("c++_") else "c++_shared") - # TODO: conan v1 stuff to remove later - self.env_info.PATH.append(self.package_folder) - self.env_info.ANDROID_NDK_ROOT = self.package_folder - self.env_info.ANDROID_NDK_HOME = self.package_folder - cmake_system_processor = self._cmake_system_processor - if cmake_system_processor: - self.env_info.CONAN_CMAKE_SYSTEM_PROCESSOR = cmake_system_processor - else: - self.output.warn("Could not find a valid CMAKE_SYSTEM_PROCESSOR variable, supported by CMake") - self.env_info.NDK_ROOT = self._ndk_root - self.env_info.CHOST = self._llvm_triplet - self.env_info.CONAN_CMAKE_FIND_ROOT_PATH = ndk_sysroot - self.env_info.SYSROOT = ndk_sysroot - self.env_info.ANDROID_NATIVE_API_LEVEL = str(self.settings_target.os.api_level) - self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain - self.env_info.CC = self._define_tool_var("CC", "clang") - self.env_info.CXX = self._define_tool_var("CXX", "clang++") - self.env_info.AR = self._define_tool_var("AR", "ar", bare) - self.env_info.AS = self._define_tool_var("AS", "as", bare) - self.env_info.RANLIB = self._define_tool_var("RANLIB", "ranlib", bare) - self.env_info.STRIP = self._define_tool_var("STRIP", "strip", bare) - self.env_info.ADDR2LINE = self._define_tool_var("ADDR2LINE", "addr2line", bare) - self.env_info.NM = self._define_tool_var("NM", "nm", bare) - self.env_info.OBJCOPY = self._define_tool_var("OBJCOPY", "objcopy", bare) - self.env_info.OBJDUMP = self._define_tool_var("OBJDUMP", "objdump", bare) - self.env_info.READELF = self._define_tool_var("READELF", "readelf", bare) - if self._ndk_version_major < 23: - self.env_info.ELFEDIT = self._define_tool_var("ELFEDIT", "elfedit") - if self._ndk_version_major >= 22: - self.env_info.LD = self._define_tool_var_naked("LD", "ld") - else: - self.env_info.LD = self._define_tool_var("LD", "ld") - self.env_info.ANDROID_PLATFORM = f"android-{self.settings_target.os.api_level}" - self.env_info.ANDROID_TOOLCHAIN = "clang" - self.env_info.ANDROID_ABI = self._android_abi - self.env_info.ANDROID_STL = libcxx_str if libcxx_str.startswith("c++_") else "c++_shared" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH" + if Version(conan_version).major < 2: + self.env_info.PATH.extend([os.path.join(self.package_folder, "bin"), os.path.join(self._ndk_root, "bin")]) + self.env_info.ANDROID_NDK_ROOT = os.path.join(self.package_folder, "bin") + self.env_info.ANDROID_NDK_HOME = os.path.join(self.package_folder, "bin") + cmake_system_processor = self._cmake_system_processor + if cmake_system_processor: + self.env_info.CONAN_CMAKE_SYSTEM_PROCESSOR = cmake_system_processor + else: + self.output.warn("Could not find a valid CMAKE_SYSTEM_PROCESSOR variable, supported by CMake") + self.env_info.NDK_ROOT = self._ndk_root + self.env_info.CHOST = self._llvm_triplet + self.env_info.CONAN_CMAKE_FIND_ROOT_PATH = ndk_sysroot + self.env_info.SYSROOT = ndk_sysroot + self.env_info.ANDROID_NATIVE_API_LEVEL = str(self.settings_target.os.api_level) + self._chmod_plus_x(os.path.join(self.package_folder, "bin", "cmake-wrapper")) + cmake_wrapper = "cmake-wrapper.cmd" if self.settings.os == "Windows" else "cmake-wrapper" + cmake_wrapper = os.path.join(self.package_folder, "bin", cmake_wrapper) + self.env_info.CONAN_CMAKE_PROGRAM = cmake_wrapper + self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = os.path.join(self.package_folder, "bin", "build", "cmake", "android.toolchain.cmake") + self.env_info.CC = self._define_tool_var("CC", "clang") + self.env_info.CXX = self._define_tool_var("CXX", "clang++") + self.env_info.AR = self._define_tool_var("AR", "ar", bare) + self.env_info.AS = self._define_tool_var("AS", "as", bare) + self.env_info.RANLIB = self._define_tool_var("RANLIB", "ranlib", bare) + self.env_info.STRIP = self._define_tool_var("STRIP", "strip", bare) + self.env_info.ADDR2LINE = self._define_tool_var("ADDR2LINE", "addr2line", bare) + self.env_info.NM = self._define_tool_var("NM", "nm", bare) + self.env_info.OBJCOPY = self._define_tool_var("OBJCOPY", "objcopy", bare) + self.env_info.OBJDUMP = self._define_tool_var("OBJDUMP", "objdump", bare) + self.env_info.READELF = self._define_tool_var("READELF", "readelf", bare) + if self._ndk_version_major < 23: + self.env_info.ELFEDIT = self._define_tool_var("ELFEDIT", "elfedit") + if self._ndk_version_major >= 22: + self.env_info.LD = self._define_tool_var_naked("LD", "ld") + else: + self.env_info.LD = self._define_tool_var("LD", "ld") + self.env_info.ANDROID_PLATFORM = f"android-{self.settings_target.os.api_level}" + self.env_info.ANDROID_TOOLCHAIN = "clang" + self.env_info.ANDROID_ABI = self._android_abi + self.env_info.ANDROID_STL = libcxx_str if libcxx_str.startswith("c++_") else "c++_shared" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH" def _unzip_fix_symlinks(self, url, target_folder, sha256): # Python's built-in module 'zipfile' won't handle symlinks (https://bugs.python.org/issue37921) From 027420964e73d9a665968eebca08e53dc601fbd7 Mon Sep 17 00:00:00 2001 From: theirix Date: Fri, 21 Oct 2022 16:29:38 +0300 Subject: [PATCH 114/300] (#13587) libexif: add 0.6.24 + conan v2 support * Add version 0.6.24 * Update to Conan 2.0 * Use compile wrappers for msvc env * Use direct msvc tool names * Replaces slashes * Do not autoreconfigure (fails on Windows) * Use tool requires * Set pkg_config_name * Convert DESTDIR to unix path * Handle msvc and Visual Studio compilers Co-authored-by: Jordan Williams Co-authored-by: Jordan Williams --- recipes/libexif/all/conandata.yml | 6 +- recipes/libexif/all/conanfile.py | 115 +++++++++++++++--------------- recipes/libexif/config.yml | 2 + 3 files changed, 66 insertions(+), 57 deletions(-) diff --git a/recipes/libexif/all/conandata.yml b/recipes/libexif/all/conandata.yml index b80594e2484180..ae774e1c9a024b 100644 --- a/recipes/libexif/all/conandata.yml +++ b/recipes/libexif/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "0.6.24": + url: "https://github.com/libexif/libexif/releases/download/v0.6.23/libexif-0.6.23.tar.gz" + sha256: "9271cf58cb46b00f9e2e9b968c7d81c008a69e5457f7d1a50dbf1786eac61b52" "0.6.23": url: "https://github.com/libexif/libexif/releases/download/v0.6.23/libexif-0.6.23.tar.gz" sha256: "9271cf58cb46b00f9e2e9b968c7d81c008a69e5457f7d1a50dbf1786eac61b52" patches: + "0.6.24": + - patch_file: patches/replace_ssize_t_windows.diff "0.6.23": - patch_file: patches/replace_ssize_t_windows.diff - base_path: source_subfolder diff --git a/recipes/libexif/all/conanfile.py b/recipes/libexif/all/conanfile.py index 5c818871ce0c1a..8b251e32d12381 100644 --- a/recipes/libexif/all/conanfile.py +++ b/recipes/libexif/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -import contextlib +from conan import ConanFile +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy, rename, rmdir, rm, export_conandata_patches, apply_conandata_patches +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class LibexifConan(ConanFile): @@ -12,7 +17,6 @@ class LibexifConan(ConanFile): license = "LGPL-2.1" description = "libexif is a library for parsing, editing, and saving EXIF data." topics = ("exif", "metadata", "parse", "edit") - exports_sources = "patches/*" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,29 +26,20 @@ class LibexifConan(ConanFile): "shared": False, "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "AR": "lib", - "LD": "link -nologo", - } - with tools.environment_append(env): - yield - else: - yield + @property + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def layout(self): + basic_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -57,56 +52,64 @@ def configure(self): del self.settings.compiler.cppstd def build_requirements(self): - self.build_requires("gettext/0.21") - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + self.tool_requires("gettext/0.21") + self.tool_requires("libtool/2.4.6") + if self._settings_build.os == "Windows": + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") + self.win_bash = True def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - self._autotools.libs = [] - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - args = [ + tc.configure_args.extend([ "--enable-shared={}".format(yes_no(self.options.shared)), "--enable-static={}".format(yes_no(not self.options.shared)), "--disable-docs", "--disable-nls", "--disable-rpath", - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + ]) + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + + # env vars + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self._user_info_build["automake"].compile).replace("\\", "/") + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib).replace("\\", "/") + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.define("LD", f"{compile_wrapper} link -nologo") + + tc.generate(env) + + env = VirtualBuildEnv(self) + env.generate() def build(self): - self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - if self.settings.compiler == "Visual Studio" and self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "exif.dll.lib"), + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "exif.dll.lib"), os.path.join(self.package_folder, "lib", "exif.lib")) - tools.remove_files_by_mask(self.package_folder, "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["exif"] self.cpp_info.names["pkg_config"] = "libexif" + self.cpp_info.set_property("pkg_config_name", "libexif") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["m"] diff --git a/recipes/libexif/config.yml b/recipes/libexif/config.yml index e252661bf796f9..d4a99779aab918 100644 --- a/recipes/libexif/config.yml +++ b/recipes/libexif/config.yml @@ -1,3 +1,5 @@ versions: + "0.6.24": + folder: all "0.6.23": folder: all From 0852a3177e09014fe48d2ab9d371039332b11bee Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 21 Oct 2022 16:09:52 +0200 Subject: [PATCH 115/300] (#13632) meson: handle `tools.meson.mesontoolchain:backend` & fix for conan v2 client * do not require ninja if user set another meson backend * fix for conan v2 client * bump ninja Co-authored-by: Jordan Williams Co-authored-by: Jordan Williams --- recipes/meson/all/conanfile.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/recipes/meson/all/conanfile.py b/recipes/meson/all/conanfile.py index dfb05d6d59a9e9..8168d4afa4b4fc 100644 --- a/recipes/meson/all/conanfile.py +++ b/recipes/meson/all/conanfile.py @@ -1,10 +1,11 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.files import copy, get, rmdir, save from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class MesonConan(ConanFile): @@ -21,15 +22,16 @@ class MesonConan(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): - self.requires("ninja/1.11.0") + if self.conf.get("tools.meson.mesontoolchain:backend", default=False, check_type=str) in (False, "ninja"): + self.requires("ninja/1.11.1") def package_id(self): self.info.clear() - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -78,15 +80,13 @@ def _chmod_plus_x(filename): def package_info(self): meson_root = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {meson_root}") - self.env_info.PATH.append(meson_root) - self._chmod_plus_x(os.path.join(meson_root, "meson")) self._chmod_plus_x(os.path.join(meson_root, "meson.py")) self.cpp_info.builddirs = [os.path.join("bin", "mesonbuild", "cmake", "data")] - self.cpp_info.frameworkdirs = [] self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] + + if Version(conan_version).major < 2: + self.env_info.PATH.append(meson_root) From 9ac069ddad06209e230e5a1d23eecf85a8c8bba6 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 21 Oct 2022 17:14:42 +0200 Subject: [PATCH 116/300] (#13636) autotools template: several improvements * improve autotools template - handle windows as build machine - handle `tools.gnu:pkg_config` config - handle msvc - fix install_name of shared libs on macOS - call VirtualBuildEnv & VirtualRunEnv first in generate to avoid side effects * typo --- .../autotools_package/all/conanfile.py | 91 ++++++++++++++----- .../all/test_package/CMakeLists.txt | 7 +- .../all/test_package/conanfile.py | 6 +- .../all/test_v1_package/CMakeLists.txt | 7 +- 4 files changed, 76 insertions(+), 35 deletions(-) diff --git a/docs/package_templates/autotools_package/all/conanfile.py b/docs/package_templates/autotools_package/all/conanfile.py index 4bb09b14191989..31cbae159751fe 100644 --- a/docs/package_templates/autotools_package/all/conanfile.py +++ b/docs/package_templates/autotools_package/all/conanfile.py @@ -1,10 +1,12 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.build import check_min_cppstd, cross_building -from conan.tools.files import copy, get, rm, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os @@ -37,6 +39,14 @@ class PackageConan(ConanFile): "with_foobar": True, } + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + @property + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + # no exports_sources attribute, but export_sources(self) method instead # this allows finer grain exportation of patches per version def export_sources(self): @@ -75,64 +85,99 @@ def requirements(self): def validate(self): # validate the minimum cpp standard supported. Only for C++ projects - if self.info.settings.compiler.cppstd: + if self.info.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) if self.info.settings.os not in ["Linux", "FreeBSD", "MacOS"]: raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.info.settings.os}.") # if another tool than the compiler or autotools is required to build the project (pkgconf, bison, flex etc) def build_requirements(self): + # only if we have to call autoreconf self.tool_requires("libtool/x.y.z") - self.tool_requires("pkgconf/x.y.z") + # only if upstream configure.ac relies on PKG_CHECK_MODULES macro + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/x.y.z") + # required to suppport windows as a build machine + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + # for msvc support to get compile & ar-lib scripts (may be avoided if shipped in source code of the library) + if is_msvc(self): + self.tool_requires("automake/x.y.z") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): - # autotools usually uses 'yes' and 'no' to enable/disable options - yes_no = lambda v: "yes" if v else "no" + # inject tools_requires env vars in build scope (not needed if there is no tool_requires) + env = VirtualBuildEnv(self) + env.generate() + # inject requires env vars in build scope + # it's required in case of native build when there is AutotoolsDeps & at least one dependency which might be shared, because configure tries to run a test executable + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") # --fpic is automatically managed when 'fPIC'option is declared # --enable/disable-shared is automatically managed when 'shared' option is declared tc = AutotoolsToolchain(self) - tc.configure_args.append("--with-foobar=%s" % yes_no(self.options.with_foobar)) - tc.configure_args.append("--enable-tools=no") - tc.configure_args.append("--enable-manpages=no") + # autotools usually uses 'yes' and 'no' to enable/disable options + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--with-foobar={yes_no(self.options.with_foobar)}", + "--enable-tools=no", + "--enable-manpages=no", + ]) tc.generate() - # generate dependencies for pkg-config + # generate pkg-config files of dependencies (useless if upstream configure.ac doesn't rely on PKG_CHECK_MODULES macro) tc = PkgConfigDeps(self) tc.generate() # generate dependencies for autotools tc = AutotoolsDeps(self) tc.generate() - # inject tools_requires env vars in build scope (not needed if there is no tool_requires) - env = VirtualBuildEnv(self) - env.generate() - # inject requires env vars in build scope - # it's required in case of native build when there is AutotoolsDeps & at least one dependency which might be shared, because configure tries to run a test executable - if not cross_building(self): - env = VirtualRunEnv(self) - env.generate(scope="build") + + # If Visual Studio is supported + if is_msvc(self): + env = Environment() + # get compile & ar-lib from automake (or eventually lib source code if available) + # it's not always required to wrap CC, CXX & AR with these scripts, it depends on how much love was put in + # upstream build files + compile_wrapper = unix_path(self, self._user_info_build["automake"].compile) + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_msvc") def build(self): # apply patches listed in conandata.yml apply_conandata_patches(self) autotools = Autotools(self) - # run autoreconf to generate configure file + # (optional) run autoreconf to regenerate configure file (libtool should be in tool_requires) autotools.autoreconf() # ./configure + toolchain file autotools.configure() autotools.make() def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) - autotools.install() + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) # some files extensions and folders are not allowed. Please, read the FAQs to get informed. rm(self, "*.la", os.path.join(self.package_folder, "lib")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "share")) + # In shared lib/executable files, autotools set install_name (macOS) to lib dir absolute path instead of @rpath, it's not relocatable, so fix it + fix_apple_shared_install_name(self) + def package_info(self): self.cpp_info.libs = ["package_lib"] @@ -141,6 +186,4 @@ def package_info(self): # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") - self.cpp_info.system_libs.append("pthread") - self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) diff --git a/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt b/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt index dcb2919e205976..d5f12b4376cdb4 100644 --- a/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt +++ b/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt @@ -1,7 +1,6 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -# project(test_package CXX) # if the project uses c++ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) # if the project is pure C +# project(test_package LANGUAGES CXX) # if the project uses c++ find_package(package REQUIRED CONFIG) diff --git a/docs/package_templates/autotools_package/all/test_package/conanfile.py b/docs/package_templates/autotools_package/all/test_package/conanfile.py index 1111583fea732f..48499fa0989d9c 100644 --- a/docs/package_templates/autotools_package/all/test_package/conanfile.py +++ b/docs/package_templates/autotools_package/all/test_package/conanfile.py @@ -10,12 +10,12 @@ class TestPackageConan(ConanFile): generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) - def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt b/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt index 4af742edc09e7f..ac1ad5974dd0f6 100644 --- a/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt @@ -1,7 +1,6 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -# project(test_package CXX) # if the project uses c++ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) # if the project is pure C +# project(test_package LANGUAGES CXX) # if the project uses c++ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) From f2a80c14068cbd9c8dccfe5e903d6ff4cf79fb91 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 21 Oct 2022 17:33:02 +0200 Subject: [PATCH 117/300] (#13649) fp16: conan v2 support --- recipes/fp16/all/conandata.yml | 6 ++-- recipes/fp16/all/conanfile.py | 36 +++++++++++-------- recipes/fp16/all/test_package/CMakeLists.txt | 11 +++--- recipes/fp16/all/test_package/conanfile.py | 19 +++++++--- .../fp16/all/test_v1_package/CMakeLists.txt | 11 ++++++ recipes/fp16/all/test_v1_package/conanfile.py | 17 +++++++++ recipes/fp16/config.yml | 4 +-- 7 files changed, 74 insertions(+), 30 deletions(-) create mode 100644 recipes/fp16/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/fp16/all/test_v1_package/conanfile.py diff --git a/recipes/fp16/all/conandata.yml b/recipes/fp16/all/conandata.yml index 21f0e1bd08b324..cf80322a4b8bb2 100644 --- a/recipes/fp16/all/conandata.yml +++ b/recipes/fp16/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "cci.20200514": - url: "https://github.com/Maratyszcza/FP16/archive/4dfe081cf6bcd15db339cf2680b9281b8451eeb3.zip" - sha256: "d973501a40c55126b31accc2d9f08d931ec3cc190c0430309a5e341d3c0ce32a" "cci.20210320": url: "https://github.com/Maratyszcza/FP16/archive/0a92994d729ff76a58f692d3028ca1b64b145d91.zip" sha256: "e66e65515fa09927b348d3d584c68be4215cfe664100d01c9dbc7655a5716d70" + "cci.20200514": + url: "https://github.com/Maratyszcza/FP16/archive/4dfe081cf6bcd15db339cf2680b9281b8451eeb3.zip" + sha256: "d973501a40c55126b31accc2d9f08d931ec3cc190c0430309a5e341d3c0ce32a" diff --git a/recipes/fp16/all/conanfile.py b/recipes/fp16/all/conanfile.py index 971e7f2d0585dd..75666c9f3bd71c 100644 --- a/recipes/fp16/all/conanfile.py +++ b/recipes/fp16/all/conanfile.py @@ -1,33 +1,41 @@ -from conans import ConanFile, tools -import glob +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.52.0" + class Fp16Conan(ConanFile): name = "fp16" description = "Conversion to/from half-precision floating point formats." license = "MIT" - topics = ("conan", "fp16", "half-precision-floating-point") + topics = ("half-precision-floating-point") homepage = "https://github.com/Maratyszcza/FP16" url = "https://github.com/conan-io/conan-center-index" - + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("psimd/cci.20200517") + self.requires("psimd/cci.20200517", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("FP16-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/fp16/all/test_package/CMakeLists.txt b/recipes/fp16/all/test_package/CMakeLists.txt index fd126a732c403b..1e502f0857d7c5 100644 --- a/recipes/fp16/all/test_package/CMakeLists.txt +++ b/recipes/fp16/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(fp16 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE fp16::fp16) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/fp16/all/test_package/conanfile.py b/recipes/fp16/all/test_package/conanfile.py index 5216332f39f5ca..0a6bc68712d901 100644 --- a/recipes/fp16/all/test_package/conanfile.py +++ b/recipes/fp16/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fp16/all/test_v1_package/CMakeLists.txt b/recipes/fp16/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..d609dc2f83e681 --- /dev/null +++ b/recipes/fp16/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(fp16 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE fp16::fp16) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/fp16/all/test_v1_package/conanfile.py b/recipes/fp16/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/fp16/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fp16/config.yml b/recipes/fp16/config.yml index 5fda81fa041c92..97367a08f7fea5 100644 --- a/recipes/fp16/config.yml +++ b/recipes/fp16/config.yml @@ -1,5 +1,5 @@ versions: - "cci.20200514": - folder: all "cci.20210320": folder: all + "cci.20200514": + folder: all From a7ee4fb2276c90851df16879bb4b2a499abdd3a3 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Fri, 21 Oct 2022 11:15:54 -0500 Subject: [PATCH 118/300] (#13612) xkbcommon: Use PkgConfigDeps build context for wayland * xkbcommon: Use PkgConfigDeps build context for wayland * xkbcommon: finer grain requirements * Place build context pkg-config files in a separate directory * Move comment to a better spot * Fix Apple shared install name and pkg-config conf Co-authored-by: ericLemanissier --- recipes/xkbcommon/all/conanfile.py | 100 ++++++++++++------ .../xkbcommon/all/test_package/conanfile.py | 1 + 2 files changed, 67 insertions(+), 34 deletions(-) diff --git a/recipes/xkbcommon/all/conanfile.py b/recipes/xkbcommon/all/conanfile.py index f4a785f15eee62..40d3c56584b835 100644 --- a/recipes/xkbcommon/all/conanfile.py +++ b/recipes/xkbcommon/all/conanfile.py @@ -1,23 +1,27 @@ +import glob import os +import shutil from conan import ConanFile -from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, mkdir, replace_in_file, rmdir +from conan.tools.gnu import PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class XkbcommonConan(ConanFile): name = "xkbcommon" description = "keymap handling library for toolkits and window systems" - topics = ("xkbcommon", "keyboard") + topics = ("keyboard") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xkbcommon/libxkbcommon" license = "MIT" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,7 +38,9 @@ class XkbcommonConan(ConanFile): "xkbregistry": True, } - generators = "PkgConfigDeps", "VirtualBuildEnv" + @property + def _has_build_profile(self): + return hasattr(self, "settings_build") @property def _has_xkbregistry_option(self): @@ -48,9 +54,18 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def requirements(self): self.requires("xkeyboard-config/system") @@ -60,54 +75,69 @@ def requirements(self): self.requires("libxml2/2.9.14") if self.options.get_safe("with_wayland"): self.requires("wayland/1.21.0") - self.requires("wayland-protocols/1.26") # FIXME: This should be a build-requires + if not self._has_build_profile: + self.requires("wayland-protocols/1.27") def validate(self): - if self.settings.os not in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration("This library is only compatible with Linux or FreeBSD") + if self.info.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration(f"{self.ref} is only compatible with Linux and FreeBSD") def build_requirements(self): - self.tool_requires("meson/0.63.1") - self.tool_requires("bison/3.7.6") - self.tool_requires("pkgconf/1.7.4") - if hasattr(self, "settings_build") and self.options.get_safe("with_wayland"): + self.tool_requires("meson/0.63.3") + self.tool_requires("bison/3.8.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._has_build_profile and self.options.get_safe("with_wayland"): self.tool_requires("wayland/1.21.0") + self.tool_requires("wayland-protocols/1.27") def layout(self): basic_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def generate(self): tc = MesonToolchain(self) - - tc.project_options["libexecdir"] = "bin" - tc.project_options["libdir"] = "lib" - tc.project_options["datadir"] = "res" - tc.project_options["enable-docs"] = False tc.project_options["enable-wayland"] = self.options.get_safe("with_wayland", False) tc.project_options["enable-x11"] = self.options.with_x11 - if self._has_xkbregistry_option: tc.project_options["enable-xkbregistry"] = self.options.xkbregistry + if self._has_build_profile: + tc.project_options["build.pkg_config_path"] = os.path.join(self.generators_folder, "build") tc.generate() + pkg_config_deps = PkgConfigDeps(self) + if self._has_build_profile and self.options.get_safe("with_wayland"): + pkg_config_deps.build_context_activated = ["wayland", "wayland-protocols"] + pkg_config_deps.build_context_suffix = {"wayland": "_BUILD"} + pkg_config_deps.generate() + if self._has_build_profile and self.options.get_safe("with_wayland"): + mkdir(self, os.path.join(self.generators_folder, "build")) + for pc in glob.glob(os.path.join(self.generators_folder, "*_BUILD.pc")): + original_pc = os.path.basename(pc)[:-9] + ".pc" + shutil.move(pc, os.path.join(self.generators_folder, "build", original_pc)) + + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + def build(self): # Conan doesn't provide a `wayland-scanner.pc` file for the package in the _build_ context - meson_build_file = os.path.join(self.source_folder, "meson.build") - replace_in_file(self, meson_build_file, - "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", - "# wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)") + if self.options.get_safe("with_wayland") and not self._has_build_profile: + meson_build_file = os.path.join(self.source_folder, "meson.build") + replace_in_file(self, meson_build_file, + "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", + "# wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)") - replace_in_file(self, meson_build_file, - "if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()", - "if not wayland_client_dep.found() or not wayland_protocols_dep.found()") + replace_in_file(self, meson_build_file, + "if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()", + "if not wayland_client_dep.found() or not wayland_protocols_dep.found()") - replace_in_file(self, meson_build_file, - "wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))", - "wayland_scanner = find_program('wayland-scanner')") + replace_in_file(self, meson_build_file, + "wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))", + "wayland_scanner = find_program('wayland-scanner')") meson = Meson(self) meson.configure() @@ -117,6 +147,7 @@ def package(self): copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) meson = Meson(self) meson.install() + fix_apple_shared_install_name(self) rmdir(self, os.path.join(self.package_folder, "share")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) @@ -135,10 +166,11 @@ def package_info(self): self.cpp_info.components["libxkbregistry"].libs = ["xkbregistry"] self.cpp_info.components["libxkbregistry"].requires = ["libxml2::libxml2"] if self.options.get_safe("with_wayland", False): - # FIXME: This generates just executable, but I need to use the requirements to pass Conan checks self.cpp_info.components["xkbcli-interactive-wayland"].libs = [] self.cpp_info.components["xkbcli-interactive-wayland"].includedirs = [] - self.cpp_info.components["xkbcli-interactive-wayland"].requires = ["wayland::wayland", "wayland-protocols::wayland-protocols"] + self.cpp_info.components["xkbcli-interactive-wayland"].requires = ["wayland::wayland-client"] + if not self._has_build_profile: + self.cpp_info.components["xkbcli-interactive-wayland"].requires.append("wayland-protocols::wayland-protocols") if Version(self.version) >= "1.0.0": bindir = os.path.join(self.package_folder, "bin") diff --git a/recipes/xkbcommon/all/test_package/conanfile.py b/recipes/xkbcommon/all/test_package/conanfile.py index 622d31592b6f43..b521c572cd6837 100644 --- a/recipes/xkbcommon/all/test_package/conanfile.py +++ b/recipes/xkbcommon/all/test_package/conanfile.py @@ -9,6 +9,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) From 4924cfdf7f385b1ac6b54f3b252381c3876c14ed Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 21 Oct 2022 23:22:04 +0200 Subject: [PATCH 119/300] (#13644) header-only template: several improvements - handle self.info in validate() - transitive headers of direct dependencies - remove build_requirements --- .../header_only/all/conanfile.py | 35 +++++++++---------- .../all/test_package/CMakeLists.txt | 5 ++- .../header_only/all/test_package/conanfile.py | 6 ++-- .../all/test_v1_package/CMakeLists.txt | 5 ++- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/docs/package_templates/header_only/all/conanfile.py b/docs/package_templates/header_only/all/conanfile.py index a9310252571ff4..99bcc94e5e166c 100644 --- a/docs/package_templates/header_only/all/conanfile.py +++ b/docs/package_templates/header_only/all/conanfile.py @@ -1,9 +1,9 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy from conan.tools.build import check_min_cppstd -from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os @@ -25,7 +25,7 @@ class PackageConan(ConanFile): no_copy_source = True # do not copy sources to build folder for header only projects, unless, need to apply patches @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 14 # in case the project requires C++14/17/20/... the minimum compiler version should be listed @@ -50,30 +50,31 @@ def layout(self): def requirements(self): # prefer self.requires method instead of requires attribute - self.requires("dependency/0.8.1") + # direct dependencies of header only libs are always transitive since they are included in public headers + self.requires("dependency/0.8.1", transitive_headers=True) # same package ID for any package def package_id(self): self.info.clear() + @property + def _info(self): + return self if Version(conan_version).major < 2 else self.info + def validate(self): # compiler subsettings are not available when building with self.info.clear() - if self.info.settings.get_safe("compiler.cppstd"): + if self._info.settings.compiler.get_safe("cppstd"): # validate the minimum cpp standard supported when installing the package. For C++ projects only - check_min_cppstd(self, self._minimum_cpp_standard) - minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version and Version(self.info.settings.get_safe("compiler.version")) < minimum_version: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self._info.settings.compiler), False) + if minimum_version and Version(self._info.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) # in case it does not work in another configuration, it should validated here too - if self.info.settings.os == "Windows": + if self._info.settings.os == "Windows": raise ConanInvalidConfiguration(f"{self.ref} can not be used on Windows.") - # if another tool than the compiler or CMake is required to build the project (pkgconf, bison, flex etc) - def build_requirements(self): - self.tool_requires("tool/x.y.z") - def source(self): # download source package and extract to source folder get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -110,9 +111,7 @@ def package_info(self): # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") - self.cpp_info.system_libs.append("pthread") - self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "PACKAGE" diff --git a/docs/package_templates/header_only/all/test_package/CMakeLists.txt b/docs/package_templates/header_only/all/test_package/CMakeLists.txt index d36b7fedf54ae0..58ff75575bd54b 100644 --- a/docs/package_templates/header_only/all/test_package/CMakeLists.txt +++ b/docs/package_templates/header_only/all/test_package/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +project(test_package LANGUAGES C) # if the project is pure C +project(test_package LANGUAGES CXX) # if the project uses c++ find_package(package REQUIRED CONFIG) diff --git a/docs/package_templates/header_only/all/test_package/conanfile.py b/docs/package_templates/header_only/all/test_package/conanfile.py index 1111583fea732f..48499fa0989d9c 100644 --- a/docs/package_templates/header_only/all/test_package/conanfile.py +++ b/docs/package_templates/header_only/all/test_package/conanfile.py @@ -10,12 +10,12 @@ class TestPackageConan(ConanFile): generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) - def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt b/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt index 5e77e4ac4b188c..3c858b5777694a 100644 --- a/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +project(test_package LANGUAGES C) # if the project is pure C +project(test_package LANGUAGES CXX) # if the project uses c++ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) From 18dda6ce7770941c603c9503004867d3a60cb3e6 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 21 Oct 2022 23:44:42 +0200 Subject: [PATCH 120/300] (#13647) pcre2: bump zlib * pcre2: bump zlib * no pylint skip for pcre2's test package --- recipes/pcre2/all/conanfile.py | 2 +- recipes/pcre2/all/test_v1_package/conanfile.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/pcre2/all/conanfile.py b/recipes/pcre2/all/conanfile.py index 6b04391177a909..9c0c5f3407f587 100644 --- a/recipes/pcre2/all/conanfile.py +++ b/recipes/pcre2/all/conanfile.py @@ -69,7 +69,7 @@ def configure(self): def requirements(self): if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.get_safe("with_bzip2"): self.requires("bzip2/1.0.8") diff --git a/recipes/pcre2/all/test_v1_package/conanfile.py b/recipes/pcre2/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/pcre2/all/test_v1_package/conanfile.py +++ b/recipes/pcre2/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os From 4bff4d2b6f23af11c580252c12a11cf9f247b062 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 22 Oct 2022 00:24:53 +0200 Subject: [PATCH 121/300] (#13659) cpuinfo: conan v2 support * conan v2 support * cast to str for cache_variables --- recipes/cpuinfo/all/CMakeLists.txt | 7 +- recipes/cpuinfo/all/conanfile.py | 94 ++++++++++--------- .../cpuinfo/all/test_package/CMakeLists.txt | 11 +-- recipes/cpuinfo/all/test_package/conanfile.py | 19 +++- .../all/test_v1_package/CMakeLists.txt | 11 +++ .../cpuinfo/all/test_v1_package/conanfile.py | 17 ++++ 6 files changed, 98 insertions(+), 61 deletions(-) create mode 100644 recipes/cpuinfo/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/cpuinfo/all/test_v1_package/conanfile.py diff --git a/recipes/cpuinfo/all/CMakeLists.txt b/recipes/cpuinfo/all/CMakeLists.txt index b00769ce686e3d..e40870cb28701a 100644 --- a/recipes/cpuinfo/all/CMakeLists.txt +++ b/recipes/cpuinfo/all/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(NOT CMAKE_SYSTEM_PROCESSOR) +if(NOT CMAKE_SYSTEM_PROCESSOR AND CONAN_CPUINFO_SYSTEM_PROCESSOR) set(CMAKE_SYSTEM_PROCESSOR ${CONAN_CPUINFO_SYSTEM_PROCESSOR}) endif() -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/cpuinfo/all/conanfile.py b/recipes/cpuinfo/all/conanfile.py index 1e97cdf620d4c6..8c665b04ef10eb 100644 --- a/recipes/cpuinfo/all/conanfile.py +++ b/recipes/cpuinfo/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.51.1" class CpuinfoConan(ConanFile): @@ -11,8 +13,7 @@ class CpuinfoConan(ConanFile): description = "cpuinfo is a library to detect essential for performance " \ "optimization information about host CPU." license = "BSD-2-Clause" - topics = ("cpuinfo", "cpu", "cpuid", "cpu-cache", "cpu-model", - "instruction-set", "cpu-topology") + topics = ("cpu", "cpuid", "cpu-cache", "cpu-model", "instruction-set", "cpu-topology") homepage = "https://github.com/pytorch/cpuinfo" url = "https://github.com/conan-io/conan-center-index" @@ -29,11 +30,6 @@ class CpuinfoConan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -41,60 +37,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.os == "Windows" and self.options.shared: + if self.info.settings.os == "Windows" and self.info.options.shared: raise ConanInvalidConfiguration("shared cpuinfo not supported on Windows") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "SET_PROPERTY(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON)", - "") - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) # cpuinfo - cmake.definitions["CPUINFO_LIBRARY_TYPE"] = "default" - cmake.definitions["CPUINFO_RUNTIME_TYPE"] = "default" - cmake.definitions["CPUINFO_LOG_LEVEL"] = self.options.log_level - cmake.definitions["CPUINFO_BUILD_TOOLS"] = False - cmake.definitions["CPUINFO_BUILD_UNIT_TESTS"] = False - cmake.definitions["CPUINFO_BUILD_MOCK_TESTS"] = False - cmake.definitions["CPUINFO_BUILD_BENCHMARKS"] = False + tc.cache_variables["CPUINFO_LIBRARY_TYPE"] = "default" + tc.cache_variables["CPUINFO_RUNTIME_TYPE"] = "default" + # TODO: remove str cast in conan 1.53.0 (see https://github.com/conan-io/conan/pull/12086) + tc.cache_variables["CPUINFO_LOG_LEVEL"] = str(self.options.log_level) + tc.variables["CPUINFO_BUILD_TOOLS"] = False + tc.variables["CPUINFO_BUILD_UNIT_TESTS"] = False + tc.variables["CPUINFO_BUILD_MOCK_TESTS"] = False + tc.variables["CPUINFO_BUILD_BENCHMARKS"] = False # clog (always static) - cmake.definitions["CLOG_RUNTIME_TYPE"] = "default" - cmake.definitions["CLOG_BUILD_TESTS"] = False - cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - + tc.cache_variables["CLOG_RUNTIME_TYPE"] = "default" + tc.variables["CLOG_BUILD_TESTS"] = False + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) # CMAKE_SYSTEM_PROCESSOR must be manually set if cross-building - if tools.cross_building(self): + if cross_building(self): cmake_system_processor = { "armv8": "arm64", "armv8.3": "arm64", }.get(str(self.settings.arch), str(self.settings.arch)) - cmake.definitions["CONAN_CPUINFO_SYSTEM_PROCESSOR"] = cmake_system_processor + tc.variables["CONAN_CPUINFO_SYSTEM_PROCESSOR"] = cmake_system_processor + tc.generate() - cmake.configure() - return cmake + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "SET_PROPERTY(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON)", + "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libcpuinfo") diff --git a/recipes/cpuinfo/all/test_package/CMakeLists.txt b/recipes/cpuinfo/all/test_package/CMakeLists.txt index adb88fd87c22f6..f7fd88969d977e 100644 --- a/recipes/cpuinfo/all/test_package/CMakeLists.txt +++ b/recipes/cpuinfo/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(cpuinfo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} cpuinfo::cpuinfo) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE cpuinfo::cpuinfo) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/cpuinfo/all/test_package/conanfile.py b/recipes/cpuinfo/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/cpuinfo/all/test_package/conanfile.py +++ b/recipes/cpuinfo/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt b/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..7b06d2e30ef81f --- /dev/null +++ b/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(cpuinfo REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE cpuinfo::cpuinfo) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/cpuinfo/all/test_v1_package/conanfile.py b/recipes/cpuinfo/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/cpuinfo/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 5dad5f6cef31da827db7a059c14b521f3b6cb325 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 22 Oct 2022 00:44:20 +0200 Subject: [PATCH 122/300] (#13663) sfml: conan v2 support --- recipes/sfml/all/CMakeLists.txt | 7 - recipes/sfml/all/conandata.yml | 4 - recipes/sfml/all/conanfile.py | 121 +++++++++--------- .../patches/0001-cmake-robust-find-deps.patch | 14 +- recipes/sfml/all/test_package/CMakeLists.txt | 7 +- recipes/sfml/all/test_package/conanfile.py | 31 +++-- .../sfml/all/test_v1_package/CMakeLists.txt | 33 +++++ recipes/sfml/all/test_v1_package/conanfile.py | 21 +++ 8 files changed, 148 insertions(+), 90 deletions(-) delete mode 100644 recipes/sfml/all/CMakeLists.txt create mode 100644 recipes/sfml/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/sfml/all/test_v1_package/conanfile.py diff --git a/recipes/sfml/all/CMakeLists.txt b/recipes/sfml/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33fc..00000000000000 --- a/recipes/sfml/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/sfml/all/conandata.yml b/recipes/sfml/all/conandata.yml index 64dd59ed97e613..7ee890396d833d 100644 --- a/recipes/sfml/all/conandata.yml +++ b/recipes/sfml/all/conandata.yml @@ -5,10 +5,6 @@ sources: patches: "2.5.1": - patch_file: "patches/0001-cmake-robust-find-deps.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-allow-non-x86-64-macos.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-allow-shared-MT.patch" - base_path: "source_subfolder" - patch_file: "patches/0004-fix-ios.patch" - base_path: "source_subfolder" diff --git a/recipes/sfml/all/conanfile.py b/recipes/sfml/all/conanfile.py index 55652e00fcd95b..fbbe0cc38f82f7 100644 --- a/recipes/sfml/all/conanfile.py +++ b/recipes/sfml/all/conanfile.py @@ -1,18 +1,20 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools import os import textwrap -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.52.0" class SfmlConan(ConanFile): name = "sfml" description = "Simple and Fast Multimedia Library." license = "Zlib" - topics = ("sfml", "multimedia", "games", "graphics", "audio") + topics = ("multimedia", "games", "graphics", "audio") homepage = "https://www.sfml-dev.org" url = "https://github.com/conan-io/conan-center-index" @@ -34,20 +36,8 @@ class SfmlConan(ConanFile): "audio": True, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -55,7 +45,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.window: @@ -65,73 +61,72 @@ def requirements(self): self.requires("libudev/system") self.requires("xorg/system") if self.options.graphics: - self.requires("freetype/2.11.1") + self.requires("freetype/2.12.1") self.requires("stb/cci.20210910") if self.options.audio: self.requires("flac/1.3.3") - self.requires("openal/1.21.1") + self.requires("openal/1.22.2") self.requires("vorbis/1.3.7") def validate(self): - if self.settings.os not in ["Windows", "Linux", "FreeBSD", "Android", "Macos", "iOS"]: - raise ConanInvalidConfiguration("SFML not supported on {}".format(self.settings.os)) - if self.options.graphics and not self.options.window: + if self.info.settings.os not in ["Windows", "Linux", "FreeBSD", "Android", "Macos", "iOS"]: + raise ConanInvalidConfiguration(f"{self.ref} not supported on {self.info.settings.os}") + if self.info.options.graphics and not self.info.options.window: raise ConanInvalidConfiguration("sfml:graphics=True requires sfml:window=True") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - tools.rmdir(os.path.join(self._source_subfolder, "extlibs")) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SFML_DEPENDENCIES_INSTALL_PREFIX"] = self.package_folder - cmake.definitions["SFML_MISC_INSTALL_PREFIX"] = os.path.join(self.package_folder, "licenses").replace("\\", "/") - cmake.definitions["SFML_BUILD_WINDOW"] = self.options.window - cmake.definitions["SFML_BUILD_GRAPHICS"] = self.options.graphics - cmake.definitions["SFML_BUILD_NETWORK"] = self.options.network - cmake.definitions["SFML_BUILD_AUDIO"] = self.options.audio - cmake.definitions["SFML_INSTALL_PKGCONFIG_FILES"] = False - cmake.definitions["SFML_GENERATE_PDB"] = False - cmake.definitions["SFML_USE_SYSTEM_DEPS"] = True + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + rmdir(self, os.path.join(self.source_folder, "extlibs")) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["SFML_DEPENDENCIES_INSTALL_PREFIX"] = self.package_folder.replace("\\", "/") + tc.cache_variables["SFML_MISC_INSTALL_PREFIX"] = os.path.join(self.package_folder, "licenses").replace("\\", "/") + tc.variables["SFML_BUILD_WINDOW"] = self.options.window + tc.variables["SFML_BUILD_GRAPHICS"] = self.options.graphics + tc.variables["SFML_BUILD_NETWORK"] = self.options.network + tc.variables["SFML_BUILD_AUDIO"] = self.options.audio + tc.variables["SFML_INSTALL_PKGCONFIG_FILES"] = False + tc.variables["SFML_GENERATE_PDB"] = False + tc.variables["SFML_USE_SYSTEM_DEPS"] = True if is_msvc(self): - cmake.definitions["SFML_USE_STATIC_STD_LIBS"] = is_msvc_static_runtime(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["SFML_USE_STATIC_STD_LIBS"] = is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {values["target"]: "SFML::{}".format(component) for component, values in self._sfml_components.items()} + {values["target"]: f"SFML::{component}" for component, values in self._sfml_components.items()} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _sfml_components(self): @@ -166,7 +161,7 @@ def log(): return ["log"] if self.settings.os == "Android" else [] def foundation(): - return ["Foundation"] if tools.is_apple_os(self.settings.os) else [] + return ["Foundation"] if is_apple_os(self) else [] def appkit(): return ["AppKit"] if self.settings.os == "Macos" else [] @@ -204,15 +199,15 @@ def opengles_ios(): sfml_components = { "system": { "target": "sfml-system", - "libs": ["sfml-system{}".format(suffix)], + "libs": [f"sfml-system{suffix}"], "system_libs": winmm() + pthread() + rt() + android() + log(), }, } if self.settings.os in ["Windows", "Android", "iOS"]: sfml_main_suffix = "-d" if self.settings.build_type == "Debug" else "" - sfmlmain_libs = ["sfml-main{}".format(sfml_main_suffix)] + sfmlmain_libs = [f"sfml-main{sfml_main_suffix}"] if self.settings.os == "Android": - sfmlmain_libs.append("sfml-activity{}".format(suffix)) + sfmlmain_libs.append(f"sfml-activity{suffix}") sfml_components.update({ "main": { "target": "sfml-main", @@ -224,7 +219,7 @@ def opengles_ios(): sfml_components.update({ "window": { "target": "sfml-window", - "libs": ["sfml-window{}".format(suffix)], + "libs": [f"sfml-window{suffix}"], "requires": ["system"] + opengl() + xorg() + libudev(), "system_libs": gdi32() + winmm() + usbhid() + android() + opengles_android(), "frameworks": foundation() + appkit() + iokit() + carbon() + @@ -236,7 +231,7 @@ def opengles_ios(): sfml_components.update({ "graphics": { "target": "sfml-graphics", - "libs": ["sfml-graphics{}".format(suffix)], + "libs": [f"sfml-graphics{suffix}"], "requires": ["window", "freetype::freetype", "stb::stb"], }, }) @@ -244,7 +239,7 @@ def opengles_ios(): sfml_components.update({ "network": { "target": "sfml-network", - "libs": ["sfml-network{}".format(suffix)], + "libs": [f"sfml-network{suffix}"], "requires": ["system"], "system_libs": ws2_32(), }, @@ -253,7 +248,7 @@ def opengles_ios(): sfml_components.update({ "audio": { "target": "sfml-audio", - "libs": ["sfml-audio{}".format(suffix)], + "libs": [f"sfml-audio{suffix}"], "requires": ["system", "flac::flac", "openal::openal", "vorbis::vorbis"], "system_libs": android(), }, diff --git a/recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch b/recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch index 118af3f23f3842..b2a851662076de 100644 --- a/recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch +++ b/recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch @@ -66,13 +66,23 @@ set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib") --- a/src/SFML/Graphics/CMakeLists.txt +++ b/src/SFML/Graphics/CMakeLists.txt -@@ -134,8 +134,8 @@ if(SFML_OS_ANDROID) +@@ -97,7 +97,8 @@ sfml_add_library(sfml-graphics + target_link_libraries(sfml-graphics PUBLIC sfml-window) + + # stb_image sources +-target_include_directories(sfml-graphics PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image") ++find_package(stb REQUIRED CONFIG) ++target_link_libraries(sfml-graphics PRIVATE stb::stb) + + # let CMake know about our additional graphics libraries paths + if(SFML_OS_WINDOWS) +@@ -134,8 +135,8 @@ if(SFML_OS_ANDROID) target_link_libraries(sfml-graphics PRIVATE z EGL GLESv1_CM) endif() -sfml_find_package(Freetype INCLUDE "FREETYPE_INCLUDE_DIRS" LINK "FREETYPE_LIBRARY") -target_link_libraries(sfml-graphics PRIVATE Freetype) -+find_package(Freetype REQUIRED) ++find_package(Freetype REQUIRED MODULE) +target_link_libraries(sfml-graphics PRIVATE Freetype::Freetype) # add preprocessor symbols diff --git a/recipes/sfml/all/test_package/CMakeLists.txt b/recipes/sfml/all/test_package/CMakeLists.txt index 4eae723c4335e2..b5272094f7cb4f 100644 --- a/recipes/sfml/all/test_package/CMakeLists.txt +++ b/recipes/sfml/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) add_executable(${PROJECT_NAME} test_package.cpp) @@ -30,4 +27,4 @@ if(SFML_WITH_AUDIO) endif() find_package(SFML REQUIRED ${SFML_COMPONENTS} CONFIG) -target_link_libraries(${PROJECT_NAME} ${SFML_TARGETS}) +target_link_libraries(${PROJECT_NAME} PRIVATE ${SFML_TARGETS}) diff --git a/recipes/sfml/all/test_package/conanfile.py b/recipes/sfml/all/test_package/conanfile.py index d431379ec6c216..166801a7f9deb7 100644 --- a/recipes/sfml/all/test_package/conanfile.py +++ b/recipes/sfml/all/test_package/conanfile.py @@ -1,21 +1,34 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SFML_WITH_WINDOW"] = self.dependencies["sfml"].options.window + tc.variables["SFML_WITH_GRAPHICS"] = self.dependencies["sfml"].options.graphics + tc.variables["SFML_WITH_NETWORK"] = self.dependencies["sfml"].options.network + tc.variables["SFML_WITH_AUDIO"] = self.dependencies["sfml"].options.audio + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["SFML_WITH_WINDOW"] = self.options["sfml"].window - cmake.definitions["SFML_WITH_GRAPHICS"] = self.options["sfml"].graphics - cmake.definitions["SFML_WITH_NETWORK"] = self.options["sfml"].network - cmake.definitions["SFML_WITH_AUDIO"] = self.options["sfml"].audio cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sfml/all/test_v1_package/CMakeLists.txt b/recipes/sfml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..5ac31c943d9c4b --- /dev/null +++ b/recipes/sfml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) + +set(SFML_COMPONENTS system) +set(SFML_TARGETS sfml-system) +if(SFML_WITH_WINDOW) + target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_WINDOW) + list(APPEND SFML_COMPONENTS window) + list(APPEND SFML_TARGETS sfml-window) +endif() +if(SFML_WITH_GRAPHICS) + target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_GRAPHICS) + list(APPEND SFML_COMPONENTS graphics) + list(APPEND SFML_TARGETS sfml-graphics) +endif() +if(SFML_WITH_NETWORK) + target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_NETWORK) + list(APPEND SFML_COMPONENTS network) + list(APPEND SFML_TARGETS sfml-network) +endif() +if(SFML_WITH_AUDIO) + target_compile_definitions(${PROJECT_NAME} PRIVATE SFML_WITH_AUDIO) + list(APPEND SFML_COMPONENTS audio) + list(APPEND SFML_TARGETS sfml-audio) +endif() + +find_package(SFML REQUIRED ${SFML_COMPONENTS} CONFIG) +target_link_libraries(${PROJECT_NAME} PRIVATE ${SFML_TARGETS}) diff --git a/recipes/sfml/all/test_v1_package/conanfile.py b/recipes/sfml/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..d431379ec6c216 --- /dev/null +++ b/recipes/sfml/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["SFML_WITH_WINDOW"] = self.options["sfml"].window + cmake.definitions["SFML_WITH_GRAPHICS"] = self.options["sfml"].graphics + cmake.definitions["SFML_WITH_NETWORK"] = self.options["sfml"].network + cmake.definitions["SFML_WITH_AUDIO"] = self.options["sfml"].audio + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From dd9380ffaa9daab3536cb68a304a4f1972c2332b Mon Sep 17 00:00:00 2001 From: Conan Center Index Bot <54393557+conan-center-bot@users.noreply.github.com> Date: Sat, 22 Oct 2022 04:33:50 +0200 Subject: [PATCH 123/300] (#13627) [bot] Add Access Request users (2022-10-20) --- .c3i/authorized_users.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index b3998b2377562c..b82bcf03f12e7e 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -957,3 +957,6 @@ authorized_users: - "jwidauer" - "partiallyderived" - "Ahajha" + - "mjimenofluendo" + - "jiaoew1991" + - "ramin-raeisi" From 60b30ab03a49e74a1e48e746ce468cd6828c6bed Mon Sep 17 00:00:00 2001 From: Vladyslav Usenko Date: Sat, 22 Oct 2022 05:24:45 +0200 Subject: [PATCH 124/300] (#13661) sophus: add version 22.10 * sophus: add version 22.10 * Removed pylint skip-file to fix CI --- recipes/sophus/all/conandata.yml | 3 +++ recipes/sophus/all/conanfile.py | 4 +++- recipes/sophus/all/test_v1_package/conanfile.py | 1 - recipes/sophus/config.yml | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/recipes/sophus/all/conandata.yml b/recipes/sophus/all/conandata.yml index ec1a0a9c4fc2e0..cc44a93d244708 100644 --- a/recipes/sophus/all/conandata.yml +++ b/recipes/sophus/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "22.10": + url: "https://github.com/strasdat/Sophus/archive/refs/tags/v22.10.tar.gz" + sha256: "270709b83696da179447cf743357e36a8b9bc8eed5ff4b9d66d33fe691010bad" "22.04.1": url: "https://github.com/strasdat/Sophus/archive/refs/tags/v22.04.1.tar.gz" sha256: "635dc536e7768c91e89d537608226b344eef901b51fbc51c9f220c95feaa0b54" diff --git a/recipes/sophus/all/conanfile.py b/recipes/sophus/all/conanfile.py index de0219b9e8d9a3..6b71153ca93405 100644 --- a/recipes/sophus/all/conanfile.py +++ b/recipes/sophus/all/conanfile.py @@ -26,7 +26,9 @@ class SophusConan(ConanFile): def requirements(self): self.requires("eigen/3.4.0") - if self.options.with_fmt and Version(self.version) >= Version("22.04.1"): + if self.options.with_fmt and Version(self.version) >= Version("22.10"): + self.requires("fmt/9.1.0") + elif self.options.with_fmt and Version(self.version) >= Version("22.04.1"): self.requires("fmt/8.1.1") def package_id(self): diff --git a/recipes/sophus/all/test_v1_package/conanfile.py b/recipes/sophus/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/sophus/all/test_v1_package/conanfile.py +++ b/recipes/sophus/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/sophus/config.yml b/recipes/sophus/config.yml index 2994f26022b9b2..89d44f82139c33 100644 --- a/recipes/sophus/config.yml +++ b/recipes/sophus/config.yml @@ -1,4 +1,6 @@ versions: + "22.10": + folder: all "22.04.1": folder: all "1.0.0": From 010c142bd05ae6a29667797010ecf70c5040dc85 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 22 Oct 2022 05:44:39 +0200 Subject: [PATCH 125/300] (#13648) xnnpack: conan v2 support * conan v2 support * bump cpuinfo --- recipes/xnnpack/all/CMakeLists.txt | 44 ++++--- recipes/xnnpack/all/conandata.yml | 24 ++-- recipes/xnnpack/all/conanfile.py | 119 ++++++++++-------- .../xnnpack/all/test_package/CMakeLists.txt | 11 +- recipes/xnnpack/all/test_package/conanfile.py | 19 ++- .../all/test_v1_package/CMakeLists.txt | 11 ++ .../xnnpack/all/test_v1_package/conanfile.py | 17 +++ recipes/xnnpack/config.yml | 8 +- 8 files changed, 154 insertions(+), 99 deletions(-) create mode 100644 recipes/xnnpack/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/xnnpack/all/test_v1_package/conanfile.py diff --git a/recipes/xnnpack/all/CMakeLists.txt b/recipes/xnnpack/all/CMakeLists.txt index 297289017d3032..cde962d5658e31 100644 --- a/recipes/xnnpack/all/CMakeLists.txt +++ b/recipes/xnnpack/all/CMakeLists.txt @@ -1,25 +1,35 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.15) project(cmake_wrapper) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_library(cpuinfo INTERFACE IMPORTED) -add_library(clog INTERFACE IMPORTED) -set_property(TARGET cpuinfo PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::cpuinfo) -set_property(TARGET clog PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::cpuinfo) +if(NOT CMAKE_SYSTEM_PROCESSOR AND CONAN_XNNPACK_SYSTEM_PROCESSOR) + set(CMAKE_SYSTEM_PROCESSOR ${CONAN_XNNPACK_SYSTEM_PROCESSOR}) +endif() -add_library(pthreadpool INTERFACE IMPORTED) -set_property(TARGET pthreadpool PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::pthreadpool) +find_package(cpuinfo REQUIRED CONFIG) +if(NOT TARGET cpuinfo) + add_library(cpuinfo INTERFACE IMPORTED) + set_property(TARGET cpuinfo PROPERTY INTERFACE_LINK_LIBRARIES cpuinfo::cpuinfo) +endif() +if(NOT TARGET clog) + add_library(clog INTERFACE IMPORTED) + set_property(TARGET clog PROPERTY INTERFACE_LINK_LIBRARIES cpuinfo::cpuinfo) +endif() -add_library(fxdiv INTERFACE IMPORTED) -set_property(TARGET fxdiv PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::fxdiv) +find_package(pthreadpool REQUIRED CONFIG) +if(NOT TARGET pthreadpool) + add_library(pthreadpool INTERFACE IMPORTED) + set_property(TARGET pthreadpool PROPERTY INTERFACE_LINK_LIBRARIES pthreadpool::pthreadpool) +endif() -add_library(fp16 INTERFACE IMPORTED) -set_property(TARGET fp16 PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::fp16) +find_package(fp16 REQUIRED CONFIG) +if(NOT TARGET fp16) + add_library(fp16 INTERFACE IMPORTED) + set_property(TARGET fp16 PROPERTY INTERFACE_LINK_LIBRARIES fp16::fp16) +endif() -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +# not a direct requirement, but we have to define this target to avoid xnnpack to download it +if(NOT TARGET fxdiv) + add_library(fxdiv INTERFACE IMPORTED) endif() -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/xnnpack/all/conandata.yml b/recipes/xnnpack/all/conandata.yml index b8350dbe92b096..5168859b5421f0 100644 --- a/recipes/xnnpack/all/conandata.yml +++ b/recipes/xnnpack/all/conandata.yml @@ -1,16 +1,16 @@ sources: - "cci.20210310": - url: "https://github.com/google/XNNPACK/archive/24c2dec2c451b7594eb6ef70c538923899bd541c.tar.gz" - sha256: "f049f55d57d6e608dd1125c3d40323763dc842949b31437be7158b7e91687ed8" - "cci.20211026": - url: "https://github.com/google/XNNPACK/archive/ccbaedf11c70a3ff4db0ef17cfeacd710ffc3492.tar.gz" - sha256: "9324aea663d21cea4538095c40928572ddb685e0601853f278b7e5ead697fe81" - "cci.20211210": - url: "https://github.com/google/XNNPACK/archive/113092317754c7dea47bfb3cb49c4f59c3c1fa10.tar.gz" - sha256: "065bb9c85438c453f9300251f263118c4d123d79b21acf8f66582a3124d95fb2" - "cci.20220621": - url: "https://github.com/google/XNNPACK/archive/b725ca1a40b53d8087d1be0c53cb49fa05e2f1bc.tar.gz" - sha256: "a745c629dea5fc76e5a545e412a408fde1a523b71027f07d1b0670ec9ae54819" "cci.20220801": url: "https://github.com/google/XNNPACK/archive/8e3d3359f9bec608e09fac1f7054a2a14b1bd73c.tar.gz" sha256: "c82327543249bd333034bbaa0300ed1fc9c7060fa73673a285042e3f042540e0" + "cci.20220621": + url: "https://github.com/google/XNNPACK/archive/b725ca1a40b53d8087d1be0c53cb49fa05e2f1bc.tar.gz" + sha256: "a745c629dea5fc76e5a545e412a408fde1a523b71027f07d1b0670ec9ae54819" + "cci.20211210": + url: "https://github.com/google/XNNPACK/archive/113092317754c7dea47bfb3cb49c4f59c3c1fa10.tar.gz" + sha256: "065bb9c85438c453f9300251f263118c4d123d79b21acf8f66582a3124d95fb2" + "cci.20211026": + url: "https://github.com/google/XNNPACK/archive/ccbaedf11c70a3ff4db0ef17cfeacd710ffc3492.tar.gz" + sha256: "9324aea663d21cea4538095c40928572ddb685e0601853f278b7e5ead697fe81" + "cci.20210310": + url: "https://github.com/google/XNNPACK/archive/24c2dec2c451b7594eb6ef70c538923899bd541c.tar.gz" + sha256: "f049f55d57d6e608dd1125c3d40323763dc842949b31437be7158b7e91687ed8" diff --git a/recipes/xnnpack/all/conanfile.py b/recipes/xnnpack/all/conanfile.py index 131f20b274b167..b4f316563dd04f 100644 --- a/recipes/xnnpack/all/conanfile.py +++ b/recipes/xnnpack/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import glob +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file +from conan.tools.microsoft import check_min_vs +from conan.tools.scm import Version import os +required_conan_version = ">=1.51.1" + class XnnpackConan(ConanFile): name = "xnnpack" @@ -10,8 +15,8 @@ class XnnpackConan(ConanFile): "neural network inference operators for ARM, WebAssembly, " \ "and x86 platforms." license = "BSD-3-Clause" - topics = ("conan", "xnnpack", "neural-network", "inference", "multithreading", - "inference-optimization", "matrix-multiplication", "simd") + topics = ("neural-network", "inference", "multithreading", "inference-optimization", + "matrix-multiplication", "simd") homepage = "https://github.com/google/XNNPACK" url = "https://github.com/conan-io/conan-center-index" @@ -32,12 +37,6 @@ class XnnpackConan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -45,72 +44,82 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - compiler = self.settings.compiler - compiler_version = tools.Version(compiler.version) - if (compiler == "gcc" and compiler_version < "6") or \ - (compiler == "clang" and compiler_version < "5") or \ - (compiler == "Visual Studio" and compiler_version < "16"): - raise ConanInvalidConfiguration("xnnpack doesn't support {} {}".format(str(compiler), compiler.version)) + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("cpuinfo/cci.20201217") + self.requires("cpuinfo/cci.20220228") self.requires("fp16/cci.20210320") - # Note: using newer version of pthreadpool compared to reference cci.20201205 self.requires("pthreadpool/cci.20210218") - def _patch_sources(self): - tools.replace_in_file(os.path.join(self.source_folder, self._source_subfolder, "CMakeLists.txt"), - "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}", - "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}") + def validate(self): + check_min_vs(self, 192) + compiler = self.info.settings.compiler + compiler_version = Version(compiler.version) + if (compiler == "gcc" and compiler_version < "6") or \ + (compiler == "clang" and compiler_version < "5"): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support {compiler} {compiler.version}") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("XNNPACK-*")[0] - os.rename(extracted_dir, self._source_subfolder) - self._patch_sources() + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) if self.settings.arch == "armv8": if self.settings.os == "Linux": - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "aarch64" + tc.variables["CONAN_XNNPACK_SYSTEM_PROCESSOR"] = "aarch64" else: # Not defined by Conan for Apple Silicon. See https://github.com/conan-io/conan/pull/8026 - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "arm64" - self._cmake.definitions["XNNPACK_LIBRARY_TYPE"] = "shared" if self.options.shared else "static" - self._cmake.definitions["XNNPACK_ENABLE_ASSEMBLY"] = self.options.assembly - self._cmake.definitions["XNNPACK_ENABLE_MEMOPT"] = self.options.memopt - self._cmake.definitions["XNNPACK_ENABLE_SPARSE"] = self.options.sparse - self._cmake.definitions["XNNPACK_BUILD_TESTS"] = False - self._cmake.definitions["XNNPACK_BUILD_BENCHMARKS"] = False - + tc.variables["CONAN_XNNPACK_SYSTEM_PROCESSOR"] = "arm64" + tc.cache_variables["XNNPACK_LIBRARY_TYPE"] = "shared" if self.options.shared else "static" + tc.variables["XNNPACK_ENABLE_ASSEMBLY"] = self.options.assembly + tc.variables["XNNPACK_ENABLE_MEMOPT"] = self.options.memopt + tc.variables["XNNPACK_ENABLE_SPARSE"] = self.options.sparse + tc.variables["XNNPACK_BUILD_TESTS"] = False + tc.variables["XNNPACK_BUILD_BENCHMARKS"] = False + tc.variables["XNNPACK_USE_SYSTEM_LIBS"] = True # Default fPIC on if it doesn't exist (i.e. for shared library builds) - self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - - # Use conan dependencies instead of downloading them during configuration - self._cmake.definitions["XNNPACK_USE_SYSTEM_LIBS"] = True - + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) # Install only built targets, in this case just the XNNPACK target - self._cmake.definitions["CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"] = True + tc.variables["CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"] = True + # To export symbols for shared msvc + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() - self._cmake.configure() - return self._cmake + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}", + "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}") def build(self): - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build(target="XNNPACK") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["XNNPACK"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/xnnpack/all/test_package/CMakeLists.txt b/recipes/xnnpack/all/test_package/CMakeLists.txt index fd126a732c403b..b71bd6e6242c86 100644 --- a/recipes/xnnpack/all/test_package/CMakeLists.txt +++ b/recipes/xnnpack/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(xnnpack REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE xnnpack::xnnpack) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/xnnpack/all/test_package/conanfile.py b/recipes/xnnpack/all/test_package/conanfile.py index 5216332f39f5ca..0a6bc68712d901 100644 --- a/recipes/xnnpack/all/test_package/conanfile.py +++ b/recipes/xnnpack/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xnnpack/all/test_v1_package/CMakeLists.txt b/recipes/xnnpack/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..7a503e7fa1a41f --- /dev/null +++ b/recipes/xnnpack/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(xnnpack REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE xnnpack::xnnpack) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/xnnpack/all/test_v1_package/conanfile.py b/recipes/xnnpack/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/xnnpack/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xnnpack/config.yml b/recipes/xnnpack/config.yml index 99df439925ce43..48525c30513470 100644 --- a/recipes/xnnpack/config.yml +++ b/recipes/xnnpack/config.yml @@ -1,11 +1,11 @@ versions: - "cci.20210310": + "cci.20220801": folder: all - "cci.20211026": + "cci.20220621": folder: all "cci.20211210": folder: all - "cci.20220621": + "cci.20211026": folder: all - "cci.20220801": + "cci.20210310": folder: all From 923318d88cfbfa475cf6d4ac002f53f13b08aa33 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 22 Oct 2022 06:26:24 +0200 Subject: [PATCH 126/300] (#12657) psimd: conan v2 support * conan v2 support * declarations for gcc & clang only --- recipes/psimd/all/conanfile.py | 34 ++++++++++++------- recipes/psimd/all/test_package/CMakeLists.txt | 7 ++-- recipes/psimd/all/test_package/conanfile.py | 19 ++++++++--- recipes/psimd/all/test_package/test_package.c | 2 ++ .../psimd/all/test_v1_package/CMakeLists.txt | 10 ++++++ .../psimd/all/test_v1_package/conanfile.py | 17 ++++++++++ 6 files changed, 67 insertions(+), 22 deletions(-) create mode 100644 recipes/psimd/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/psimd/all/test_v1_package/conanfile.py diff --git a/recipes/psimd/all/conanfile.py b/recipes/psimd/all/conanfile.py index 99979718ffba14..138520809226b4 100644 --- a/recipes/psimd/all/conanfile.py +++ b/recipes/psimd/all/conanfile.py @@ -1,30 +1,38 @@ -from conans import ConanFile, tools -import glob +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.50.0" + class PsimdConan(ConanFile): name = "psimd" description = "Portable 128-bit SIMD intrinsics." license = "MIT" - topics = ("conan", "psimd", "simd") + topics = ("psimd", "simd") homepage = "https://github.com/Maratyszcza/psimd" url = "https://github.com/conan-io/conan-center-index" - + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("psimd-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/psimd/all/test_package/CMakeLists.txt b/recipes/psimd/all/test_package/CMakeLists.txt index 7b9b613cbb24a3..05b88bb3a39869 100644 --- a/recipes/psimd/all/test_package/CMakeLists.txt +++ b/recipes/psimd/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(psimd REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE psimd::psimd) diff --git a/recipes/psimd/all/test_package/conanfile.py b/recipes/psimd/all/test_package/conanfile.py index 5216332f39f5ca..0a6bc68712d901 100644 --- a/recipes/psimd/all/test_package/conanfile.py +++ b/recipes/psimd/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/psimd/all/test_package/test_package.c b/recipes/psimd/all/test_package/test_package.c index 27f0a6e9339c65..df931cf110b834 100644 --- a/recipes/psimd/all/test_package/test_package.c +++ b/recipes/psimd/all/test_package/test_package.c @@ -3,6 +3,8 @@ #include int main() { +#if defined(__GNUC__) || defined(__clang__) psimd_u32 a = psimd_splat_u32(UINT32_C(0x80000000)); +#endif return 0; } diff --git a/recipes/psimd/all/test_v1_package/CMakeLists.txt b/recipes/psimd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..e8cb47d9d69b76 --- /dev/null +++ b/recipes/psimd/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(psimd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE psimd::psimd) diff --git a/recipes/psimd/all/test_v1_package/conanfile.py b/recipes/psimd/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/psimd/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From abf39ae94ea705318603a206f62823a0082dbfe1 Mon Sep 17 00:00:00 2001 From: Martin Delille Date: Sat, 22 Oct 2022 06:44:30 +0200 Subject: [PATCH 127/300] (#12956) [libcurl/xxx] Conan v2 migration * [libcurl/xxx] Conan v2 migration * Use VirtualRunEnv * Bump wolfssl and libnghttp2 * Fix linter issues * Use cmake_layout conditionaly * Add test_type and tested_reference_str * Fix test_package * Add basic_layout * Delete compiler in package_id * Fix basic_layout * Update cacert.pem sha256 * Use old syntax for bin path * Revert "Use old syntax for bin path" This reverts commit 3d5aec88c5994b58991613c6f5d873a352c5b5cd. * Use old syntax for test_v1_package bin path * Remove conans.tools.get_env * Use export_conandata_patches * Update recipes/libcurl/all/conanfile.py Co-authored-by: Uilian Ries * Use info.options/settings * Apply suggestions from code review Co-authored-by: Uilian Ries Co-authored-by: Jordan Williams * Fix indentation * Add pkgconf conditionnaly Co-authored-by: Uilian Ries * Fix if condition Co-authored-by: Uilian Ries Co-authored-by: Jordan Williams --- recipes/libcurl/all/CMakeLists.txt | 8 - recipes/libcurl/all/conandata.yml | 1 - recipes/libcurl/all/conanfile.py | 439 +++++++++--------- .../libcurl/all/test_package/CMakeLists.txt | 3 - recipes/libcurl/all/test_package/conanfile.py | 44 +- .../all/test_v1_package/CMakeLists.txt | 10 + .../libcurl/all/test_v1_package/conanfile.py | 43 ++ 7 files changed, 288 insertions(+), 260 deletions(-) delete mode 100644 recipes/libcurl/all/CMakeLists.txt create mode 100644 recipes/libcurl/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libcurl/all/test_v1_package/conanfile.py diff --git a/recipes/libcurl/all/CMakeLists.txt b/recipes/libcurl/all/CMakeLists.txt deleted file mode 100644 index 8658c4251a78c6..00000000000000 --- a/recipes/libcurl/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.0) - -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libcurl/all/conandata.yml b/recipes/libcurl/all/conandata.yml index 40396d0b0972c6..40bf395099661a 100644 --- a/recipes/libcurl/all/conandata.yml +++ b/recipes/libcurl/all/conandata.yml @@ -29,4 +29,3 @@ sources: patches: "7.79.0": - patch_file: "patches/004-no-checksrc.patch" - base_path: "source_subfolder" diff --git a/recipes/libcurl/all/conanfile.py b/recipes/libcurl/all/conanfile.py index 5d90d94f7a857f..5c732a75e757f3 100644 --- a/recipes/libcurl/all/conanfile.py +++ b/recipes/libcurl/all/conanfile.py @@ -1,17 +1,19 @@ -import glob -import os -import re -import functools -from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools +from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, download, export_conandata_patches, get, load, replace_in_file, rm, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path from conan.tools.scm import Version -from conan.tools.files import replace_in_file, rmdir, chdir, get, download, save, load, apply_conandata_patches -from conan.tools.apple import is_apple_os +import os +import re -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class LibcurlConan(ConanFile): @@ -112,28 +114,19 @@ class LibcurlConan(ConanFile): "with_ca_bundle": None, "with_ca_path": None, } - generators = "cmake", "cmake_find_package_multi", "pkg_config", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" - @property - def _is_win_x_android(self): - return self.settings.os == "Android" and tools.os_info.is_windows - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _is_win_x_android(self): + return self.settings.os == "Android" and self._settings_build.os == "Windows" + @property def _is_using_cmake_build(self): return is_msvc(self) or self._is_win_x_android @@ -148,10 +141,8 @@ def _has_metalink_option(self): return Version(self.version) < "7.78.0" and not self._is_using_cmake_build def export_sources(self): - self.copy("CMakeLists.txt") - self.copy("lib_Makefile_add.am") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "lib_Makefile_add.am", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if Version(self.version) < "7.10.4": @@ -181,9 +172,9 @@ def requirements(self): if self.options.with_ssl == "openssl": self.requires("openssl/1.1.1q") elif self.options.with_ssl == "wolfssl": - self.requires("wolfssl/5.3.0") + self.requires("wolfssl/5.4.0") if self.options.with_nghttp2: - self.requires("libnghttp2/1.47.0") + self.requires("libnghttp2/1.48.0") if self.options.with_libssh2: self.requires("libssh2/1.10.0") if self.options.with_zlib: @@ -195,15 +186,19 @@ def requirements(self): if self.options.with_c_ares: self.requires("c-ares/1.18.1") + def package_id(self): + del self.info.settings.compiler + def validate(self): - if self.options.with_ssl == "schannel" and self.settings.os != "Windows": + if self.info.options.with_ssl == "schannel" and self.info.settings.os != "Windows": raise ConanInvalidConfiguration("schannel only suppported on Windows.") - if self.options.with_ssl == "darwinssl" and not is_apple_os(self): + if self.info.options.with_ssl == "darwinssl" and not is_apple_os(self): raise ConanInvalidConfiguration("darwinssl only suppported on Apple like OS (Macos, iOS, watchOS or tvOS).") - if self.options.with_ssl == "wolfssl" and self._is_using_cmake_build and Version(self.version) < "7.70.0": + if self.info.options.with_ssl == "wolfssl" and self._is_using_cmake_build and Version(self.version) < "7.70.0": raise ConanInvalidConfiguration("Before 7.70.0, libcurl has no wolfssl support for Visual Studio or \"Windows to Android cross compilation\"") - if self.options.with_ssl == "openssl": - if self.options.with_ntlm and self.options["openssl"].no_des: + if self.info.options.with_ssl == "openssl": + openssl = self.dependencies["openssl"] + if self.info.options.with_ntlm and openssl.options.no_des: raise ConanInvalidConfiguration("option with_ntlm=True requires openssl:no_des=False") def build_requirements(self): @@ -212,14 +207,34 @@ def build_requirements(self): self.tool_requires("ninja/1.11.0") else: self.tool_requires("libtool/2.4.6") - self.tool_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.tool_requires("msys2/cci.latest") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.7.4") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + + def layout(self): + if self._is_using_cmake_build: + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - download(self, "https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True) + destination=self.source_folder, strip_root=True) + download(self, "https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True, sha256="2cff03f9efdaf52626bd1b451d700605dc1ea000c5da56bd0fc59f8f43071040") + + def generate(self): + if self._is_using_cmake_build: + self._generate_with_cmake() + else: + self._generate_with_autotools() + ms = VirtualBuildEnv(self) + ms.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") # TODO: remove imports once rpath of shared libs of libcurl dependencies fixed on macOS def imports(self): @@ -231,14 +246,19 @@ def imports(self): # but does not work on OS X 10.11 with SIP) # 2. copying dylib's to the build directory (fortunately works on OS X) if self.settings.os == "Macos": - self.copy("*.dylib*", dst=self._source_subfolder, keep_path=False) + copy(self, "*.dylib*", src=self.build_folder, dst=self.source_folder, keep_path=False) def build(self): self._patch_sources() if self._is_using_cmake_build: - self._build_with_cmake() + cmake = CMake(self) + cmake.configure() + cmake.build() else: - self._build_with_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def _patch_sources(self): apply_conandata_patches(self) @@ -248,7 +268,7 @@ def _patch_sources(self): def _patch_misc_files(self): if self.options.with_largemaxwritesize: - replace_in_file(self, os.path.join(self._source_subfolder, "include", "curl", "curl.h"), + replace_in_file(self, os.path.join(self.source_folder, "include", "curl", "curl.h"), "define CURL_MAX_WRITE_SIZE 16384", "define CURL_MAX_WRITE_SIZE 10485760") @@ -256,7 +276,7 @@ def _patch_misc_files(self): # for additional info, see this comment https://github.com/conan-io/conan-center-index/pull/1008#discussion_r386122685 if self.settings.compiler == "apple-clang" and self.settings.compiler.version == "9.1": if self.options.with_ssl == "darwinssl": - replace_in_file(self, os.path.join(self._source_subfolder, "lib", "vtls", "sectransp.c"), + replace_in_file(self, os.path.join(self.source_folder, "lib", "vtls", "sectransp.c"), "#define CURL_BUILD_MAC_10_13 MAC_OS_X_VERSION_MAX_ALLOWED >= 101300", "#define CURL_BUILD_MAC_10_13 0") @@ -267,25 +287,25 @@ def _patch_autotools(self): # Disable curl tool for these reasons: # - link errors if mingw shared or iOS/tvOS/watchOS # - it makes recipe consistent with CMake build where we don't build curl tool - top_makefile = os.path.join(self._source_subfolder, "Makefile.am") + top_makefile = os.path.join(self.source_folder, "Makefile.am") replace_in_file(self, top_makefile, "SUBDIRS = lib src", "SUBDIRS = lib") replace_in_file(self, top_makefile, "include src/Makefile.inc", "") if self._is_mingw: # patch for zlib naming in mingw if self.options.with_zlib: - configure_ac = os.path.join(self._source_subfolder, "configure.ac") + configure_ac = os.path.join(self.source_folder, "configure.ac") zlib_name = self.deps_cpp_info["zlib"].libs[0] replace_in_file(self, configure_ac, "AC_CHECK_LIB(z,", - "AC_CHECK_LIB({},".format(zlib_name)) + f"AC_CHECK_LIB({zlib_name}") replace_in_file(self, configure_ac, "-lz ", - "-l{} ".format(zlib_name)) + f"-l{zlib_name}") if self.options.shared: # patch for shared mingw build - lib_makefile = os.path.join(self._source_subfolder, "lib", "Makefile.am") + lib_makefile = os.path.join(self.source_folder, "lib", "Makefile.am") replace_in_file(self, lib_makefile, "noinst_LTLIBRARIES = libcurlu.la", "") @@ -304,10 +324,10 @@ def _patch_autotools(self): def _patch_cmake(self): if not self._is_using_cmake_build: return - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") # Custom findZstd.cmake file relies on pkg-config file, make sure that it's consumed on all platforms if self._has_zstd_option: - replace_in_file(self, os.path.join(self._source_subfolder, "CMake", "FindZstd.cmake"), + replace_in_file(self, os.path.join(self.source_folder, "CMake", "FindZstd.cmake"), "if(UNIX)", "if(TRUE)") # TODO: check this patch, it's suspicious replace_in_file(self, cmakelists, @@ -344,111 +364,143 @@ def _patch_cmake(self): get_target_property(_lib "${_libname}" LOCATION)""", ) - def _get_configure_command_args(self): - yes_no = lambda v: "yes" if v else "no" - params = [ - "--with-libidn2={}".format(yes_no(self.options.with_libidn)), - "--with-librtmp={}".format(yes_no(self.options.with_librtmp)), - "--with-libpsl={}".format(yes_no(self.options.with_libpsl)), - "--with-schannel={}".format(yes_no(self.options.with_ssl == "schannel")), - "--with-secure-transport={}".format(yes_no(self.options.with_ssl == "darwinssl")), - "--with-brotli={}".format(yes_no(self.options.with_brotli)), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-dict={}".format(yes_no(self.options.with_dict)), - "--enable-file={}".format(yes_no(self.options.with_file)), - "--enable-ftp={}".format(yes_no(self.options.with_ftp)), - "--enable-gopher={}".format(yes_no(self.options.with_gopher)), - "--enable-http={}".format(yes_no(self.options.with_http)), - "--enable-imap={}".format(yes_no(self.options.with_imap)), - "--enable-ldap={}".format(yes_no(self.options.with_ldap)), - "--enable-mqtt={}".format(yes_no(self.options.with_mqtt)), - "--enable-pop3={}".format(yes_no(self.options.with_pop3)), - "--enable-rtsp={}".format(yes_no(self.options.with_rtsp)), - "--enable-smb={}".format(yes_no(self.options.with_smb)), - "--enable-smtp={}".format(yes_no(self.options.with_smtp)), - "--enable-telnet={}".format(yes_no(self.options.with_telnet)), - "--enable-tftp={}".format(yes_no(self.options.with_tftp)), - "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), - "--enable-ares={}".format(yes_no(self.options.with_c_ares)), - "--enable-threaded-resolver={}".format(yes_no(self.options.with_threaded_resolver)), - "--enable-cookies={}".format(yes_no(self.options.with_cookies)), - "--enable-ipv6={}".format(yes_no(self.options.with_ipv6)), - "--enable-manual={}".format(yes_no(self.options.with_docs)), - "--enable-verbose={}".format(yes_no(self.options.with_verbose_debug)), - "--enable-symbol-hiding={}".format(yes_no(self.options.with_symbol_hiding)), - "--enable-unix-sockets={}".format(yes_no(self.options.with_unix_sockets)), - ] + def _yes_no(self, value): + return "yes" if value else "no" + + def _generate_with_autotools(self): + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + f"--with-libidn2={self._yes_no(self.options.with_libidn)}", + f"--with-librtmp={self._yes_no(self.options.with_librtmp)}", + f"--with-libpsl={self._yes_no(self.options.with_libpsl)}", + f"--with-schannel={self._yes_no(self.options.with_ssl == 'schannel')}", + f"--with-secure-transport={self._yes_no(self.options.with_ssl == 'darwinssl')}", + f"--with-brotli={self._yes_no(self.options.with_brotli)}", + f"--enable-shared={self._yes_no(self.options.shared)}", + f"--enable-static={self._yes_no(not self.options.shared)}", + f"--enable-dict={self._yes_no(self.options.with_dict)}", + f"--enable-file={self._yes_no(self.options.with_file)}", + f"--enable-ftp={self._yes_no(self.options.with_ftp)}", + f"--enable-gopher={self._yes_no(self.options.with_gopher)}", + f"--enable-http={self._yes_no(self.options.with_http)}", + f"--enable-imap={self._yes_no(self.options.with_imap)}", + f"--enable-ldap={self._yes_no(self.options.with_ldap)}", + f"--enable-mqtt={self._yes_no(self.options.with_mqtt)}", + f"--enable-pop3={self._yes_no(self.options.with_pop3)}", + f"--enable-rtsp={self._yes_no(self.options.with_rtsp)}", + f"--enable-smb={self._yes_no(self.options.with_smb)}", + f"--enable-smtp={self._yes_no(self.options.with_smtp)}", + f"--enable-telnet={self._yes_no(self.options.with_telnet)}", + f"--enable-tftp={self._yes_no(self.options.with_tftp)}", + f"--enable-debug={self._yes_no(self.settings.build_type == 'Debug')}", + f"--enable-ares={self._yes_no(self.options.with_c_ares)}", + f"--enable-threaded-resolver={self._yes_no(self.options.with_threaded_resolver)}", + f"--enable-cookies={self._yes_no(self.options.with_cookies)}", + f"--enable-ipv6={self._yes_no(self.options.with_ipv6)}", + f"--enable-manual={self._yes_no(self.options.with_docs)}", + f"--enable-verbose={self._yes_no(self.options.with_verbose_debug)}", + f"--enable-symbol-hiding={self._yes_no(self.options.with_symbol_hiding)}", + f"--enable-unix-sockets={self._yes_no(self.options.with_unix_sockets)}", + ]) if self.options.with_ssl == "openssl": - params.append("--with-ssl={}".format(tools.unix_path(self.deps_cpp_info["openssl"].rootpath))) + path = unix_path(self, self.deps_cpp_info["openssl"].rootpath) + tc.configure_args.append(f"--with-ssl={path}") else: - params.append("--without-ssl") + tc.configure_args.append("--without-ssl") if self.options.with_ssl == "wolfssl": - params.append("--with-wolfssl={}".format(tools.unix_path(self.deps_cpp_info["wolfssl"].rootpath))) + path = unix_path(self, self.deps_cpp_info["wolfssl"].rootpath) + tc.configure_args.append(f"--with-wolfssl={path}") else: - params.append("--without-wolfssl") + tc.configure_args.append("--without-wolfssl") if self.options.with_libssh2: - params.append("--with-libssh2={}".format(tools.unix_path(self.deps_cpp_info["libssh2"].rootpath))) + path = unix_path(self, self.deps_cpp_info["libssh2"].rootpath) + tc.configure_args.append(f"--with-libssh2={path}") else: - params.append("--without-libssh2") + tc.configure_args.append("--without-libssh2") if self.options.with_nghttp2: - params.append("--with-nghttp2={}".format(tools.unix_path(self.deps_cpp_info["libnghttp2"].rootpath))) + path = unix_path(self, self.deps_cpp_info["libnghttp2"].rootpath) + tc.configure_args.append(f"--with-nghttp2={path}") else: - params.append("--without-nghttp2") + tc.configure_args.append("--without-nghttp2") if self.options.with_zlib: - params.append("--with-zlib={}".format(tools.unix_path(self.deps_cpp_info["zlib"].rootpath))) + path = unix_path(self, self.deps_cpp_info["zlib"].rootpath) + tc.configure_args.append(f"--with-zlib={path}") else: - params.append("--without-zlib") + tc.configure_args.append("--without-zlib") if self._has_zstd_option: - params.append("--with-zstd={}".format(yes_no(self.options.with_zstd))) + tc.configure_args.append(f"--with-zstd={self._yes_no(self.options.with_zstd)}") if self._has_metalink_option: - params.append("--with-libmetalink={}".format(yes_no(self.options.with_libmetalink))) + tc.configure_args.append(f"--with-libmetalink={self._yes_no(self.options.with_libmetalink)}") if not self.options.with_proxy: - params.append("--disable-proxy") + tc.configure_args.append("--disable-proxy") if not self.options.with_rtsp: - params.append("--disable-rtsp") + tc.configure_args.append("--disable-rtsp") if not self.options.with_crypto_auth: - params.append("--disable-crypto-auth") # also disables NTLM in versions of curl prior to 7.78.0 + tc.configure_args.append("--disable-crypto-auth") # also disables NTLM in versions of curl prior to 7.78.0 # ntlm will default to enabled if any SSL options are enabled if not self.options.with_ntlm: if Version(self.version) <= "7.77.0": - params.append("--disable-crypto-auth") + tc.configure_args.append("--disable-crypto-auth") else: - params.append("--disable-ntlm") + tc.configure_args.append("--disable-ntlm") if not self.options.with_ntlm_wb: - params.append("--disable-ntlm-wb") + tc.configure_args.append("--disable-ntlm-wb") - if self.options.with_ca_bundle == False: - params.append("--without-ca-bundle") + if self.options.with_ca_bundle is False: + tc.configure_args.append("--without-ca-bundle") elif self.options.with_ca_bundle: - params.append("--with-ca-bundle=" + str(self.options.with_ca_bundle)) + tc.configure_args.append("--with-ca-bundle=" + str(self.options.with_ca_bundle)) - if self.options.with_ca_path == False: - params.append('--without-ca-path') + if self.options.with_ca_path is False: + tc.configure_args.append('--without-ca-path') elif self.options.with_ca_path: - params.append("--with-ca-path=" + str(self.options.with_ca_path)) + tc.configure_args.append("--with-ca-path=" + str(self.options.with_ca_path)) # Cross building flags if cross_building(self): if self.settings.os == "Linux" and "arm" in self.settings.arch: - params.append("--host=%s" % self._get_linux_arm_host()) + tc.configure_args.append(f"--host={self._get_linux_arm_host()}") elif self.settings.os == "iOS": - params.append("--enable-threaded-resolver") - params.append("--disable-verbose") + tc.configure_args.append("--enable-threaded-resolver") + tc.configure_args.append("--disable-verbose") elif self.settings.os == "Android": pass # this just works, conan is great! - return params + # tweaks for mingw + if self._is_mingw: + rcflags = "-O COFF" + if self.settings.arch == "x86": + rcflags += " --target=pe-i386" + else: + rcflags += " --target=pe-x86-64" + env = tc.environment() + env.define("RCFLAGS", rcflags) + + tc.extra_defines.append("_AMD64_") + + if self.settings.os != "Windows": + tc.fpic = self.options.get_safe("fPIC", True) + + + if cross_building(self) and is_apple_os(self): + tc.extra_defines.extend(['HAVE_SOCKET', 'HAVE_FCNTL_O_NONBLOCK']) + + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + def _get_linux_arm_host(self): arch = None @@ -472,150 +524,89 @@ def _arm_version(self, arch): version = int(match.group(1)) return version - def _build_with_autotools(self): - with chdir(self, self._source_subfolder): - # autoreconf - self.run("{} -fiv".format(tools.get_env("AUTORECONF") or "autoreconf"), win_bash=tools.os_info.is_windows, run_environment=True) - - # fix generated autotools files to have relocatable binaries - if is_apple_os(self): - replace_in_file(self, "configure", "-install_name \\$rpath/", "-install_name @rpath/") - - self.run("chmod +x configure") - - # run configure with *LD_LIBRARY_PATH env vars it allows to pick up shared openssl - with tools.run_environment(self): - autotools, autotools_vars = self._configure_autotools() - autotools.make(vars=autotools_vars) - - def _configure_autotools_vars(self): - autotools_vars = {} - # tweaks for mingw - if self._is_mingw: - autotools_vars["RCFLAGS"] = "-O COFF" - if self.settings.arch == "x86": - autotools_vars["RCFLAGS"] += " --target=pe-i386" - else: - autotools_vars["RCFLAGS"] += " --target=pe-x86-64" - return autotools_vars - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - - if self.settings.os != "Windows": - autotools.fpic = self.options.get_safe("fPIC", True) - - autotools_vars = self._configure_autotools_vars() - - # tweaks for mingw - if self._is_mingw: - autotools.defines.append("_AMD64_") - - if cross_building(self) and is_apple_os(self): - autotools.defines.extend(['HAVE_SOCKET', 'HAVE_FCNTL_O_NONBLOCK']) - - configure_args = self._get_configure_command_args() - - if self.settings.os == "iOS" and self.settings.arch == "x86_64": - # please do not autodetect --build for the iOS simulator, thanks! - autotools.configure(vars=autotools_vars, args=configure_args, build=False) - else: - autotools.configure(vars=autotools_vars, args=configure_args) - - return autotools, autotools_vars - - @functools.lru_cache(1) - def _configure_cmake(self): + def _generate_with_cmake(self): if self._is_win_x_android: - cmake = CMake(self, generator="Ninja") + tc = CMakeToolchain(self, generator="Ninja") else: - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["BUILD_CURL_EXE"] = False - cmake.definitions["CURL_DISABLE_LDAP"] = not self.options.with_ldap - cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - cmake.definitions["CURL_STATICLIB"] = not self.options.shared - cmake.definitions["CMAKE_DEBUG_POSTFIX"] = "" + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_CURL_EXE"] = False + tc.variables["CURL_DISABLE_LDAP"] = not self.options.with_ldap + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["CURL_STATICLIB"] = not self.options.shared + tc.variables["CMAKE_DEBUG_POSTFIX"] = "" if Version(self.version) >= "7.81.0": - cmake.definitions["CURL_USE_SCHANNEL"] = self.options.with_ssl == "schannel" + tc.variables["CURL_USE_SCHANNEL"] = self.options.with_ssl == "schannel" elif Version(self.version) >= "7.72.0": - cmake.definitions["CMAKE_USE_SCHANNEL"] = self.options.with_ssl == "schannel" + tc.variables["CMAKE_USE_SCHANNEL"] = self.options.with_ssl == "schannel" else: - cmake.definitions["CMAKE_USE_WINSSL"] = self.options.with_ssl == "schannel" + tc.variables["CMAKE_USE_WINSSL"] = self.options.with_ssl == "schannel" if Version(self.version) >= "7.81.0": - cmake.definitions["CURL_USE_OPENSSL"] = self.options.with_ssl == "openssl" + tc.variables["CURL_USE_OPENSSL"] = self.options.with_ssl == "openssl" else: - cmake.definitions["CMAKE_USE_OPENSSL"] = self.options.with_ssl == "openssl" + tc.variables["CMAKE_USE_OPENSSL"] = self.options.with_ssl == "openssl" if Version(self.version) >= "7.81.0": - cmake.definitions["CURL_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" + tc.variables["CURL_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" elif Version(self.version) >= "7.70.0": - cmake.definitions["CMAKE_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" - cmake.definitions["USE_NGHTTP2"] = self.options.with_nghttp2 - cmake.definitions["CURL_ZLIB"] = self.options.with_zlib - cmake.definitions["CURL_BROTLI"] = self.options.with_brotli + tc.variables["CMAKE_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" + tc.variables["USE_NGHTTP2"] = self.options.with_nghttp2 + tc.variables["CURL_ZLIB"] = self.options.with_zlib + tc.variables["CURL_BROTLI"] = self.options.with_brotli if self._has_zstd_option: - cmake.definitions["CURL_ZSTD"] = self.options.with_zstd + tc.variables["CURL_ZSTD"] = self.options.with_zstd if Version(self.version) >= "7.81.0": - cmake.definitions["CURL_USE_LIBSSH2"] = self.options.with_libssh2 + tc.variables["CURL_USE_LIBSSH2"] = self.options.with_libssh2 else: - cmake.definitions["CMAKE_USE_LIBSSH2"] = self.options.with_libssh2 - cmake.definitions["ENABLE_ARES"] = self.options.with_c_ares + tc.variables["CMAKE_USE_LIBSSH2"] = self.options.with_libssh2 + tc.variables["ENABLE_ARES"] = self.options.with_c_ares if not self.options.with_c_ares: - cmake.definitions["ENABLE_THREADED_RESOLVER"] = self.options.with_threaded_resolver - cmake.definitions["CURL_DISABLE_PROXY"] = not self.options.with_proxy - cmake.definitions["USE_LIBRTMP"] = self.options.with_librtmp + tc.variables["ENABLE_THREADED_RESOLVER"] = self.options.with_threaded_resolver + tc.variables["CURL_DISABLE_PROXY"] = not self.options.with_proxy + tc.variables["USE_LIBRTMP"] = self.options.with_librtmp if Version(self.version) >= "7.75.0": - cmake.definitions["USE_LIBIDN2"] = self.options.with_libidn - cmake.definitions["CURL_DISABLE_RTSP"] = not self.options.with_rtsp - cmake.definitions["CURL_DISABLE_CRYPTO_AUTH"] = not self.options.with_crypto_auth - cmake.definitions["CURL_DISABLE_VERBOSE_STRINGS"] = not self.options.with_verbose_strings + tc.variables["USE_LIBIDN2"] = self.options.with_libidn + tc.variables["CURL_DISABLE_RTSP"] = not self.options.with_rtsp + tc.variables["CURL_DISABLE_CRYPTO_AUTH"] = not self.options.with_crypto_auth + tc.variables["CURL_DISABLE_VERBOSE_STRINGS"] = not self.options.with_verbose_strings # Also disables NTLM_WB if set to false if not self.options.with_ntlm: if Version(self.version) <= "7.77.0": - cmake.definitions["CURL_DISABLE_CRYPTO_AUTH"] = True + tc.variables["CURL_DISABLE_CRYPTO_AUTH"] = True else: - cmake.definitions["CURL_DISABLE_NTLM"] = True - cmake.definitions["NTLM_WB_ENABLED"] = self.options.with_ntlm_wb + tc.variables["CURL_DISABLE_NTLM"] = True + tc.variables["NTLM_WB_ENABLED"] = self.options.with_ntlm_wb - if self.options.with_ca_bundle == False: - cmake.definitions['CURL_CA_BUNDLE'] = 'none' + if self.options.with_ca_bundle is False: + tc.variables['CURL_CA_BUNDLE'] = 'none' elif self.options.with_ca_bundle: - cmake.definitions['CURL_CA_BUNDLE'] = self.options.with_ca_bundle + tc.variables['CURL_CA_BUNDLE'] = self.options.with_ca_bundle - if self.options.with_ca_path == False: - cmake.definitions['CURL_CA_PATH'] = 'none' + if self.options.with_ca_path is False: + tc.variables['CURL_CA_PATH'] = 'none' elif self.options.with_ca_path: - cmake.definitions['CURL_CA_PATH'] = self.options.with_ca_path - - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables['CURL_CA_PATH'] = self.options.with_ca_path - def _build_with_cmake(self): - cmake = self._configure_cmake() - cmake.build() + tc.generate() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("cacert.pem", dst="res") + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="cacert.pem", src=self.build_folder, dst="res") if self._is_using_cmake_build: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) else: - with tools.run_environment(self): - with chdir(self, self._source_subfolder): - autotools, autotools_vars = self._configure_autotools() - autotools.install(vars=autotools_vars) + autotools = Autotools(self) + autotools.install() + fix_apple_shared_install_name(self) rmdir(self, os.path.join(self.package_folder, "share")) - for la_file in glob.glob(os.path.join(self.package_folder, "lib", "*.la")): - os.remove(la_file) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) if self._is_mingw and self.options.shared: # Handle only mingw libs - self.copy(pattern="*.dll", dst="bin", keep_path=False) - self.copy(pattern="*.dll.a", dst="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) + copy(self, pattern="*.dll", src=self.build_folder, dst="bin", keep_path=False) + copy(self, pattern="*.dll.a", src=self.build_folder, dst="lib", keep_path=False) + copy(self, pattern="*.lib", src=self.build_folder, dst="lib", keep_path=False) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): diff --git a/recipes/libcurl/all/test_package/CMakeLists.txt b/recipes/libcurl/all/test_package/CMakeLists.txt index c1a339c384346c..a36a89aea9b2b3 100644 --- a/recipes/libcurl/all/test_package/CMakeLists.txt +++ b/recipes/libcurl/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(CURL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/libcurl/all/test_package/conanfile.py b/recipes/libcurl/all/test_package/conanfile.py index 6221e377a72546..b0f5c0aed58a55 100644 --- a/recipes/libcurl/all/test_package/conanfile.py +++ b/recipes/libcurl/all/test_package/conanfile.py @@ -1,22 +1,21 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os import subprocess import re class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -25,14 +24,11 @@ def build(self): @property def _test_executable(self): - if self.settings.os == "Windows": - return os.path.join("bin", "test_package.exe") - else: - return os.path.join("bin", "test_package") + return os.path.join(self.cpp.build.bindirs[0], "test_package") def test(self): - if not cross_building(self): - self.run(self._test_executable, run_environment=True) + if can_run(self): + self.run(self._test_executable, env="conanrun") else: # We will dump information for the generated executable if self.settings.os in ["Android", "iOS"]: @@ -42,15 +38,15 @@ def test(self): output = subprocess.check_output(["file", self._test_executable]).decode() if self.settings.os == "Macos" and self.settings.arch == "armv8": - assert "Mach-O 64-bit executable arm64" in output, "Not found in output: {}".format(output) + assert "Mach-O 64-bit executable arm64" in output, f"Not found in output: {output}" elif self.settings.os == "Linux": if self.settings.arch == "armv8_32": - assert re.search(r"Machine:\s+ARM", output), "Not found in output: {}".format(output) + assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}" elif "armv8" in self.settings.arch: - assert re.search(r"Machine:\s+AArch64", output), "Not found in output: {}".format(output) + assert re.search(r"Machine:\s+AArch64", output), f"Not found in output: {output}" elif "arm" in self.settings.arch: - assert re.search(r"Machine:\s+ARM", output), "Not found in output: {}".format(output) + assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}" elif self.settings.os == "Windows": # FIXME: It satisfies not only MinGW - assert re.search(r"PE32.*executable.*Windows", output), "Not found in output: {}".format(output) + assert re.search(r"PE32.*executable.*Windows", output), f"Not found in output: {output}" diff --git a/recipes/libcurl/all/test_v1_package/CMakeLists.txt b/recipes/libcurl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..87b6e499b5d8e3 --- /dev/null +++ b/recipes/libcurl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(CURL REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} CURL::libcurl) diff --git a/recipes/libcurl/all/test_v1_package/conanfile.py b/recipes/libcurl/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..7ebb558a2d5e3c --- /dev/null +++ b/recipes/libcurl/all/test_v1_package/conanfile.py @@ -0,0 +1,43 @@ +from conans import ConanFile, CMake, tools +import os +import subprocess +import re + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def _test_executable(self): + return os.path.join("bin", "test_package") + + def test(self): + if not tools.cross_building(self): + self.run(self._test_executable, run_environment=True) + else: + # We will dump information for the generated executable + if self.settings.os in ["Android", "iOS"]: + # FIXME: Check output for these hosts + return + + output = subprocess.check_output(["file", self._test_executable]).decode() + + if self.settings.os == "Macos" and self.settings.arch == "armv8": + assert "Mach-O 64-bit executable arm64" in output, f"Not found in output: {output}" + + elif self.settings.os == "Linux": + if self.settings.arch == "armv8_32": + assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}" + elif "armv8" in self.settings.arch: + assert re.search(r"Machine:\s+AArch64", output), f"Not found in output: {output}" + elif "arm" in self.settings.arch: + assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}" + + elif self.settings.os == "Windows": # FIXME: It satisfies not only MinGW + assert re.search(r"PE32.*executable.*Windows", output), f"Not found in output: {output}" From b4c7827a055908feb52e9a9d7da9adf68e68dcd8 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 22 Oct 2022 07:04:19 +0200 Subject: [PATCH 128/300] (#13589) orcania: add orcania/2.3.1 recipe * orcania: add orcania/2.3.1 recipe * orcania: use .variables attribute instead * Create Orcania::Orcania(-static) targets * Prepare for next orcania release that will ship CMake config files * fix name of Orcania config * No m * fix typo * Fix conan v1 support * Fix target for conan v1 * no orcania in topics * Fixes for yder * Address feedback * Update recipes/orcania/all/conanfile.py * Apply suggestions from code review * Think conan 2.0 Co-authored-by: Uilian Ries * orcania: fix mingw@Linux build Co-authored-by: Uilian Ries --- recipes/orcania/all/conandata.yml | 15 ++ recipes/orcania/all/conanfile.py | 144 ++++++++++++++++ ...mingw-fix-Werror=stringop-truncation.patch | 25 +++ .../orcania/all/patches/2.3.1-0002-no-m.patch | 9 + .../2.3.1-0003-shared-static-conan.patch | 156 ++++++++++++++++++ .../orcania/all/test_package/CMakeLists.txt | 13 ++ recipes/orcania/all/test_package/conanfile.py | 31 ++++ .../orcania/all/test_package/test_package.c | 11 ++ .../all/test_v1_package/CMakeLists.txt | 16 ++ .../orcania/all/test_v1_package/conanfile.py | 18 ++ recipes/orcania/config.yml | 3 + 11 files changed, 441 insertions(+) create mode 100644 recipes/orcania/all/conandata.yml create mode 100644 recipes/orcania/all/conanfile.py create mode 100644 recipes/orcania/all/patches/2.3.1-0001-mingw-fix-Werror=stringop-truncation.patch create mode 100644 recipes/orcania/all/patches/2.3.1-0002-no-m.patch create mode 100644 recipes/orcania/all/patches/2.3.1-0003-shared-static-conan.patch create mode 100644 recipes/orcania/all/test_package/CMakeLists.txt create mode 100644 recipes/orcania/all/test_package/conanfile.py create mode 100644 recipes/orcania/all/test_package/test_package.c create mode 100644 recipes/orcania/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/orcania/all/test_v1_package/conanfile.py create mode 100644 recipes/orcania/config.yml diff --git a/recipes/orcania/all/conandata.yml b/recipes/orcania/all/conandata.yml new file mode 100644 index 00000000000000..a6c92d3317beae --- /dev/null +++ b/recipes/orcania/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + "2.3.1": + url: "https://github.com/babelouest/orcania/archive/refs/tags/v2.3.1.tar.gz" + sha256: "bbf08d563528b8ab88dd4b0e67aeb4e7c4fc9f19dcd1a0346b773cf492f7612b" +patches: + "2.3.1": + - patch_file: "patches/2.3.1-0001-mingw-fix-Werror=stringop-truncation.patch" + patch_description: "Fixes -Werror=stringop-truncation error when building with MinGW@Linux" + patch_type: "conan" + - patch_file: "patches/2.3.1-0002-no-m.patch" + patch_description: "m math library is not really needed" + patch_type: "conan" + - patch_file: "patches/2.3.1-0003-shared-static-conan.patch" + patch_description: "Build shared and static libraries + fix MSVC support" + patch_type: "conan" diff --git a/recipes/orcania/all/conanfile.py b/recipes/orcania/all/conanfile.py new file mode 100644 index 00000000000000..610d680187019a --- /dev/null +++ b/recipes/orcania/all/conanfile.py @@ -0,0 +1,144 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +import os +import textwrap + +required_conan_version = ">=1.52.0" + + +class OrcaniaConan(ConanFile): + name = "orcania" + description = "Potluck with different functions for different purposes that can be shared among C programs" + homepage = "https://github.com/babelouest/orcania" + topics = ("utility", "functions", ) + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "enable_base64url": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "enable_base64url": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def requirements(self): + if is_msvc(self) and self.options.enable_base64url: + self.requires("getopt-for-visual-studio/20200201") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_BASE64URL"] = self.options.enable_base64url + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + save(self, os.path.join(self.package_folder, self._variable_file_rel_path), + textwrap.dedent(f"""\ + set(ORCANIA_VERSION_STRING "{self.version}") + """)) + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {} if self.options.shared else {"Orcania::Orcania-static": "Orcania::Orcania"} + ) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + @property + def _variable_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + def package_info(self): + libname = "orcania" + if is_msvc(self) and not self.options.shared: + libname += "-static" + self.cpp_info.libs = [libname] + + target_name = "Orcania::Orcania" if self.options.shared else "Orcania::Orcania-static" + self.cpp_info.set_property("cmake_file_name", "Orcania") + self.cpp_info.set_property("cmake_target_name", target_name) + self.cpp_info.set_property("cmake_module_file_name", "Orcania") + self.cpp_info.set_property("cmake_module_target_name", target_name) + self.cpp_info.set_property("pkg_config_name", "liborcania") + self.cpp_info.set_property("cmake_build_modules", [self._variable_file_rel_path]) + + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "Orcania" + self.cpp_info.filenames["cmake_find_package_multi"] = "Orcania" + self.cpp_info.names["cmake_find_package"] = "Orcania" + self.cpp_info.names["cmake_find_package_multi"] = "Orcania" + self.cpp_info.names["pkg_config"] = "liborcania" + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path, self._variable_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path, self._variable_file_rel_path] diff --git a/recipes/orcania/all/patches/2.3.1-0001-mingw-fix-Werror=stringop-truncation.patch b/recipes/orcania/all/patches/2.3.1-0001-mingw-fix-Werror=stringop-truncation.patch new file mode 100644 index 00000000000000..d44e1abf5481a3 --- /dev/null +++ b/recipes/orcania/all/patches/2.3.1-0001-mingw-fix-Werror=stringop-truncation.patch @@ -0,0 +1,25 @@ +Fixes: +In function 'o_strncpy', + inlined from 'mstrcatf' at /home/maarten/programming/orcania/src/orcania.c:131:11: +/home/maarten/programming/orcania/src/orcania.c:208:12: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] + 208 | return strncpy(p1, p2, n); + | ^~~~~~~~~~~~~~~~~~ +/home/maarten/programming/orcania/src/orcania.c: In function 'mstrcatf': +/home/maarten/programming/orcania/src/orcania.c:343:12: note: length computed here + 343 | return strlen(s); + | ^~~~~~~~~ + + +--- src/orcania.c ++++ src/src/orcania.c +@@ -148,8 +148,8 @@ char * mstrcatf(char * source, const char * message, ...) { + out = o_malloc(source_len+message_formatted_len+sizeof(char)); + vsnprintf(message_formatted, (message_formatted_len+sizeof(char)), message, argp_cpy); + if (out != NULL) { +- o_strncpy(out, source, source_len); +- o_strncpy(out+source_len, message_formatted, message_formatted_len); ++ memcpy(out, source, source_len); ++ memcpy(out+source_len, message_formatted, message_formatted_len); + out[source_len+message_formatted_len] = '\0'; + } + o_free(message_formatted); diff --git a/recipes/orcania/all/patches/2.3.1-0002-no-m.patch b/recipes/orcania/all/patches/2.3.1-0002-no-m.patch new file mode 100644 index 00000000000000..30c401f4a359d9 --- /dev/null +++ b/recipes/orcania/all/patches/2.3.1-0002-no-m.patch @@ -0,0 +1,9 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -34,1 +34,1 @@ +-set(LIBS "-lm") ++set(LIBS ) +--- src/base64.c ++++ src/base64.c +@@ -10,1 +11,0 @@ +-#include diff --git a/recipes/orcania/all/patches/2.3.1-0003-shared-static-conan.patch b/recipes/orcania/all/patches/2.3.1-0003-shared-static-conan.patch new file mode 100644 index 00000000000000..ff2311a44bd709 --- /dev/null +++ b/recipes/orcania/all/patches/2.3.1-0003-shared-static-conan.patch @@ -0,0 +1,156 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -112,29 +112,47 @@ + + # static library + ++option(BUILD_SHARED "Build shared library." ON) + option(BUILD_STATIC "Build static library." OFF) + ++if (NOT BUILD_STATIC AND NOT BUILD_SHARED) ++ message(FATAL_ERROR "BUILD_SHAREDand BUILD_STATIC cannot be both disabled") ++endif () ++ + if (BUILD_STATIC) + add_library(orcania_static STATIC ${LIB_SRC}) ++ set_target_properties(orcania_static PROPERTIES ++ PUBLIC_HEADER "${INC_DIR}/orcania.h;${PROJECT_BINARY_DIR}/orcania-cfg.h") + target_compile_definitions(orcania_static PUBLIC -DO_STATIC_LIBRARY) + set_target_properties(orcania_static PROPERTIES + OUTPUT_NAME orcania) ++ if (MSVC) ++ set_target_properties(orcania_static PROPERTIES ++ OUTPUT_NAME orcania-static) ++ endif () ++ set(orcania_lib orcania_static) + endif () + + # shared library + +-add_library(orcania SHARED ${LIB_SRC}) +-if (NOT MSVC) ++if (BUILD_SHARED) ++ add_library(orcania SHARED ${LIB_SRC}) + set_target_properties(orcania PROPERTIES +- COMPILE_OPTIONS -Wextra +- PUBLIC_HEADER "${INC_DIR}/orcania.h;${PROJECT_BINARY_DIR}/orcania-cfg.h" +- VERSION "${LIBRARY_VERSION}" +- SOVERSION "${LIBRARY_SOVERSION}") +-endif() +-if (WIN32) +- set_target_properties(orcania PROPERTIES SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll") ++ PUBLIC_HEADER "${INC_DIR}/orcania.h;${PROJECT_BINARY_DIR}/orcania-cfg.h") ++ if (NOT MSVC) ++ set_target_properties(orcania PROPERTIES ++ COMPILE_OPTIONS -Wextra ++ VERSION "${LIBRARY_VERSION}" ++ SOVERSION "${LIBRARY_SOVERSION}") ++ endif() ++ if (WIN32) ++ set_target_properties(orcania PROPERTIES ++ SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll" ++ WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++ endif () ++ target_link_libraries(orcania ${LIBS}) ++ set(orcania_lib orcania) + endif () +-target_link_libraries(orcania ${LIBS}) + + # documentation + +@@ -165,10 +183,14 @@ + if (BUILD_BASE64URL) + add_executable(base64url ${BASE64URL_DIR}/base64url.c ${INC_DIR}/orcania.h ${PROJECT_BINARY_DIR}/orcania-cfg.h) + set_target_properties(base64url PROPERTIES SKIP_BUILD_RPATH TRUE) +- add_dependencies(base64url orcania) +- target_link_libraries(base64url orcania ${LIBS}) ++ add_dependencies(base64url ${orcania_lib}) ++ target_link_libraries(base64url ${orcania_lib} ${LIBS}) + install(TARGETS base64url RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(FILES ${BASE64URL_DIR}/base64url.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT runtime) ++ if(MSVC) ++ find_package(getopt-for-visual-studio REQUIRED) ++ target_link_libraries(base64url getopt-for-visual-studio::getopt-for-visual-studio) ++ endif() + endif () + + # tests +@@ -244,9 +266,12 @@ + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liborcania.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +-set(TARGETS orcania) ++set(TARGETS ) ++if (BUILD_SHARED) ++ list(APPEND TARGETS orcania) ++endif () + if (BUILD_STATIC) +- set(TARGETS ${TARGETS} orcania_static) ++ list(APPEND TARGETS orcania_static) + endif () + + if (INSTALL_HEADER) +@@ -320,6 +345,7 @@ + COMMAND ${CMAKE_MAKE_PROGRAM} package_source) + + message(STATUS "Force inline implementation of strstr: ${WITH_STRSTR}") ++message(STATUS "Build shared library: ${BUILD_SHARED}") + message(STATUS "Build static library: ${BUILD_STATIC}") + message(STATUS "Build testing tree: ${BUILD_ORCANIA_TESTING}") + message(STATUS "Install the header files: ${INSTALL_HEADER}") +--- src/orcania.c ++++ src/orcania.c +@@ -38,6 +38,13 @@ + #define strcasecmp _stricmp + #endif + ++#ifdef _MSC_VER ++#include ++typedef SSIZE_T ssize_t; ++#else ++#include ++#endif ++ + /** + * + * Orcania library +--- tools/base64url/base64url.c ++++ tools/base64url/base64url.c +@@ -19,13 +19,20 @@ + * + */ + +-#include + #include + #include + #include + #include + #include + ++#ifdef _MSC_VER ++#include ++#include ++typedef SSIZE_T ssize_t; ++#else ++#include ++#endif ++ + #define _BASE64URL_VERSION "0.9" + + #define ACTION_ENCODE 0 +@@ -98,12 +105,12 @@ + } + + static unsigned char * get_stdin_content(size_t * length) { +- int size = 100; +- unsigned char * out = NULL, buffer[size]; ++#define SIZE 100 ++ unsigned char * out = NULL, buffer[SIZE]; + ssize_t read_length; + + *length = 0; +- while ((read_length = read(0, buffer, size)) > 0) { ++ while ((read_length = read(0, buffer, SIZE)) > 0) { + out = o_realloc(out, (*length)+read_length+1); + memcpy(out+(*length), buffer, read_length); + (*length) += read_length; diff --git a/recipes/orcania/all/test_package/CMakeLists.txt b/recipes/orcania/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..3fa9c9d5af35f5 --- /dev/null +++ b/recipes/orcania/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Orcania REQUIRED CONFIG) + +option(ORCANIA_SHARED "Orcania is built as a shared library") + +add_executable(${PROJECT_NAME} test_package.c) +if(ORCANIA_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Orcania::Orcania) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Orcania::Orcania-static) +endif() diff --git a/recipes/orcania/all/test_package/conanfile.py b/recipes/orcania/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0fc1e7b663eafe --- /dev/null +++ b/recipes/orcania/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ORCANIA_SHARED"] = self.dependencies["orcania"].options.shared + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/orcania/all/test_package/test_package.c b/recipes/orcania/all/test_package/test_package.c new file mode 100644 index 00000000000000..f8bd394a51f33d --- /dev/null +++ b/recipes/orcania/all/test_package/test_package.c @@ -0,0 +1,11 @@ +#include +#include +#include + +int main() { + const char *mystring = "Hello world!"; + char* str2 = o_strdup(mystring); + puts(str2); + free(str2); + return 0; +} diff --git a/recipes/orcania/all/test_v1_package/CMakeLists.txt b/recipes/orcania/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..08501e6ccb845e --- /dev/null +++ b/recipes/orcania/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(Orcania REQUIRED CONFIG) + +option(ORCANIA_SHARED "Orcania is built as a shared library") + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +if(ORCANIA_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Orcania::Orcania) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Orcania::Orcania-static) +endif() diff --git a/recipes/orcania/all/test_v1_package/conanfile.py b/recipes/orcania/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..79db5a07b9c06b --- /dev/null +++ b/recipes/orcania/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["ORCANIA_SHARED"] = self.options["orcania"].shared + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/orcania/config.yml b/recipes/orcania/config.yml new file mode 100644 index 00000000000000..215bc57fe49932 --- /dev/null +++ b/recipes/orcania/config.yml @@ -0,0 +1,3 @@ +versions: + "2.3.1": + folder: all From b485b94ba4530f1176243794b8019008222ff477 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Sat, 22 Oct 2022 07:24:23 +0200 Subject: [PATCH 129/300] (#13656) [cmake-template] Simplify test_v1_package CMakeLists.txt * Simplify test_v1_package cmake Signed-off-by: Uilian Ries * Update docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt Signed-off-by: Uilian Ries --- .../all/test_v1_package/CMakeLists.txt | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt b/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt index 9be7f293be0fcc..925ecbe19e448d 100644 --- a/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt @@ -1,16 +1,8 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(package REQUIRED CONFIG) - -# Re-use the same source file from test_package folder -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -# don't link to ${CONAN_LIBS} or CONAN_PKG::package -target_link_libraries(${PROJECT_NAME} PRIVATE package::package) -# in case the target project requires a C++ standard -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) From a3d69d46868bafbe4e75bbc16703ab1071234b13 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Fri, 21 Oct 2022 22:44:14 -0700 Subject: [PATCH 130/300] (#13675) cli11: add version 2.3.0 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/cli11/all/conandata.yml | 3 +++ recipes/cli11/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/cli11/all/conandata.yml b/recipes/cli11/all/conandata.yml index efda5e7b144a2f..4464cb8b06e9d5 100644 --- a/recipes/cli11/all/conandata.yml +++ b/recipes/cli11/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.0": + url: "https://github.com/CLIUtils/CLI11/archive/v2.3.0.tar.gz" + sha256: "b6e116ca1555e2b7f2743fd41e3bd18149baae791acd98eb653e5b07e0f20561" "2.2.0": url: "https://github.com/CLIUtils/CLI11/archive/v2.2.0.tar.gz" sha256: "d60440dc4d43255f872d174e416705f56ba40589f6eb07727f76376fb8378fd6" diff --git a/recipes/cli11/config.yml b/recipes/cli11/config.yml index 5e0bf50730232a..ee8945176ae5b8 100644 --- a/recipes/cli11/config.yml +++ b/recipes/cli11/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.0": + folder: all "2.2.0": folder: all "2.1.2": From 9fb6fea910fc755a598ef3a6e53b38a45d7c047a Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Fri, 21 Oct 2022 23:04:16 -0700 Subject: [PATCH 131/300] (#13676) wolfssl: add version 5.5.1 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/wolfssl/all/conandata.yml | 3 +++ recipes/wolfssl/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/wolfssl/all/conandata.yml b/recipes/wolfssl/all/conandata.yml index 18d51db251a4a4..6fec683102ea7e 100644 --- a/recipes/wolfssl/all/conandata.yml +++ b/recipes/wolfssl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.5.1": + url: "https://github.com/wolfSSL/wolfssl/archive/v5.5.1-stable.tar.gz" + sha256: "97339e6956c90e7c881ba5c748dd04f7c30e5dbe0c06da765418c51375a6dee3" "5.4.0": url: "https://github.com/wolfSSL/wolfssl/archive/v5.4.0-stable.tar.gz" sha256: "dc36cc19dad197253e5c2ecaa490c7eef579ad448706e55d73d79396e814098b" diff --git a/recipes/wolfssl/config.yml b/recipes/wolfssl/config.yml index b5e6c7b8e93a27..84cd9530404f83 100644 --- a/recipes/wolfssl/config.yml +++ b/recipes/wolfssl/config.yml @@ -1,4 +1,6 @@ versions: + "5.5.1": + folder: all "5.4.0": folder: all "5.3.0": From 4e412b1285ca3dfed45872e026a8043b73ecaa5c Mon Sep 17 00:00:00 2001 From: Dennis Date: Sat, 22 Oct 2022 17:04:25 +0200 Subject: [PATCH 132/300] (#13643) asio-grpc: Add 2.2.0 * asio-grpc: Add 2.2.0 * asio-grpc: Revert to required_conan_version 1.50.0 --- recipes/asio-grpc/all/conandata.yml | 3 +++ recipes/asio-grpc/all/conanfile.py | 2 +- recipes/asio-grpc/config.yml | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/asio-grpc/all/conandata.yml b/recipes/asio-grpc/all/conandata.yml index f6696b1252f279..60518d226bd201 100644 --- a/recipes/asio-grpc/all/conandata.yml +++ b/recipes/asio-grpc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.2.0.tar.gz" + sha256: "a820e48681bc66834f7e6dbc326e245416f4ef009769f45826b3d09079afad4c" "2.1.0": url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.1.0.tar.gz" sha256: "51da699eb442db3ec3af1caae5a29d78733ebbd9d1b781f75abe6ce2802fc7c1" diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index ada4cb6ee238a1..7d8cde5489396f 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -61,7 +61,7 @@ def configure(self): def requirements(self): self.requires("grpc/1.48.0") if self.options.use_boost_container or self.options.backend == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") if self.options.backend == "asio": self.requires("asio/1.24.0") if self.options.backend == "unifex": diff --git a/recipes/asio-grpc/config.yml b/recipes/asio-grpc/config.yml index f551acd5153092..1b1afefa695a0e 100644 --- a/recipes/asio-grpc/config.yml +++ b/recipes/asio-grpc/config.yml @@ -1,4 +1,6 @@ versions: + "2.2.0": + folder: all "2.1.0": folder: all "2.0.0": From 075c6149950531eaf0d87d84dde2170b678a391e Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 22 Oct 2022 19:24:27 +0200 Subject: [PATCH 133/300] (#13561) restbed: add restbed/4.8 recipe * restbed: add restbed/4.8 recipe * restbed: add old-school test package * restbed: allow static Windows build + address feedback * restbed: require at least gcc 5 * restbed: fix conan v2 warning * restbed: use self.info in validate * restbed: set CMAKE_CXX_STANDARD if not already set * Apply suggestions from code review * Add 'm' tot system libraries * Update recipes/restbed/all/conanfile.py Co-authored-by: Uilian Ries * Address feedback * Address feedback * restbed: expand minimum compiler conformance testing * Use LicenseRef- prefix for license file Co-authored-by: Uilian Ries --- recipes/restbed/all/conandata.yml | 12 ++ recipes/restbed/all/conanfile.py | 128 ++++++++++++++++++ .../all/patches/4.8-0001-cmake-conan.patch | 84 ++++++++++++ .../4.8-0002-mingw-deprecated-fix.patch | 12 ++ .../restbed/all/test_package/CMakeLists.txt | 8 ++ recipes/restbed/all/test_package/conanfile.py | 30 ++++ .../restbed/all/test_package/test_package.cpp | 40 ++++++ .../all/test_v1_package/CMakeLists.txt | 11 ++ .../restbed/all/test_v1_package/conanfile.py | 17 +++ recipes/restbed/config.yml | 3 + 10 files changed, 345 insertions(+) create mode 100644 recipes/restbed/all/conandata.yml create mode 100644 recipes/restbed/all/conanfile.py create mode 100644 recipes/restbed/all/patches/4.8-0001-cmake-conan.patch create mode 100644 recipes/restbed/all/patches/4.8-0002-mingw-deprecated-fix.patch create mode 100644 recipes/restbed/all/test_package/CMakeLists.txt create mode 100644 recipes/restbed/all/test_package/conanfile.py create mode 100644 recipes/restbed/all/test_package/test_package.cpp create mode 100644 recipes/restbed/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/restbed/all/test_v1_package/conanfile.py create mode 100644 recipes/restbed/config.yml diff --git a/recipes/restbed/all/conandata.yml b/recipes/restbed/all/conandata.yml new file mode 100644 index 00000000000000..6e0b42fcccc443 --- /dev/null +++ b/recipes/restbed/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "4.8": + url: "https://github.com/Corvusoft/restbed/archive/refs/tags/4.8.tar.gz" + sha256: "4801833f86a67b8a123c2c01203e259eb81157e1e9ef144a3b6395cb2d838a42" +patches: + "4.8": + - patch_file: "patches/4.8-0001-cmake-conan.patch" + patch_description: "Use CMake targets + separate static/shared" + patch_type: "conan" + - patch_file: "patches/4.8-0002-mingw-deprecated-fix.patch" + patch_description: "MinGW apparently does not support deprecated and __declspec in the same line" + patch_type: "portability" diff --git a/recipes/restbed/all/conanfile.py b/recipes/restbed/all/conanfile.py new file mode 100644 index 00000000000000..0a5e2d6cfc9259 --- /dev/null +++ b/recipes/restbed/all/conanfile.py @@ -0,0 +1,128 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, rm, save +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os +import re + +required_conan_version = ">=1.52.0" + + +class RestbedConan(ConanFile): + name = "restbed" + homepage = "https://github.com/Corvusoft/restbed" + description = "Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications." + topics = ("restful", "server", "client", "json", "http", "ssl", "tls") + url = "https://github.com/conan-io/conan-center-index" + license = "AGPL-3.0-or-later", "LicenseRef-CPL" # Corvusoft Permissive License (CPL) + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "ipc": [True, False], + "with_openssl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "ipc": False, + "with_openssl": True, + } + + @property + def _minimum_cpp_standard(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "7", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + if self.settings.os in ("Windows", ): + del self.options.ipc + + def validate(self): + if getattr(self.info.settings.compiler, "cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("asio/1.24.0") + if self.options.with_openssl: + self.requires("openssl/3.0.5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_SSL"] = self.options.with_openssl + tc.variables["BUILD_IPC"] = self.options.get_safe("ipc", False) + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if not self.options.shared: + # Remove __declspec(dllexport) and __declspec(dllimport) + for root, _, files in os.walk(self.source_folder): + for file in files: + if os.path.splitext(file)[1] in (".hpp", ".h"): + full_path = os.path.join(root, file) + data = load(self, full_path) + data, _ = re.subn(r"__declspec\((dllexport|dllimport)\)", "", data) + save(self, full_path, data) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + libname = "restbed" + if self.settings.os in ("Windows", ) and self.options.shared: + libname += "-shared" + self.cpp_info.libs = [libname] + + if self.settings.os in ("FreeBSD", "Linux", ): + self.cpp_info.system_libs.extend(["dl", "m"]) + elif self.settings.os in ("Windows", ): + self.cpp_info.system_libs.append("mswsock") diff --git a/recipes/restbed/all/patches/4.8-0001-cmake-conan.patch b/recipes/restbed/all/patches/4.8-0001-cmake-conan.patch new file mode 100644 index 00000000000000..e239976a0dfcee --- /dev/null +++ b/recipes/restbed/all/patches/4.8-0001-cmake-conan.patch @@ -0,0 +1,84 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -19,7 +19,7 @@ + option( BUILD_TESTS "Build unit tests." ON ) + option( BUILD_SSL "Build secure socket layer support." ON ) + option( BUILD_IPC "Build unix domain socket layer support." OFF ) +- ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # + # Configuration + # +@@ -57,7 +57,7 @@ find_package( asio REQUIRED ) + + if ( BUILD_SSL ) + add_definitions( "-DBUILD_SSL" ) +- find_package( openssl REQUIRED ) ++ find_package( OpenSSL REQUIRED ) + endif ( ) + + include_directories( ${INCLUDE_DIR} SYSTEM ${asio_INCLUDE} ${ssl_INCLUDE} ) +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -68,7 +68,7 @@ + + if ( WIN32 ) + add_definitions( -DWIN_DLL_EXPORT ) +- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251" ) ++ #set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251" ) + endif ( ) + + # +@@ -75,13 +75,14 @@ + # Build + # + file( GLOB_RECURSE MANIFEST "${SOURCE_DIR}/*.cpp" ) +- ++if(NOT BUILD_SHARED_LIBS) + set( STATIC_LIBRARY_NAME "${PROJECT_NAME}-static" ) + add_library( ${STATIC_LIBRARY_NAME} STATIC ${MANIFEST} ) + set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 ) + set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON ) + set_target_properties( ${STATIC_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ) +- ++target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE asio::asio ) ++else() + set( SHARED_LIBRARY_NAME "${PROJECT_NAME}-shared" ) + add_library( ${SHARED_LIBRARY_NAME} SHARED ${MANIFEST} ) + set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 ) +@@ -93,13 +94,20 @@ + set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ) + endif ( ) + set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} ) +- ++target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE asio::asio ) ++endif() + if ( BUILD_SSL ) +- target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_SHARED} ${crypto_LIBRARY_SHARED} ) +- target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_STATIC} ${crypto_LIBRARY_STATIC} ${CMAKE_DL_LIBS} ) ++if(BUILD_SHARED_LIBS) ++ target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE OpenSSL::SSL $<$:mswsock>) ++else() ++ target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE OpenSSL::SSL ${CMAKE_DL_LIBS} $<$:mswsock>) ++endif() + else ( ) ++if(BUILD_SHARED_LIBS) +- target_link_libraries( ${SHARED_LIBRARY_NAME} ) ++ target_link_libraries( ${SHARED_LIBRARY_NAME} OpenSSL::SSL $<$:mswsock>) ++else() +- target_link_libraries( ${STATIC_LIBRARY_NAME} ${CMAKE_DL_LIBS} ) ++ target_link_libraries( ${STATIC_LIBRARY_NAME} ${CMAKE_DL_LIBS} OpenSSL::SSL $<$:mswsock>) ++endif() + endif ( ) + + if ( BUILD_TESTS ) +@@ -119,5 +127,8 @@ + + install( FILES "${INCLUDE_DIR}/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_PREFIX}/include" ) + install( FILES ${ARTIFACTS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/corvusoft/${PROJECT_NAME}" ) ++if(NOT BUILD_SHARED_LIBS) + install( TARGETS ${STATIC_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) ++else() +-install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) ++install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT library ) ++endif() diff --git a/recipes/restbed/all/patches/4.8-0002-mingw-deprecated-fix.patch b/recipes/restbed/all/patches/4.8-0002-mingw-deprecated-fix.patch new file mode 100644 index 00000000000000..98f35027afdd11 --- /dev/null +++ b/recipes/restbed/all/patches/4.8-0002-mingw-deprecated-fix.patch @@ -0,0 +1,12 @@ +--- source/corvusoft/restbed/http.hpp ++++ source/corvusoft/restbed/http.hpp +@@ -40,7 +40,7 @@ + class Response; + class Settings; +- +- class [[deprecated("HTTP client is deprecated; we will release a complimentary client framework at a future date.")]] HTTP_EXPORT Http ++ class HTTP_EXPORT Http; ++ class [[deprecated("HTTP client is deprecated; we will release a complimentary client framework at a future date.")]] Http + { + public: + //Friends diff --git a/recipes/restbed/all/test_package/CMakeLists.txt b/recipes/restbed/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..3bad6b5f5053db --- /dev/null +++ b/recipes/restbed/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(restbed REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE restbed::restbed) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/restbed/all/test_package/conanfile.py b/recipes/restbed/all/test_package/conanfile.py new file mode 100644 index 00000000000000..f72d1f660e19fb --- /dev/null +++ b/recipes/restbed/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/restbed/all/test_package/test_package.cpp b/recipes/restbed/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..d4731f4f97f74e --- /dev/null +++ b/recipes/restbed/all/test_package/test_package.cpp @@ -0,0 +1,40 @@ +#include + +#include +#include +#include +#include + +static void post_method_handler( const std::shared_ptr< restbed::Session > session ) +{ + const auto request = session->get_request( ); + + int content_length = request->get_header( "Content-Length", 0 ); + + session->fetch( content_length, [ ]( const std::shared_ptr< restbed::Session > session, const restbed::Bytes & body ) + { + fprintf( stdout, "%.*s\n", ( int ) body.size( ), body.data( ) ); + session->close( restbed::OK, "Hello, World!", { { "Content-Length", "13" } } ); + } ); +} + +int main(int argc, char *argv[]) +{ + auto resource = std::make_shared< restbed::Resource >( ); + resource->set_path( "/resource" ); + resource->set_method_handler( "POST", post_method_handler ); + + auto settings = std::make_shared< restbed::Settings >( ); + settings->set_port( 1984 ); + settings->set_default_header( "Connection", "close" ); + + restbed::Service service; + service.publish( resource ); + + if (argc > 1 && strcmp(argv[1], "run") == 0) { + // Don't start the service to avoid blocking + service.start( settings ); + } + + return EXIT_SUCCESS; +} diff --git a/recipes/restbed/all/test_v1_package/CMakeLists.txt b/recipes/restbed/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..87b1318ff1676b --- /dev/null +++ b/recipes/restbed/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(restbed REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE restbed::restbed) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/restbed/all/test_v1_package/conanfile.py b/recipes/restbed/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/restbed/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/restbed/config.yml b/recipes/restbed/config.yml new file mode 100644 index 00000000000000..5a6e56bf2599d3 --- /dev/null +++ b/recipes/restbed/config.yml @@ -0,0 +1,3 @@ +versions: + "4.8": + folder: all From 03c38024938acca8b24fa3a37e7458417ec530c1 Mon Sep 17 00:00:00 2001 From: toge Date: Sun, 23 Oct 2022 11:44:58 +0900 Subject: [PATCH 134/300] (#13692) daw_json_link: add version 3.1.1 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/daw_json_link/all/conandata.yml | 3 +++ recipes/daw_json_link/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/daw_json_link/all/conandata.yml b/recipes/daw_json_link/all/conandata.yml index 9c2d497ce2b1bc..33e4220a0ef533 100644 --- a/recipes/daw_json_link/all/conandata.yml +++ b/recipes/daw_json_link/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1.1": + url: "https://github.com/beached/daw_json_link/archive/v3.1.1.tar.gz" + sha256: "7d340886898b2ea3c595f0f871c81e4c7382fe53d22d80edc5629768e49fa634" "3.1.0": url: "https://github.com/beached/daw_json_link/archive/v3.1.0.tar.gz" sha256: "c1134fed24794cda598306d23d23c393a0df8ee13d0019cae6ed46b939dad190" diff --git a/recipes/daw_json_link/config.yml b/recipes/daw_json_link/config.yml index e7355da02f8ab7..fd13a438a6f480 100644 --- a/recipes/daw_json_link/config.yml +++ b/recipes/daw_json_link/config.yml @@ -1,4 +1,6 @@ versions: + "3.1.1": + folder: "all" "3.1.0": folder: "all" "3.0.5": From 0546e94574c319ae73bb2fdda01a9894b79b21b4 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 24 Oct 2022 01:44:46 +0900 Subject: [PATCH 135/300] (#13639) grpc: add version 1.50.0 * grpc: add version 1.50.0 * add version to config.yml --- recipes/grpc/all/conandata.yml | 8 + recipes/grpc/all/conanfile.py | 2 +- .../v1.50.x/001-disable-cppstd-override.patch | 26 ++ ...002-consume-protos-from-requirements.patch | 326 ++++++++++++++++++ recipes/grpc/config.yml | 2 + 5 files changed, 363 insertions(+), 1 deletion(-) create mode 100644 recipes/grpc/all/patches/v1.50.x/001-disable-cppstd-override.patch create mode 100644 recipes/grpc/all/patches/v1.50.x/002-consume-protos-from-requirements.patch diff --git a/recipes/grpc/all/conandata.yml b/recipes/grpc/all/conandata.yml index 84ca1e99ad81ec..4bb059df4b8b4a 100644 --- a/recipes/grpc/all/conandata.yml +++ b/recipes/grpc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.50.0": + url: "https://github.com/grpc/grpc/archive/v1.50.0.tar.gz" + sha256: "76900ab068da86378395a8e125b5cc43dfae671e09ff6462ddfef18676e2165a" "1.48.0": url: "https://github.com/grpc/grpc/archive/v1.48.0.tar.gz" sha256: "9b1f348b15a7637f5191e4e673194549384f2eccf01fcef7cc1515864d71b424" @@ -9,6 +12,11 @@ sources: url: "https://github.com/grpc/grpc/archive/refs/tags/v1.46.3.tar.gz" sha256: "d6cbf22cb5007af71b61c6be316a79397469c58c82a942552a62e708bce60964" patches: + "1.50.0": + - patch_file: "patches/v1.50.x/001-disable-cppstd-override.patch" + base_path: "source_subfolder" + - patch_file: "patches/v1.50.x/002-consume-protos-from-requirements.patch" + base_path: "source_subfolder" "1.48.0": - patch_file: "patches/v1.48.x/001-disable-cppstd-override.patch" base_path: "source_subfolder" diff --git a/recipes/grpc/all/conanfile.py b/recipes/grpc/all/conanfile.py index 79d1581f47087d..11b78891b33dc7 100644 --- a/recipes/grpc/all/conanfile.py +++ b/recipes/grpc/all/conanfile.py @@ -9,7 +9,7 @@ import os import shutil -required_conan_version = ">=1.49.0" +required_conan_version = ">=1.52.0" class grpcConan(ConanFile): diff --git a/recipes/grpc/all/patches/v1.50.x/001-disable-cppstd-override.patch b/recipes/grpc/all/patches/v1.50.x/001-disable-cppstd-override.patch new file mode 100644 index 00000000000000..a9339dbcc896b4 --- /dev/null +++ b/recipes/grpc/all/patches/v1.50.x/001-disable-cppstd-override.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7052846..259fa93 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -227,21 +227,6 @@ if (NOT DEFINED CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 11) + endif() + +-# Add c++14 flags +-if (NOT DEFINED CMAKE_CXX_STANDARD) +- set(CMAKE_CXX_STANDARD 14) +-else() +- if (CMAKE_CXX_STANDARD LESS 14) +- message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 14, please specify at least SET(CMAKE_CXX_STANDARD 14)") +- endif() +-endif() +-if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) +- set(CMAKE_CXX_STANDARD_REQUIRED ON) +-endif() +-if (NOT DEFINED CMAKE_CXX_EXTENSIONS) +- set(CMAKE_CXX_EXTENSIONS OFF) +-endif() +- + if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) + endif() diff --git a/recipes/grpc/all/patches/v1.50.x/002-consume-protos-from-requirements.patch b/recipes/grpc/all/patches/v1.50.x/002-consume-protos-from-requirements.patch new file mode 100644 index 00000000000000..515291213b2675 --- /dev/null +++ b/recipes/grpc/all/patches/v1.50.x/002-consume-protos-from-requirements.patch @@ -0,0 +1,326 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 259fa93..fb05774 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -452,7 +452,7 @@ function(protobuf_generate_grpc_cpp_with_import_path_correction FILE_LOCATION IM + endif() + + # Sets the include path for ProtoBuf files +- set(_protobuf_include_path -I . -I ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR}) ++ set(_protobuf_include_path -I . -I ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR} -I ${googleapis_RES_DIRS} -I ${grpc-proto_RES_DIRS}) + # The absolute path of the expected place for the input proto file + # For example, health proto has package name grpc.health.v1, it's expected to be: + # ${_gRPC_PROTO_SRCS_DIR}/grpc/health/v1/health.proto +@@ -477,8 +477,6 @@ function(protobuf_generate_grpc_cpp_with_import_path_correction FILE_LOCATION IM + # path. For example, health proto has package name grpc.health.v1, the bash + # equivalent would be: + # cp src/proto/grpc/health/v1/health.proto ${_gRPC_PROTO_SRCS_DIR}/grpc/health/v1 +- file(MAKE_DIRECTORY ${_gRPC_PROTO_SRCS_DIR}/${REL_DIR}) +- file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${FILE_LOCATION} DESTINATION ${_gRPC_PROTO_SRCS_DIR}/${REL_DIR}) + + #if cross-compiling, find host plugin + if(CMAKE_CROSSCOMPILING) +@@ -491,18 +489,15 @@ function(protobuf_generate_grpc_cpp_with_import_path_correction FILE_LOCATION IM + OUTPUT "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc" + "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h" + "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h" +- "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc" +- "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h" + COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE} + ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR} +- --cpp_out=${_gRPC_PROTO_GENS_DIR} + --plugin=protoc-gen-grpc=${_gRPC_CPP_PLUGIN} + ${_protobuf_include_path} +- ${REL_FIL} +- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE_LOCATION} ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} ${_gRPC_CPP_PLUGIN} ++ ${FILE_LOCATION} ++ DEPENDS ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin + WORKING_DIRECTORY ${_gRPC_PROTO_SRCS_DIR} +- COMMENT "Running gRPC C++ protocol buffer compiler for ${IMPORT_PATH}" +- VERBATIM) ++ COMMENT "Running gRPC C++ protocol buffer compiler for ${FILE_LOCATION}" ++ ) + endfunction() + + # These options allow users to enable or disable the building of the various +@@ -554,199 +549,28 @@ add_custom_target(tools + DEPENDS tools_c tools_cxx) + + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/channelz/channelz.proto src/proto/grpc/channelz/channelz.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/core/stats.proto src/proto/grpc/core/stats.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/health/v1/health.proto src/proto/grpc/health/v1/health.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/lb/v1/load_balancer.proto src/proto/grpc/lb/v1/load_balancer.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/lookup/v1/rls.proto src/proto/grpc/lookup/v1/rls.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/lookup/v1/rls_config.proto src/proto/grpc/lookup/v1/rls_config.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/reflection/v1alpha/reflection.proto src/proto/grpc/reflection/v1alpha/reflection.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/status/status.proto src/proto/grpc/status/status.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/benchmark_service.proto src/proto/grpc/testing/benchmark_service.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/control.proto src/proto/grpc/testing/control.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/duplicate/echo_duplicate.proto src/proto/grpc/testing/duplicate/echo_duplicate.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/echo.proto src/proto/grpc/testing/echo.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/echo_messages.proto src/proto/grpc/testing/echo_messages.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/empty.proto src/proto/grpc/testing/empty.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/istio_echo.proto src/proto/grpc/testing/istio_echo.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/messages.proto src/proto/grpc/testing/messages.proto ++ grpc/channelz/v1/channelz.proto grpc/channelz/v1/channelz.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/payloads.proto src/proto/grpc/testing/payloads.proto ++ grpc/core/stats.proto grpc/core/stats.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/report_qps_scenario_service.proto src/proto/grpc/testing/report_qps_scenario_service.proto ++ grpc/health/v1/health.proto grpc/health/v1/health.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/simple_messages.proto src/proto/grpc/testing/simple_messages.proto ++ grpc/lb/v1/load_balancer.proto grpc/lb/v1/load_balancer.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/stats.proto src/proto/grpc/testing/stats.proto ++ grpc/lookup/v1/rls.proto grpc/lookup/v1/rls.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/test.proto src/proto/grpc/testing/test.proto ++ grpc/lookup/v1/rls_config.proto grpc/lookup/v1/rls_config.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/worker_service.proto src/proto/grpc/testing/worker_service.proto ++ grpc/reflection/v1alpha/reflection.proto grpc/reflection/v1alpha/reflection.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/ads_for_test.proto src/proto/grpc/testing/xds/ads_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/cds_for_test.proto src/proto/grpc/testing/xds/cds_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/eds_for_test.proto src/proto/grpc/testing/xds/eds_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/lds_rds_for_test.proto src/proto/grpc/testing/xds/lds_rds_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/lrs_for_test.proto src/proto/grpc/testing/xds/lrs_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/address.proto src/proto/grpc/testing/xds/v3/address.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/ads.proto src/proto/grpc/testing/xds/v3/ads.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/aggregate_cluster.proto src/proto/grpc/testing/xds/v3/aggregate_cluster.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/base.proto src/proto/grpc/testing/xds/v3/base.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/cluster.proto src/proto/grpc/testing/xds/v3/cluster.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/config_dump.proto src/proto/grpc/testing/xds/v3/config_dump.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/config_source.proto src/proto/grpc/testing/xds/v3/config_source.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/csds.proto src/proto/grpc/testing/xds/v3/csds.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/discovery.proto src/proto/grpc/testing/xds/v3/discovery.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/endpoint.proto src/proto/grpc/testing/xds/v3/endpoint.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/expr.proto src/proto/grpc/testing/xds/v3/expr.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/extension.proto src/proto/grpc/testing/xds/v3/extension.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/fault.proto src/proto/grpc/testing/xds/v3/fault.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/fault_common.proto src/proto/grpc/testing/xds/v3/fault_common.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/http_connection_manager.proto src/proto/grpc/testing/xds/v3/http_connection_manager.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/http_filter_rbac.proto src/proto/grpc/testing/xds/v3/http_filter_rbac.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/listener.proto src/proto/grpc/testing/xds/v3/listener.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/load_report.proto src/proto/grpc/testing/xds/v3/load_report.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/lrs.proto src/proto/grpc/testing/xds/v3/lrs.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/metadata.proto src/proto/grpc/testing/xds/v3/metadata.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/orca_load_report.proto src/proto/grpc/testing/xds/v3/orca_load_report.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/orca_service.proto src/proto/grpc/testing/xds/v3/orca_service.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/outlier_detection.proto src/proto/grpc/testing/xds/v3/outlier_detection.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/path.proto src/proto/grpc/testing/xds/v3/path.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/percent.proto src/proto/grpc/testing/xds/v3/percent.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/protocol.proto src/proto/grpc/testing/xds/v3/protocol.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/range.proto src/proto/grpc/testing/xds/v3/range.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/rbac.proto src/proto/grpc/testing/xds/v3/rbac.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/regex.proto src/proto/grpc/testing/xds/v3/regex.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/ring_hash.proto src/proto/grpc/testing/xds/v3/ring_hash.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/round_robin.proto src/proto/grpc/testing/xds/v3/round_robin.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/route.proto src/proto/grpc/testing/xds/v3/route.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/router.proto src/proto/grpc/testing/xds/v3/router.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/string.proto src/proto/grpc/testing/xds/v3/string.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/tls.proto src/proto/grpc/testing/xds/v3/tls.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/typed_struct.proto src/proto/grpc/testing/xds/v3/typed_struct.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/udpa_typed_struct.proto src/proto/grpc/testing/xds/v3/udpa_typed_struct.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/wrr_locality.proto src/proto/grpc/testing/xds/v3/wrr_locality.proto ++ src/proto/grpc/status/status.proto grpc/status/status.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( + test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto +@@ -3536,10 +3360,8 @@ endif() + + if(gRPC_BUILD_CODEGEN) + add_library(grpc++_reflection +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.pb.cc +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.pb.h +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h ++ ${_gRPC_PROTO_GENS_DIR}/grpc/reflection/v1alpha/reflection.grpc.pb.cc ++ ${_gRPC_PROTO_GENS_DIR}/grpc/reflection/v1alpha/reflection.grpc.pb.h + src/cpp/ext/proto_server_reflection.cc + src/cpp/ext/proto_server_reflection_plugin.cc + ) +@@ -3578,6 +3400,7 @@ target_link_libraries(grpc++_reflection + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc++ ++ grpc-proto::grpc-proto + ) + + foreach(_hdr +@@ -4149,10 +3972,8 @@ endif() + # See https://github.com/grpc/grpc/issues/19473 + if(gRPC_BUILD_CODEGEN AND NOT gRPC_USE_PROTO_LITE) + add_library(grpcpp_channelz +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.pb.cc +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.cc +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.pb.h +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.h ++ ${_gRPC_PROTO_GENS_DIR}/grpc/channelz/v1/channelz.grpc.pb.cc ++ ${_gRPC_PROTO_GENS_DIR}/grpc/channelz/v1/channelz.grpc.pb.h + src/cpp/server/channelz/channelz_service.cc + src/cpp/server/channelz/channelz_service_plugin.cc + ) +@@ -4191,6 +4012,7 @@ target_link_libraries(grpcpp_channelz + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc++ ++ grpc-proto::grpc-proto + ) + + foreach(_hdr +diff --git a/src/cpp/ext/proto_server_reflection.h b/src/cpp/ext/proto_server_reflection.h +index a9b5db0..528e75b 100644 +--- a/src/cpp/ext/proto_server_reflection.h ++++ b/src/cpp/ext/proto_server_reflection.h +@@ -29,8 +29,8 @@ + #include + #include + +-#include "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h" +-#include "src/proto/grpc/reflection/v1alpha/reflection.pb.h" ++#include "grpc/reflection/v1alpha/reflection.grpc.pb.h" ++#include "grpc/reflection/v1alpha/reflection.pb.h" + + namespace grpc { + +diff --git a/src/cpp/server/channelz/channelz_service.h b/src/cpp/server/channelz/channelz_service.h +index 91936da..0172493 100644 +--- a/src/cpp/server/channelz/channelz_service.h ++++ b/src/cpp/server/channelz/channelz_service.h +@@ -24,8 +24,9 @@ + #include + #include + +-#include "src/proto/grpc/channelz/channelz.grpc.pb.h" +-#include "src/proto/grpc/channelz/channelz.pb.h" ++#include "grpc/channelz/v1/channelz.grpc.pb.h" ++#include "grpc/channelz/v1/channelz.pb.h" ++ + + namespace grpc { + diff --git a/recipes/grpc/config.yml b/recipes/grpc/config.yml index bf40c0d340616c..f6a1a1bf0f3cb7 100644 --- a/recipes/grpc/config.yml +++ b/recipes/grpc/config.yml @@ -1,4 +1,6 @@ versions: + "1.50.0": + folder: "all" "1.48.0": folder: "all" "1.47.1": From 2880012b4a71cea14000ed01b093f879e0d43156 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 24 Oct 2022 02:25:13 +0900 Subject: [PATCH 136/300] (#13701) c-blosc: update zlib --- recipes/c-blosc/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/c-blosc/all/conanfile.py b/recipes/c-blosc/all/conanfile.py index 88c3ac390c7a0a..1a0282104d95b0 100644 --- a/recipes/c-blosc/all/conanfile.py +++ b/recipes/c-blosc/all/conanfile.py @@ -69,7 +69,7 @@ def requirements(self): if self.options.with_snappy: self.requires("snappy/1.1.9") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_zstd: self.requires("zstd/1.5.2") From 928040b9e3fe8723be31e6d396b889eb1776f37d Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 24 Oct 2022 03:06:00 +0900 Subject: [PATCH 137/300] (#13702) cpp-httplib: update zlib --- recipes/cpp-httplib/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cpp-httplib/all/conanfile.py b/recipes/cpp-httplib/all/conanfile.py index 6aed8f9bb2dcc4..6e6fd116cee567 100644 --- a/recipes/cpp-httplib/all/conanfile.py +++ b/recipes/cpp-httplib/all/conanfile.py @@ -38,7 +38,7 @@ def requirements(self): if self.options.with_openssl: self.requires("openssl/1.1.1q") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.get_safe("with_brotli"): self.requires("brotli/1.0.9") From f8c3ff27e99d973d249ebdac250658494b48676a Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Sun, 23 Oct 2022 21:45:24 -0500 Subject: [PATCH 138/300] (#13626) libalsa: Fix up V2 support * libalsa: Fix up V2 support * Remove unnecessary chdir * Place VirtualBuildEnv before AutotoolsToolchain * Use chdir when necessary * Fix version for chdir --- recipes/libalsa/all/conanfile.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/recipes/libalsa/all/conanfile.py b/recipes/libalsa/all/conanfile.py index b5408d4dbbe381..6d05a2139d66ce 100644 --- a/recipes/libalsa/all/conanfile.py +++ b/recipes/libalsa/all/conanfile.py @@ -4,6 +4,7 @@ from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os required_conan_version = ">=1.52.0" @@ -14,10 +15,9 @@ class LibalsaConan(ConanFile): license = "LGPL-2.1" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/alsa-project/alsa-lib" - topics = ("libalsa", "alsa", "sound", "audio", "midi") + topics = ("alsa", "sound", "audio", "midi") description = "Library of ALSA: The Advanced Linux Sound Architecture, that provides audio " \ "and MIDI functionality to the Linux operating system" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -49,8 +49,8 @@ def layout(self): basic_layout(self, src_folder="src") def validate(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux supported") + if self.info.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): self.tool_requires("libtool/2.4.7") @@ -60,6 +60,9 @@ def source(self): destination=self.source_folder, strip_root=True) def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" tc.configure_args.extend([ @@ -68,22 +71,29 @@ def generate(self): "--datadir=${prefix}/res", ]) tc.generate() - env = VirtualBuildEnv(self) - env.generate() def build(self): apply_conandata_patches(self) - with chdir(self, self.source_folder): - autotools = Autotools(self) + autotools = Autotools(self) + if Version(self.version) > "1.2.4": autotools.autoreconf() autotools.configure() autotools.make() + else: + with chdir(self, self.source_folder): + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - with chdir(self, self.source_folder): + if Version(self.version) > "1.2.4": autotools = Autotools(self) autotools.install() + else: + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) From 6acac994046c31267fdc1dfacce0ebfc8cd3e44e Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Sun, 23 Oct 2022 22:25:12 -0500 Subject: [PATCH 139/300] (#13640) wayland: Check for the tools.gnu:pkg_config conf setting --- recipes/wayland/all/conanfile.py | 6 +++--- recipes/wayland/all/test_package/conanfile.py | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/wayland/all/conanfile.py b/recipes/wayland/all/conanfile.py index 80563c5f2cd9cf..ac2e9c1f4a2bde 100644 --- a/recipes/wayland/all/conanfile.py +++ b/recipes/wayland/all/conanfile.py @@ -22,7 +22,6 @@ class WaylandConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://wayland.freedesktop.org" license = "MIT" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -61,11 +60,12 @@ def requirements(self): def validate(self): if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration("Wayland can be built on Linux only") + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): self.tool_requires("meson/0.63.3") - self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") if cross_building(self): self.tool_requires(self.ref) diff --git a/recipes/wayland/all/test_package/conanfile.py b/recipes/wayland/all/test_package/conanfile.py index 3752c2672501d0..63204720ff6f0d 100644 --- a/recipes/wayland/all/test_package/conanfile.py +++ b/recipes/wayland/all/test_package/conanfile.py @@ -21,7 +21,8 @@ def requirements(self): def build_requirements(self): self.tool_requires(self.tested_reference_str) - self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def layout(self): cmake_layout(self) From 950fc8fecb5da657f56ff91c159654724d71e639 Mon Sep 17 00:00:00 2001 From: Ahajha <44127594+Ahajha@users.noreply.github.com> Date: Sun, 23 Oct 2022 23:46:14 -0400 Subject: [PATCH 140/300] (#13651) Vulkan loader 1.3.231 * Add vulkan-headers 1.3.231 * Conditionally skip find_package(Wayland) replacement * Add vulkan-loader 1.3.231 * Remove vulkan-loader dep on wayland after 1.2.231 * Bump wayland version Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/vulkan-loader/all/conandata.yml | 3 +++ recipes/vulkan-loader/all/conanfile.py | 8 +++++--- recipes/vulkan-loader/config.yml | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/recipes/vulkan-loader/all/conandata.yml b/recipes/vulkan-loader/all/conandata.yml index b1c25119aefb6e..492ebfb1d25752 100644 --- a/recipes/vulkan-loader/all/conandata.yml +++ b/recipes/vulkan-loader/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/v1.3.231.tar.gz" + sha256: "02e185b939635167ea8f8815f8daab76af36923a3b995951fe6a5d3e25c55bf7" "1.3.224.0": url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.224.0.tar.gz" sha256: "9f102a89b7d350ce5a6c82887459821aa9725c521128495ed7cbda637ed52022" diff --git a/recipes/vulkan-loader/all/conanfile.py b/recipes/vulkan-loader/all/conanfile.py index 27d1253c5a47dc..335e2cc80edb79 100644 --- a/recipes/vulkan-loader/all/conanfile.py +++ b/recipes/vulkan-loader/all/conanfile.py @@ -75,8 +75,8 @@ def requirements(self): self.requires(f"vulkan-headers/{self.version}") if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"): self.requires("xorg/system") - if self.options.get_safe("with_wsi_wayland"): - self.requires("wayland/1.20.0") + if Version(self.version) < "1.3.231" and self.options.get_safe("with_wsi_wayland"): + self.requires("wayland/1.21.0") def validate(self): if self.options.get_safe("with_wsi_directfb"): @@ -154,7 +154,9 @@ def _patch_sources(self): # Indeed we want to use upstream Find modules of xcb, x11, wayland and directfb. There are properly using pkgconfig under the hood. replace_in_file(self, cmakelists, "find_package(XCB REQUIRED)", "find_package(XCB REQUIRED MODULE)") replace_in_file(self, cmakelists, "find_package(X11 REQUIRED)", "find_package(X11 REQUIRED MODULE)") - replace_in_file(self, cmakelists, "find_package(Wayland REQUIRED)", "find_package(Wayland REQUIRED MODULE)") + # find_package(Wayland REQUIRED) was removed, as it was unused + if Version(self.version) < "1.3.231": + replace_in_file(self, cmakelists, "find_package(Wayland REQUIRED)", "find_package(Wayland REQUIRED MODULE)") replace_in_file(self, cmakelists, "find_package(DirectFB REQUIRED)", "find_package(DirectFB REQUIRED MODULE)") def build(self): diff --git a/recipes/vulkan-loader/config.yml b/recipes/vulkan-loader/config.yml index 19625cd66e0dd2..f2dee728628655 100644 --- a/recipes/vulkan-loader/config.yml +++ b/recipes/vulkan-loader/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231": + folder: all "1.3.224.0": folder: all "1.3.221": From 38e2584e7155053e3416966a9b8674bb9206210d Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 06:27:44 +0200 Subject: [PATCH 141/300] (#13658) pthreadpool: conan v2 support * conan v2 support * cast to str for cache_variables --- recipes/pthreadpool/all/CMakeLists.txt | 14 ++-- recipes/pthreadpool/all/conanfile.py | 77 +++++++++++-------- .../all/test_package/CMakeLists.txt | 11 ++- .../pthreadpool/all/test_package/conanfile.py | 19 +++-- .../all/test_v1_package/CMakeLists.txt | 11 +++ .../all/test_v1_package/conanfile.py | 17 ++++ 6 files changed, 95 insertions(+), 54 deletions(-) create mode 100644 recipes/pthreadpool/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/pthreadpool/all/test_v1_package/conanfile.py diff --git a/recipes/pthreadpool/all/CMakeLists.txt b/recipes/pthreadpool/all/CMakeLists.txt index a42d7ed679ae93..4a9151537d740c 100644 --- a/recipes/pthreadpool/all/CMakeLists.txt +++ b/recipes/pthreadpool/all/CMakeLists.txt @@ -1,14 +1,10 @@ cmake_minimum_required(VERSION 3.4) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_library(fxdiv INTERFACE) -target_link_libraries(fxdiv INTERFACE CONAN_PKG::fxdiv) - -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +find_package(fxdiv REQUIRED CONFIG) +if(NOT TARGET fxdiv) + add_library(fxdiv INTERFACE IMPORTED) + set_property(TARGET fxdiv PROPERTY INTERFACE_LINK_LIBRARIES fxdiv::fxdiv) endif() -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/pthreadpool/all/conanfile.py b/recipes/pthreadpool/all/conanfile.py index 25b3858097bf34..026fed28423d8b 100644 --- a/recipes/pthreadpool/all/conanfile.py +++ b/recipes/pthreadpool/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools -import glob +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file import os +required_conan_version = ">=1.51.1" + class PthreadpoolConan(ConanFile): name = "pthreadpool" @@ -9,8 +12,7 @@ class PthreadpoolConan(ConanFile): "implementation. It provides similar functionality to " \ "#pragma omp parallel for, but with additional features." license = "BSD-2-Clause" - topics = ("conan", "pthreadpool", "multi-threading", "pthreads", - "multi-core", "threadpool") + topics = ("multi-threading", "pthreads", "multi-core", "threadpool") homepage = "https://github.com/Maratyszcza/pthreadpool" url = "https://github.com/conan-io/conan-center-index" @@ -27,12 +29,6 @@ class PthreadpoolConan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -40,47 +36,60 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("fxdiv/cci.20200417") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("pthreadpool-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["PTHREADPOOL_LIBRARY_TYPE"] = "default" + tc.variables["PTHREADPOOL_ALLOW_DEPRECATED_API"] = True + # TODO: remove str cast in conan 1.53.0 (see https://github.com/conan-io/conan/pull/12086) + tc.cache_variables["PTHREADPOOL_SYNC_PRIMITIVE"] = str(self.options.sync_primitive) + tc.variables["PTHREADPOOL_BUILD_TESTS"] = False + tc.variables["PTHREADPOOL_BUILD_BENCHMARKS"] = False + tc.cache_variables["FXDIV_SOURCE_DIR"] = "dummy" # this value doesn't really matter, it's just to avoid a download + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}", "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["PTHREADPOOL_LIBRARY_TYPE"] = "default" - self._cmake.definitions["PTHREADPOOL_ALLOW_DEPRECATED_API"] = True - self._cmake.definitions["PTHREADPOOL_SYNC_PRIMITIVE"] = self.options.sync_primitive - self._cmake.definitions["PTHREADPOOL_BUILD_TESTS"] = False - self._cmake.definitions["PTHREADPOOL_BUILD_BENCHMARKS"] = False - self._cmake.definitions["FXDIV_SOURCE_DIR"] = "dummy" # this value doesn't really matter, it's just to avoid a download - self._cmake.configure() - return self._cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["pthreadpool"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/pthreadpool/all/test_package/CMakeLists.txt b/recipes/pthreadpool/all/test_package/CMakeLists.txt index fd126a732c403b..722ec454f1c798 100644 --- a/recipes/pthreadpool/all/test_package/CMakeLists.txt +++ b/recipes/pthreadpool/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pthreadpool REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE pthreadpool::pthreadpool) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/pthreadpool/all/test_package/conanfile.py b/recipes/pthreadpool/all/test_package/conanfile.py index 5216332f39f5ca..0a6bc68712d901 100644 --- a/recipes/pthreadpool/all/test_package/conanfile.py +++ b/recipes/pthreadpool/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt b/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..c45c97cc93d2c2 --- /dev/null +++ b/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(pthreadpool REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE pthreadpool::pthreadpool) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/pthreadpool/all/test_v1_package/conanfile.py b/recipes/pthreadpool/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/pthreadpool/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From de8f302c7aea768ac9d5128dd61b74131c082997 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 06:45:15 +0200 Subject: [PATCH 142/300] (#13665) libgeotiff: conan v2 support * conan v2 support * fix cmake_minimum_required position --- recipes/libgeotiff/all/CMakeLists.txt | 7 -- recipes/libgeotiff/all/conandata.yml | 4 - recipes/libgeotiff/all/conanfile.py | 110 ++++++++---------- .../all/patches/fix-cmake-1.5.1.patch | 11 +- .../all/patches/fix-cmake-1.6.0.patch | 11 +- .../all/patches/fix-cmake-1.7.1.patch | 16 +++ .../all/test_package/CMakeLists.txt | 7 +- .../libgeotiff/all/test_package/conanfile.py | 19 ++- .../all/test_v1_package/CMakeLists.txt | 10 ++ .../all/test_v1_package/conanfile.py | 17 +++ 10 files changed, 128 insertions(+), 84 deletions(-) delete mode 100644 recipes/libgeotiff/all/CMakeLists.txt create mode 100644 recipes/libgeotiff/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libgeotiff/all/test_v1_package/conanfile.py diff --git a/recipes/libgeotiff/all/CMakeLists.txt b/recipes/libgeotiff/all/CMakeLists.txt deleted file mode 100644 index 7c172c37ee83f6..00000000000000 --- a/recipes/libgeotiff/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory("source_subfolder/libgeotiff") diff --git a/recipes/libgeotiff/all/conandata.yml b/recipes/libgeotiff/all/conandata.yml index 90701559cd6ebf..7f1d9af2732084 100644 --- a/recipes/libgeotiff/all/conandata.yml +++ b/recipes/libgeotiff/all/conandata.yml @@ -14,13 +14,9 @@ sources: patches: "1.7.1": - patch_file: "patches/fix-cmake-1.7.1.patch" - base_path: "source_subfolder" "1.7.0": - patch_file: "patches/fix-cmake-1.6.0.patch" - base_path: "source_subfolder" "1.6.0": - patch_file: "patches/fix-cmake-1.6.0.patch" - base_path: "source_subfolder" "1.5.1": - patch_file: "patches/fix-cmake-1.5.1.patch" - base_path: "source_subfolder" diff --git a/recipes/libgeotiff/all/conanfile.py b/recipes/libgeotiff/all/conanfile.py index 4aa86a357d19fd..cfb2f00d55368f 100644 --- a/recipes/libgeotiff/all/conanfile.py +++ b/recipes/libgeotiff/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class LibgeotiffConan(ConanFile): @@ -10,7 +12,7 @@ class LibgeotiffConan(ConanFile): description = "Libgeotiff is an open source library normally hosted on top " \ "of libtiff for reading, and writing GeoTIFF information tags." license = ["MIT", "BSD-3-Clause"] - topics = ("libgeotiff", "geotiff", "tiff") + topics = ("geotiff", "tiff") homepage = "https://github.com/OSGeo/libgeotiff" url = "https://github.com/conan-io/conan-center-index" @@ -24,21 +26,8 @@ class LibgeotiffConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -46,40 +35,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libtiff/4.3.0") - self.requires("proj/9.0.0") + self.requires("libtiff/4.4.0") + self.requires("proj/9.0.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_UTILITIES"] = False + tc.variables["WITH_TOWGS84"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "libgeotiff")) cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["WITH_UTILITIES"] = False - self._cmake.definitions["WITH_TOWGS84"] = True - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("LICENSE", dst="licenses", src=os.path.join(self._source_subfolder, "libgeotiff")) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=os.path.join(self.source_folder, "libgeotiff"), dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "doc")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "doc")) + rmdir(self, os.path.join(self.package_folder, "share")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_vars_file) ) @@ -88,12 +88,9 @@ def package(self): {"geotiff_library": "geotiff::geotiff"} ) - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ - if(DEFINED GeoTIFF_FOUND) - set(GEOTIFF_FOUND ${GeoTIFF_FOUND}) - endif() + set(GEOTIFF_FOUND ${GeoTIFF_FOUND}) if(DEFINED GeoTIFF_INCLUDE_DIR) set(GEOTIFF_INCLUDE_DIR ${GeoTIFF_INCLUDE_DIR}) endif() @@ -101,31 +98,26 @@ def _create_cmake_module_variables(module_file): set(GEOTIFF_LIBRARIES ${GeoTIFF_LIBRARIES}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) - - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") + """) + save(self, module_file, content) @property def _module_vars_file(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") @property def _module_target_file(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -139,6 +131,6 @@ def package_info(self): self.cpp_info.build_modules["cmake_find_package"] = [self._module_vars_file] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_target_file] - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/libgeotiff/all/patches/fix-cmake-1.5.1.patch b/recipes/libgeotiff/all/patches/fix-cmake-1.5.1.patch index 5d2a8ea72f1899..8caed57981342a 100644 --- a/recipes/libgeotiff/all/patches/fix-cmake-1.5.1.patch +++ b/recipes/libgeotiff/all/patches/fix-cmake-1.5.1.patch @@ -1,11 +1,18 @@ --- a/libgeotiff/CMakeLists.txt +++ b/libgeotiff/CMakeLists.txt -@@ -12,7 +12,7 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) +@@ -5,6 +5,7 @@ + # Author: Mateusz Loskot + # + ############################################################################### ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + PROJECT(GeoTIFF) + + SET(GEOTIFF_LIB_NAME geotiff) +@@ -12,7 +13,6 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) ############################################################################## # CMake settings -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) -+CMAKE_MINIMUM_REQUIRED(VERSION 3.1) SET(CMAKE_COLOR_MAKEFILE ON) diff --git a/recipes/libgeotiff/all/patches/fix-cmake-1.6.0.patch b/recipes/libgeotiff/all/patches/fix-cmake-1.6.0.patch index a092afa4a9f9b8..7558274a780999 100644 --- a/recipes/libgeotiff/all/patches/fix-cmake-1.6.0.patch +++ b/recipes/libgeotiff/all/patches/fix-cmake-1.6.0.patch @@ -1,11 +1,18 @@ --- a/libgeotiff/CMakeLists.txt +++ b/libgeotiff/CMakeLists.txt -@@ -12,7 +12,7 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) +@@ -5,6 +5,7 @@ + # Author: Mateusz Loskot + # + ############################################################################### ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + PROJECT(GeoTIFF) + + SET(GEOTIFF_LIB_NAME geotiff) +@@ -12,7 +13,6 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) ############################################################################## # CMake settings -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) -+CMAKE_MINIMUM_REQUIRED(VERSION 3.1) SET(CMAKE_COLOR_MAKEFILE ON) diff --git a/recipes/libgeotiff/all/patches/fix-cmake-1.7.1.patch b/recipes/libgeotiff/all/patches/fix-cmake-1.7.1.patch index 14eb43b8c9d7da..7f0663e5d71982 100644 --- a/recipes/libgeotiff/all/patches/fix-cmake-1.7.1.patch +++ b/recipes/libgeotiff/all/patches/fix-cmake-1.7.1.patch @@ -1,5 +1,21 @@ --- a/libgeotiff/CMakeLists.txt +++ b/libgeotiff/CMakeLists.txt +@@ -5,6 +5,7 @@ + # Author: Mateusz Loskot + # + ############################################################################### ++CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) + PROJECT(GeoTIFF) + + SET(GEOTIFF_LIB_NAME geotiff) +@@ -12,7 +13,6 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) + + ############################################################################## + # CMake settings +-CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) + + SET(CMAKE_COLOR_MAKEFILE ON) + @@ -88,7 +88,7 @@ IF(WIN32) ENDIF() diff --git a/recipes/libgeotiff/all/test_package/CMakeLists.txt b/recipes/libgeotiff/all/test_package/CMakeLists.txt index 111200b74c1063..6f7f6667348cbd 100644 --- a/recipes/libgeotiff/all/test_package/CMakeLists.txt +++ b/recipes/libgeotiff/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(geotiff REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} geotiff_library) +target_link_libraries(${PROJECT_NAME} PRIVATE geotiff_library) diff --git a/recipes/libgeotiff/all/test_package/conanfile.py b/recipes/libgeotiff/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/libgeotiff/all/test_package/conanfile.py +++ b/recipes/libgeotiff/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libgeotiff/all/test_v1_package/CMakeLists.txt b/recipes/libgeotiff/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..b4636735c7425e --- /dev/null +++ b/recipes/libgeotiff/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(geotiff REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE geotiff_library) diff --git a/recipes/libgeotiff/all/test_v1_package/conanfile.py b/recipes/libgeotiff/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libgeotiff/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 5f332469cb36639c0749c688d267ae8eb474b56d Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 07:05:30 +0200 Subject: [PATCH 143/300] (#13681) taywee-args: conan v2 support * conan v2 support * fix sha256 of 6.2.4 tarball --- recipes/taywee-args/all/conandata.yml | 2 +- recipes/taywee-args/all/conanfile.py | 49 +++++++++++++------ .../all/test_package/CMakeLists.txt | 11 ++--- .../taywee-args/all/test_package/conanfile.py | 21 +++++--- .../all/test_v1_package/CMakeLists.txt | 8 +++ .../all/test_v1_package/conanfile.py | 17 +++++++ 6 files changed, 78 insertions(+), 30 deletions(-) create mode 100644 recipes/taywee-args/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/taywee-args/all/test_v1_package/conanfile.py diff --git a/recipes/taywee-args/all/conandata.yml b/recipes/taywee-args/all/conandata.yml index ba4000570e3507..c8417718014378 100644 --- a/recipes/taywee-args/all/conandata.yml +++ b/recipes/taywee-args/all/conandata.yml @@ -16,7 +16,7 @@ sources: sha256: "59ed8944c2ff0346e95a2fae55212137512559203b54fc4facbc99206a250500" "6.2.4": url: "https://github.com/Taywee/args/archive/6.2.4.tar.gz" - sha256: "dcc6d0d6b941eb40eeeb5741917d557944f3880e0dea9096147d0bdd89c34654" + sha256: "308eb09a9656315b38c2d1f7526b22b42695b352da316fa4ac17a8b86cdd4663" "6.2.3": url: "https://github.com/Taywee/args/archive/6.2.3.tar.gz" sha256: "c202d15fc4b30519a08bae7df9e6f4fdc40ac2434ba65d83a108ebbf6e4822c2" diff --git a/recipes/taywee-args/all/conanfile.py b/recipes/taywee-args/all/conanfile.py index 6fd83b975144b5..35764248328699 100644 --- a/recipes/taywee-args/all/conanfile.py +++ b/recipes/taywee-args/all/conanfile.py @@ -1,41 +1,58 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.28.0" +required_conan_version = ">=1.50.0" + class TayweeArgsConan(ConanFile): name = "taywee-args" description = "A simple, small, flexible, single-header C++11 argument parsing library" - topics = ("conan", "taywee-args", "args", "argument-parser", "header-only") + topics = ("args", "argument-parser", "header-only") license = "MIT" homepage = "https://github.com/Taywee/args" url = "https://github.com/conan-io/conan-center-index" - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("args-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("args.hxx", dst="include", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "args.hxx", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "args") + self.cpp_info.set_property("cmake_target_name", "taywee::args") + self.cpp_info.set_property("pkg_config_name", "args") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 self.cpp_info.filenames["cmake_find_package"] = "args" self.cpp_info.filenames["cmake_find_package_multi"] = "args" self.cpp_info.names["cmake_find_package"] = "taywee" self.cpp_info.names["cmake_find_package_multi"] = "taywee" self.cpp_info.components["libargs"].names["cmake_find_package"] = "args" self.cpp_info.components["libargs"].names["cmake_find_package_multi"] = "args" + self.cpp_info.components["libargs"].set_property("cmake_target_name", "taywee::args") + self.cpp_info.components["libargs"].set_property("pkg_config_name", "args") + self.cpp_info.components["libargs"].bindirs = [] + self.cpp_info.components["libargs"].libdirs = [] diff --git a/recipes/taywee-args/all/test_package/CMakeLists.txt b/recipes/taywee-args/all/test_package/CMakeLists.txt index 361c2ecf058295..0a8e53f1264f3f 100644 --- a/recipes/taywee-args/all/test_package/CMakeLists.txt +++ b/recipes/taywee-args/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(args REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} taywee::args) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE taywee::args) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/taywee-args/all/test_package/conanfile.py b/recipes/taywee-args/all/test_package/conanfile.py index 1907eb809df0db..44f49e453b57c8 100644 --- a/recipes/taywee-args/all/test_package/conanfile.py +++ b/recipes/taywee-args/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run("{} -h".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{bin_path} -h", env="conanrun") diff --git a/recipes/taywee-args/all/test_v1_package/CMakeLists.txt b/recipes/taywee-args/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/taywee-args/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/taywee-args/all/test_v1_package/conanfile.py b/recipes/taywee-args/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..3e9c09d77df0cc --- /dev/null +++ b/recipes/taywee-args/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(f"{bin_path} -h", run_environment=True) From e9c970df89a856f5495fc3571d41145b852b0cc8 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 07:26:34 +0200 Subject: [PATCH 144/300] (#13683) reckless: conan v2 support --- recipes/reckless/all/CMakeLists.txt | 7 -- recipes/reckless/all/conandata.yml | 1 - recipes/reckless/all/conanfile.py | 75 ++++++++++--------- .../reckless/all/test_package/CMakeLists.txt | 7 +- .../reckless/all/test_package/conanfile.py | 19 +++-- .../all/test_v1_package/CMakeLists.txt | 8 ++ .../reckless/all/test_v1_package/conanfile.py | 17 +++++ 7 files changed, 80 insertions(+), 54 deletions(-) delete mode 100644 recipes/reckless/all/CMakeLists.txt create mode 100644 recipes/reckless/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/reckless/all/test_v1_package/conanfile.py diff --git a/recipes/reckless/all/CMakeLists.txt b/recipes/reckless/all/CMakeLists.txt deleted file mode 100644 index 3db0dfa8d74423..00000000000000 --- a/recipes/reckless/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/reckless/all/conandata.yml b/recipes/reckless/all/conandata.yml index 04a7a6a7709cea..665e1d59c75b68 100644 --- a/recipes/reckless/all/conandata.yml +++ b/recipes/reckless/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "3.0.3": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/reckless/all/conanfile.py b/recipes/reckless/all/conanfile.py index 95a93710397472..a52137d87d9c74 100644 --- a/recipes/reckless/all/conanfile.py +++ b/recipes/reckless/all/conanfile.py @@ -1,14 +1,19 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class RecklessConan(ConanFile): name = "reckless" description = "Reckless is an extremely low-latency, high-throughput logging library." license = "MIT" - topics = ("reckless", "logging") + topics = ("logging") homepage = "https://github.com/mattiasflodin/reckless" url = "https://github.com/conan-io/conan-center-index" @@ -22,13 +27,8 @@ class RecklessConan(ConanFile): "fPIC": True, } - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -36,41 +36,44 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self.settings.os not in ["Windows", "Linux"]: - raise ConanInvalidConfiguration("reckless only supports Windows and Linux") - if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio": - raise ConanInvalidConfiguration("reckless only supports Visual Studio on Windows") - if self.settings.compiler == "Visual Studio" and self.options.shared: - raise ConanInvalidConfiguration("reckless shared not supported by Visual Studio") - if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": - raise ConanInvalidConfiguration("reckless doesn't support clang with libc++") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.info.settings.os not in ["Windows", "Linux"]: + raise ConanInvalidConfiguration(f"{self.ref} only supports Windows and Linux") + if self.info.settings.os == "Windows" and not is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} only supports Visual Studio on Windows") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") + if self.info.settings.compiler == "clang" and self.info.settings.compiler.get_safe("libcxx") == "libc++": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang with libc++") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["RECKLESS_BUILD_EXAMPLES"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RECKLESS_BUILD_EXAMPLES"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/reckless/all/test_package/CMakeLists.txt b/recipes/reckless/all/test_package/CMakeLists.txt index 55a397656bcd0c..7923780072c36e 100644 --- a/recipes/reckless/all/test_package/CMakeLists.txt +++ b/recipes/reckless/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(reckless REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} reckless::reckless) +target_link_libraries(${PROJECT_NAME} PRIVATE reckless::reckless) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/reckless/all/test_package/conanfile.py b/recipes/reckless/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/reckless/all/test_package/conanfile.py +++ b/recipes/reckless/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/reckless/all/test_v1_package/CMakeLists.txt b/recipes/reckless/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/reckless/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/reckless/all/test_v1_package/conanfile.py b/recipes/reckless/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/reckless/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From ff1e678e276fae219e69bdc334cde435dd736ae5 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 24 Oct 2022 14:44:46 +0900 Subject: [PATCH 145/300] (#13685) daw_utf_range: update dependencies and support conan v2 --- recipes/daw_utf_range/all/conanfile.py | 95 +++++++++++-------- .../all/test_package/CMakeLists.txt | 9 +- .../all/test_package/conanfile.py | 22 +++-- .../all/test_v1_package/CMakeLists.txt | 11 +++ .../all/test_v1_package/conanfile.py | 16 ++++ 5 files changed, 102 insertions(+), 51 deletions(-) create mode 100644 recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/daw_utf_range/all/test_v1_package/conanfile.py diff --git a/recipes/daw_utf_range/all/conanfile.py b/recipes/daw_utf_range/all/conanfile.py index c477b5e71f23a9..d9974b561af310 100644 --- a/recipes/daw_utf_range/all/conanfile.py +++ b/recipes/daw_utf_range/all/conanfile.py @@ -1,9 +1,14 @@ -import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conans.errors import ConanInvalidConfiguration -from conans import ConanFile, CMake, tools +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class DawUtfRangeConan(ConanFile): name = "daw_utf_range" @@ -13,62 +18,74 @@ class DawUtfRangeConan(ConanFile): homepage = "https://github.com/beached/utf_range/" topics = ("utf", "validator", "iterator") settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi", "cmake_find_package" no_copy_source = True - _compiler_required_cpp17 = { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } + @property + def _minimum_cpp_standard(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("daw_header_libraries/2.72.0") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def requirements(self): - self.requires("daw_header_libraries/2.68.1") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DAW_USE_PACKAGE_MANAGEMENT"] = True + tc.generate() - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + deps = CMakeDeps(self) + deps.generate() - def _configure_cmake(self): + def build(self): cmake = CMake(self) - cmake.definitions["DAW_USE_PACKAGE_MANAGEMENT"] = True - cmake.configure(source_folder=self._source_subfolder) - return cmake + cmake.configure() def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] - def package_id(self): - self.info.header_only() + self.cpp_info.set_property("cmake_file_name", "daw-utf-range") + self.cpp_info.set_property("cmake_target_name", "daw::daw-utf-range") + self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-utf-range") + self.cpp_info.components["daw"].requires = ["daw_header_libraries::daw"] - def package_info(self): + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "daw-utf-range" self.cpp_info.filenames["cmake_find_package_multi"] = "daw-utf-range" - self.cpp_info.set_property("cmake_file_name", "daw-utf-range") self.cpp_info.names["cmake_find_package"] = "daw" self.cpp_info.names["cmake_find_package_multi"] = "daw" - self.cpp_info.set_property("cmake_target_name", "daw::daw-utf-range") self.cpp_info.components["daw"].names["cmake_find_package"] = "daw-utf-range" self.cpp_info.components["daw"].names["cmake_find_package_multi"] = "daw-utf-range" - self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-utf-range") - self.cpp_info.components["daw"].requires = ["daw_header_libraries::daw"] diff --git a/recipes/daw_utf_range/all/test_package/CMakeLists.txt b/recipes/daw_utf_range/all/test_package/CMakeLists.txt index 93ca38b7d3fb47..423476843bbe46 100644 --- a/recipes/daw_utf_range/all/test_package/CMakeLists.txt +++ b/recipes/daw_utf_range/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(daw-utf-range CONFIG REQUIRED) +find_package(daw-utf-range REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} daw::daw-utf-range) +target_link_libraries(${PROJECT_NAME} PRIVATE daw::daw-utf-range) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/daw_utf_range/all/test_package/conanfile.py b/recipes/daw_utf_range/all/test_package/conanfile.py index e4d87337901920..a9fb96656f2039 100644 --- a/recipes/daw_utf_range/all/test_package/conanfile.py +++ b/recipes/daw_utf_range/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class DawUtfRangeTestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt b/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..ab1c8bbe0a5e15 --- /dev/null +++ b/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(daw-utf-range REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE daw::daw-utf-range) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/daw_utf_range/all/test_v1_package/conanfile.py b/recipes/daw_utf_range/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..e4d87337901920 --- /dev/null +++ b/recipes/daw_utf_range/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class DawUtfRangeTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 78bcc7eb2622bf808eeed909ea26a4ed105a2ac8 Mon Sep 17 00:00:00 2001 From: Martin Delille Date: Mon, 24 Oct 2022 08:05:15 +0200 Subject: [PATCH 146/300] (#13690) [doc] Fix tools_requires => tool_requires --- docs/package_templates/autotools_package/all/conanfile.py | 2 +- .../prebuilt_tool_package/all/test_package/conanfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/package_templates/autotools_package/all/conanfile.py b/docs/package_templates/autotools_package/all/conanfile.py index 31cbae159751fe..2d54c220a5dd79 100644 --- a/docs/package_templates/autotools_package/all/conanfile.py +++ b/docs/package_templates/autotools_package/all/conanfile.py @@ -110,7 +110,7 @@ def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): - # inject tools_requires env vars in build scope (not needed if there is no tool_requires) + # inject tool_requires env vars in build scope (not needed if there is no tool_requires) env = VirtualBuildEnv(self) env.generate() # inject requires env vars in build scope diff --git a/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py index 74e84fd25127ad..8fc041e355c5bf 100644 --- a/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py +++ b/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py @@ -9,7 +9,7 @@ class TestPackageConan(ConanFile): test_type = "explicit" def build_requirements(self): - self.tools_requires(self.tested_reference_str) + self.tool_requires(self.tested_reference_str) def test(self): if can_run(self): From 31a494fe3a472ad49b4fc6bbecb4025eb88a951d Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Mon, 24 Oct 2022 08:25:05 +0200 Subject: [PATCH 147/300] (#13699) libmicrohttpd: fix 32-bit MSVC build * libmicrohttpd: fix 32-bit MSVC build * Use variables for MSVC output dir --- recipes/libmicrohttpd/all/conandata.yml | 3 +++ recipes/libmicrohttpd/all/conanfile.py | 14 ++++++++++---- ....75-0002-allow-release-with-debug-runtime.patch | 12 ++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch diff --git a/recipes/libmicrohttpd/all/conandata.yml b/recipes/libmicrohttpd/all/conandata.yml index baf8560b8d3f1c..0276eb4f1e40eb 100644 --- a/recipes/libmicrohttpd/all/conandata.yml +++ b/recipes/libmicrohttpd/all/conandata.yml @@ -7,3 +7,6 @@ patches: - patch_file: "patches/0.9.75-0001-msbuild-RuntimeLibrary.patch" patch_description: "Remove RuntimeLibrary from vcxproject + use conantoolchain.props" patch_type: "conan" + - patch_file: "patches/0.9.75-0002-allow-release-with-debug-runtime.patch" + patch_description: "Remove RuntimeLibrary from vcxproject + use conantoolchain.props" + patch_type: "conan" diff --git a/recipes/libmicrohttpd/all/conanfile.py b/recipes/libmicrohttpd/all/conanfile.py index 8c7a9d8fa18cba..1811e1503e36c7 100644 --- a/recipes/libmicrohttpd/all/conanfile.py +++ b/recipes/libmicrohttpd/all/conanfile.py @@ -148,7 +148,7 @@ def _msvc_sln_folder(self): return os.path.join("w32", subdir) @property - def _msvc_arch(self): + def _msvc_platform(self): return { "x86": "Win32", "x86_64": "x64", @@ -162,6 +162,7 @@ def build(self): if is_msvc(self): msbuild = MSBuild(self) msbuild.build_type = self._msvc_configuration + msbuild.platform = self._msvc_platform msbuild.build(sln=os.path.join(self._msvc_sln_folder, "libmicrohttpd.sln"), targets=["libmicrohttpd"]) else: autotools = Autotools(self) @@ -171,9 +172,14 @@ def build(self): def package(self): copy(self, "COPYING", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) if is_msvc(self): - copy(self, "*.lib", os.path.join(self.build_folder, self._msvc_sln_folder, "Output", self._msvc_arch), os.path.join(self.package_folder, "lib")) - copy(self, "*.dll", os.path.join(self.build_folder, self._msvc_sln_folder, "Output", self._msvc_arch), os.path.join(self.package_folder, "bin")) - copy(self, "*.h", os.path.join(self.build_folder, self._msvc_sln_folder, "Output", self._msvc_arch), os.path.join(self.package_folder, "include")) + # 32-bit (x86) libraries are stored in the root + output_dir = os.path.join(self.build_folder, self._msvc_sln_folder, "Output") + if self.settings.arch in ("x86_64", ): + # 64-bit (x64) libraries are stored in a subfolder + output_dir = os.path.join(output_dir, self._msvc_platform) + copy(self, "*.lib", output_dir, os.path.join(self.package_folder, "lib")) + copy(self, "*.dll", output_dir, os.path.join(self.package_folder, "bin")) + copy(self, "*.h", output_dir, os.path.join(self.package_folder, "include")) else: autotools = Autotools(self) autotools.install() diff --git a/recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch b/recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch new file mode 100644 index 00000000000000..c833862d3cee1e --- /dev/null +++ b/recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch @@ -0,0 +1,12 @@ +This patch allows building libmicrohttpd in Release configuration with a debug runtime (e.g. MTd) +--- src/microhttpd/mhd_assert.h ++++ src/microhttpd/mhd_assert.h +@@ -35,7 +35,7 @@ + #define NDEBUG 1 /* Use NDEBUG by default */ + #endif /* !_DEBUG && !NDEBUG */ + #if defined(_DEBUG) && defined(NDEBUG) +-#error Both _DEBUG and NDEBUG are defined ++//#error Both _DEBUG and NDEBUG are defined + #endif /* _DEBUG && NDEBUG */ + #ifdef NDEBUG + # define mhd_assert(ignore) ((void) 0) From e0c5e17051d5eb1581b041279b69529522fa108c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ferdinand=20Rivera=20Morell?= Date: Mon, 24 Oct 2022 01:45:51 -0500 Subject: [PATCH 148/300] (#13712) B2 version 4.9.3 --- recipes/b2/config.yml | 2 ++ recipes/b2/portable/conandata.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/recipes/b2/config.yml b/recipes/b2/config.yml index 2f1e9f4a5aa34d..72ab4de1e5c670 100644 --- a/recipes/b2/config.yml +++ b/recipes/b2/config.yml @@ -39,3 +39,5 @@ versions: folder: portable "4.9.2": folder: portable + "4.9.3": + folder: portable diff --git a/recipes/b2/portable/conandata.yml b/recipes/b2/portable/conandata.yml index 47fa26513a3744..0ce27c0e93f9c0 100644 --- a/recipes/b2/portable/conandata.yml +++ b/recipes/b2/portable/conandata.yml @@ -47,3 +47,6 @@ sources: "4.9.2": url: "https://github.com/bfgroup/b2/archive/4.9.2.tar.gz" sha256: "7e1a135b308999d2a65fce3eba8f4ffb41ca82ae133f8494cc42cbca63c890de" + "4.9.3": + url: "https://github.com/bfgroup/b2/archive/4.9.3.tar.gz" + sha256: "4524b8ecf138a9087aa24b8889c44ea7ae9f2d373acc9535d72fb048c213e1b9" From 0940c6ba30554d24c1f33db742cd5b8a3914abec Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 12:05:08 +0200 Subject: [PATCH 149/300] (#13669) mapbox-geometry: conan v2 support --- recipes/mapbox-geometry/all/conanfile.py | 33 ++++++++++++------- .../all/test_package/CMakeLists.txt | 7 ++-- .../all/test_package/conanfile.py | 19 ++++++++--- .../all/test_v1_package/CMakeLists.txt | 11 +++++++ .../all/test_v1_package/conanfile.py | 17 ++++++++++ 5 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/mapbox-geometry/all/test_v1_package/conanfile.py diff --git a/recipes/mapbox-geometry/all/conanfile.py b/recipes/mapbox-geometry/all/conanfile.py index 670f3a943e8f7c..9edf42d2b8db16 100644 --- a/recipes/mapbox-geometry/all/conanfile.py +++ b/recipes/mapbox-geometry/all/conanfile.py @@ -1,6 +1,11 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.52.0" + class MapboxGeometryConan(ConanFile): name = "mapbox-geometry" @@ -15,24 +20,30 @@ class MapboxGeometryConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("mapbox-variant/1.2.0") + self.requires("mapbox-variant/1.2.0", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/mapbox-geometry/all/test_package/CMakeLists.txt b/recipes/mapbox-geometry/all/test_package/CMakeLists.txt index 227f67e30f443f..9bad4b5d604714 100644 --- a/recipes/mapbox-geometry/all/test_package/CMakeLists.txt +++ b/recipes/mapbox-geometry/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(mapbox-geometry REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} mapbox-geometry::mapbox-geometry) +target_link_libraries(${PROJECT_NAME} PRIVATE mapbox-geometry::mapbox-geometry) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/mapbox-geometry/all/test_package/conanfile.py b/recipes/mapbox-geometry/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/mapbox-geometry/all/test_package/conanfile.py +++ b/recipes/mapbox-geometry/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt b/recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..e4046b86f92324 --- /dev/null +++ b/recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(mapbox-geometry REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mapbox-geometry::mapbox-geometry) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/mapbox-geometry/all/test_v1_package/conanfile.py b/recipes/mapbox-geometry/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/mapbox-geometry/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 4d82f156a786be9d96a709bee2c5d85e459b6b46 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 12:24:34 +0200 Subject: [PATCH 150/300] (#13670) polylabel: conan v2 support --- recipes/polylabel/all/conanfile.py | 33 ++++++++++++------- .../polylabel/all/test_package/CMakeLists.txt | 7 ++-- .../polylabel/all/test_package/conanfile.py | 19 ++++++++--- .../all/test_v1_package/CMakeLists.txt | 11 +++++++ .../all/test_v1_package/conanfile.py | 17 ++++++++++ 5 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 recipes/polylabel/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/polylabel/all/test_v1_package/conanfile.py diff --git a/recipes/polylabel/all/conanfile.py b/recipes/polylabel/all/conanfile.py index 8f59111f5d9449..402d5fbafc2193 100644 --- a/recipes/polylabel/all/conanfile.py +++ b/recipes/polylabel/all/conanfile.py @@ -1,6 +1,11 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.52.0" + class PolylabelConan(ConanFile): name = "polylabel" @@ -12,24 +17,30 @@ class PolylabelConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("mapbox-geometry/2.0.3") + self.requires("mapbox-geometry/2.0.3", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/polylabel/all/test_package/CMakeLists.txt b/recipes/polylabel/all/test_package/CMakeLists.txt index a9d16d1f288183..90669593bc3f0e 100644 --- a/recipes/polylabel/all/test_package/CMakeLists.txt +++ b/recipes/polylabel/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(polylabel REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} polylabel::polylabel) +target_link_libraries(${PROJECT_NAME} PRIVATE polylabel::polylabel) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/polylabel/all/test_package/conanfile.py b/recipes/polylabel/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/polylabel/all/test_package/conanfile.py +++ b/recipes/polylabel/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/polylabel/all/test_v1_package/CMakeLists.txt b/recipes/polylabel/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0c0d215f97b422 --- /dev/null +++ b/recipes/polylabel/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(polylabel REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE polylabel::polylabel) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/polylabel/all/test_v1_package/conanfile.py b/recipes/polylabel/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/polylabel/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From a06a27b9fe6633454481c32477448cbd8ee4daa2 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 24 Oct 2022 19:44:57 +0900 Subject: [PATCH 151/300] (#13585) screen_capture_lite: add recipe * screen_capture_lite: add recipe * apply patch * remove unused modules * fix wrong recipe folder name * cast bool * downgrade cmake minimum required * drop support clang with libstdc++ * try to fix error C2039 * link d3dll, dxgi on Windows * delete invalid unescaped character * fix typo * specify CMAKE_SYSTEM_VERSION on Windodws * remove pdb files * link AppKit, ImageIO, Foundation * remove importing is_msvc and VirtualBuildEnv Co-authored-by: Uilian Ries * remove BUILD_SHARED_LIBS from upstream CMakeLists.txt Co-authored-by: Uilian Ries --- recipes/screen_capture_lite/all/conandata.yml | 10 ++ recipes/screen_capture_lite/all/conanfile.py | 133 ++++++++++++++++++ .../all/patches/0001-fix-cmake.patch | 69 +++++++++ .../all/test_package/CMakeLists.txt | 8 ++ .../all/test_package/conanfile.py | 26 ++++ .../all/test_package/test_package.cpp | 8 ++ .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 19 +++ recipes/screen_capture_lite/config.yml | 3 + 9 files changed, 287 insertions(+) create mode 100644 recipes/screen_capture_lite/all/conandata.yml create mode 100644 recipes/screen_capture_lite/all/conanfile.py create mode 100644 recipes/screen_capture_lite/all/patches/0001-fix-cmake.patch create mode 100644 recipes/screen_capture_lite/all/test_package/CMakeLists.txt create mode 100644 recipes/screen_capture_lite/all/test_package/conanfile.py create mode 100644 recipes/screen_capture_lite/all/test_package/test_package.cpp create mode 100644 recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/screen_capture_lite/all/test_v1_package/conanfile.py create mode 100644 recipes/screen_capture_lite/config.yml diff --git a/recipes/screen_capture_lite/all/conandata.yml b/recipes/screen_capture_lite/all/conandata.yml new file mode 100644 index 00000000000000..11498201fa1c06 --- /dev/null +++ b/recipes/screen_capture_lite/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "17.1.439": + url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.439.tar.gz" + sha256: "c6e6eead72114dc7ba9f3fb17eeff01b4b53bb3ad3b71a55ebe08b61bbff9dea" + +patches: + "17.1.439": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "specify build library static or shared" + patch_type: "conan" diff --git a/recipes/screen_capture_lite/all/conanfile.py b/recipes/screen_capture_lite/all/conanfile.py new file mode 100644 index 00000000000000..0f956a1a56b89a --- /dev/null +++ b/recipes/screen_capture_lite/all/conanfile.py @@ -0,0 +1,133 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.52.0" + +class ScreenCaptureLiteConan(ConanFile): + name = "screen_capture_lite" + license = "MIT" + description = "cross platform screen/window capturing library " + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/smasherprog/screen_capture_lite" + topics = ("screen-capture", "screen-ercorder") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _minimum_cpp_standard(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "10", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.requires("xorg/system") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + + if self.info.settings.compiler == "clang" and self.info.settings.compiler.get_safe("libcxx") == "libstdc++": + raise ConanInvalidConfiguration(f"{self.ref} does not support clang with libstdc++") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_EXAMPLE"] = False + if is_msvc(self): + # fix "error C2039: 'CheckForDuplicateEntries': is not a member of 'Microsoft::WRL::Details'" + tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0.18362.0" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.libs = ["screen_capture_lite_shared" if self.options.shared else "screen_capture_lite_static"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") + self.cpp_info.requires.extend([ + "xorg::x11", + "xorg::xinerama", + "xorg::xext", + "xorg::xfixes", + ]) + elif self.settings.os == "Windows": + self.cpp_info.system_libs.extend([ + "dwmapi", + "d3d11", + "dxgi", + ]) + elif self.settings.os == "Macos": + self.cpp_info.frameworks.extend([ + "AppKit", + "AVFoundation", + "Carbon", + "Cocoa", + "CoreFoundation", + "CoreGraphics", + "CoreMedia", + "CoreVideo", + "Foundation", + "ImageIO", + ]) diff --git a/recipes/screen_capture_lite/all/patches/0001-fix-cmake.patch b/recipes/screen_capture_lite/all/patches/0001-fix-cmake.patch new file mode 100644 index 00000000000000..af4ad9b62d58b0 --- /dev/null +++ b/recipes/screen_capture_lite/all/patches/0001-fix-cmake.patch @@ -0,0 +1,69 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d646b23..23742b8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,11 +1,10 @@ +-cmake_minimum_required(VERSION 3.20) ++cmake_minimum_required(VERSION 3.12) + project(screen_capture_lite_build) + + set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + option(BUILD_EXAMPLE "Build example" ON) +-set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build shared libraries") + set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + +@@ -22,13 +21,20 @@ else() + endif() + + add_subdirectory(src_cpp) +-add_subdirectory(src_csharp) + +-install (TARGETS screen_capture_lite_static screen_capture_lite_shared +- RUNTIME DESTINATION bin +- ARCHIVE DESTINATION lib +- LIBRARY DESTINATION lib +-) ++if(BUILD_SHARED_LIBS) ++ install (TARGETS screen_capture_lite_shared ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++else() ++ install (TARGETS screen_capture_lite_static ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() + + install (FILES + include/ScreenCapture.h +diff --git a/src_cpp/CMakeLists.txt b/src_cpp/CMakeLists.txt +index bc59c0b..1c4a1b4 100644 +--- a/src_cpp/CMakeLists.txt ++++ b/src_cpp/CMakeLists.txt +@@ -75,10 +75,12 @@ set(libsrc + ThreadManager.cpp + ${SCREEN_CAPTURE_PLATFORM_SRC} + ) +- ++ ++if(NOT BUILD_SHARED_LIBS) + message("Building STATIC Library") + add_library(${PROJECT_NAME}_static STATIC ${libsrc}) + ++else() + message("Building SHARED Library") + + add_library(${PROJECT_NAME}_shared SHARED ${libsrc}) +@@ -124,4 +126,4 @@ add_library(${PROJECT_NAME}_static STATIC ${libsrc}) + ${CMAKE_THREAD_LIBS_INIT} + ) + endif() +- +\ No newline at end of file ++endif() diff --git a/recipes/screen_capture_lite/all/test_package/CMakeLists.txt b/recipes/screen_capture_lite/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..920e6c9d227644 --- /dev/null +++ b/recipes/screen_capture_lite/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(screen_capture_lite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE screen_capture_lite::screen_capture_lite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/screen_capture_lite/all/test_package/conanfile.py b/recipes/screen_capture_lite/all/test_package/conanfile.py new file mode 100644 index 00000000000000..d60b533632ddd0 --- /dev/null +++ b/recipes/screen_capture_lite/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/screen_capture_lite/all/test_package/test_package.cpp b/recipes/screen_capture_lite/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..0b39c636788c9f --- /dev/null +++ b/recipes/screen_capture_lite/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include "ScreenCapture.h" + +int main() { + SL::Screen_Capture::CreateCaptureConfiguration([](){ + return SL::Screen_Capture::GetMonitors(); + }); +} diff --git a/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt b/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..483105d61e33a1 --- /dev/null +++ b/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(screen_capture_lite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE screen_capture_lite::screen_capture_lite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/screen_capture_lite/all/test_v1_package/conanfile.py b/recipes/screen_capture_lite/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..132c03950e167e --- /dev/null +++ b/recipes/screen_capture_lite/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +from conan.tools.microsoft import is_msvc +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/screen_capture_lite/config.yml b/recipes/screen_capture_lite/config.yml new file mode 100644 index 00000000000000..ca60e591202a24 --- /dev/null +++ b/recipes/screen_capture_lite/config.yml @@ -0,0 +1,3 @@ +versions: + "17.1.439": + folder: "all" From 016bfda6f6f613e5be0806c85e8ef4b01f681df0 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Mon, 24 Oct 2022 13:04:56 +0200 Subject: [PATCH 152/300] (#13602) actions: upgrade changed-files version * actions: upgrade changed-files version Adapt the fetch depth in consequence * fix fetch-depth * add an error in 7zip * trigger conanfile error * Update config.yml * Update conanfile.py * set base_sha * add error in aaf * add error in aaplus * fix errors * set target_branch_fetch_depth: 0 * set target_branch_fetch_depth: 0 * revert * Add yaml error * Fix fetch-depth * Update linter-yaml.yml * Update config.yml --- .github/workflows/linter-conan-v2.yml | 15 +++++++++------ .github/workflows/linter-yaml.yml | 13 ++++++++----- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/linter-conan-v2.yml b/.github/workflows/linter-conan-v2.yml index 7a002314625378..5373722197fb8a 100644 --- a/.github/workflows/linter-conan-v2.yml +++ b/.github/workflows/linter-conan-v2.yml @@ -16,11 +16,12 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 2 + fetch-depth: 0 - name: Get changed files - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 id: changed_files with: + base_sha: ${{ github.event.pull_request.base.sha }} files: | linter/** - name: Get Conan v1 version @@ -84,11 +85,12 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 2 + fetch-depth: 0 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 with: + base_sha: ${{ github.event.pull_request.base.sha }} files: | recipes/*/*/conanfile.py - name: Get Conan v1 version @@ -119,11 +121,12 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 2 + fetch-depth: 0 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 with: + base_sha: ${{ github.event.pull_request.base.sha }} files: | recipes/*/*/test_*/conanfile.py - name: Get Conan v1 version diff --git a/.github/workflows/linter-yaml.yml b/.github/workflows/linter-yaml.yml index 59e73e83b163c0..850bd3d240a9e1 100644 --- a/.github/workflows/linter-yaml.yml +++ b/.github/workflows/linter-yaml.yml @@ -17,12 +17,13 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 2 + fetch-depth: 0 - name: Get changed files - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 id: changed_files with: + base_sha: ${{ github.event.pull_request.base.sha }} files: | linter/** @@ -51,7 +52,7 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 2 + fetch-depth: 0 - uses: actions/setup-python@v4 with: @@ -64,8 +65,9 @@ jobs: - name: Get changed files (config) id: changed_files_config if: always() - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 with: + base_sha: ${{ github.event.pull_request.base.sha }} files: | ${{ env.CONFIG_FILES_PATH }} @@ -80,8 +82,9 @@ jobs: - name: Get changed files (conandata) id: changed_files_conandata if: always() - uses: tj-actions/changed-files@v20 + uses: tj-actions/changed-files@v32 with: + base_sha: ${{ github.event.pull_request.base.sha }} files: | ${{ env.CONANDATA_FILES_PATH }} From 869dc7d6571e3458b0728d9db0850011712e89bc Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Mon, 24 Oct 2022 19:25:08 +0800 Subject: [PATCH 153/300] (#10855) [package] cgns/4.3.0: Updated release, plus some recipe fixes * cgns - add 4.3.0 and 'parallel' option Note that HDF5 still can't compile with 'parallel' option enabled, hopefully someone else will fix that. * Requires cmake_find_package on windows/msvc * Bump HDF5 version * Bump HDF5 to 1.13.1 * Lint fix * - always set CMAKE_BUILD_TYPE Signed-off-by: SSE4 * Small change to make v2 linter happy * Fixing up components * Extra validation * Minor fix for requirements * Don't auto-set these options - not required for CCI User has to explicitly set the appropriate options. * Adjustments for conan v2 migration * Attempt 2 for conan v2 * Attempt 3 for conan v2 * Let conan set CMAKE_BUILD_TYPE * Don't forget CMakeDeps * Specify libdirs, even though it should be the default * Whitespace to force CI rebuild, hopefully * Tweak to deleting libcxx * Back to try/except * More tweaks to make good * Switch to find_package(HDF5) for old cgns v3 * Remove 3.4.1 support - too hard to make it work with conan v2 toolchain * Upgrading for conan v2 * Fix for hdf5 library link patch Signed-off-by: SSE4 Co-authored-by: SSE4 --- recipes/cgns/all/CMakeLists.txt | 7 - recipes/cgns/all/conandata.yml | 14 +- recipes/cgns/all/conanfile.py | 132 +++++++++++------- .../all/patches/4.3.0-fix_find_hdf5.patch | 23 +++ .../patches/4.3.0-fix_static_or_shared.patch | 24 ++++ recipes/cgns/all/patches/fix_find_hdf5.patch | 19 --- .../all/patches/fix_static_or_shared.patch | 31 ---- recipes/cgns/all/test_package/CMakeLists.txt | 5 +- recipes/cgns/all/test_package/conanfile.py | 21 ++- .../cgns/all/test_v1_package/CMakeLists.txt | 8 ++ recipes/cgns/all/test_v1_package/conanfile.py | 18 +++ recipes/cgns/config.yml | 2 +- 12 files changed, 181 insertions(+), 123 deletions(-) delete mode 100644 recipes/cgns/all/CMakeLists.txt create mode 100644 recipes/cgns/all/patches/4.3.0-fix_find_hdf5.patch create mode 100644 recipes/cgns/all/patches/4.3.0-fix_static_or_shared.patch delete mode 100644 recipes/cgns/all/patches/fix_find_hdf5.patch delete mode 100644 recipes/cgns/all/patches/fix_static_or_shared.patch create mode 100644 recipes/cgns/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/cgns/all/test_v1_package/conanfile.py diff --git a/recipes/cgns/all/CMakeLists.txt b/recipes/cgns/all/CMakeLists.txt deleted file mode 100644 index a1b3f866c27c38..00000000000000 --- a/recipes/cgns/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/cgns/all/conandata.yml b/recipes/cgns/all/conandata.yml index f087eac889b033..bbbd27b41a558f 100644 --- a/recipes/cgns/all/conandata.yml +++ b/recipes/cgns/all/conandata.yml @@ -1,10 +1,8 @@ sources: - "3.4.1": - url: "https://github.com/CGNS/CGNS/archive/v3.4.1.tar.gz" - sha256: "d32595e7737b9332243bd3de1eb8c018a272f620f09b289dea8292eba1365994" + "4.3.0": + url: "https://github.com/CGNS/CGNS/archive/v4.3.0.tar.gz" + sha256: "7709eb7d99731dea0dd1eff183f109eaef8d9556624e3fbc34dc5177afc0a032" patches: - "3.4.1": - - patch_file: "patches/fix_find_hdf5.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix_static_or_shared.patch" - base_path: "source_subfolder" + "4.3.0": + - patch_file: "patches/4.3.0-fix_find_hdf5.patch" + - patch_file: "patches/4.3.0-fix_static_or_shared.patch" diff --git a/recipes/cgns/all/conanfile.py b/recipes/cgns/all/conanfile.py index 72ba39fc8a3bdf..137666452ceb7b 100644 --- a/recipes/cgns/all/conanfile.py +++ b/recipes/cgns/all/conanfile.py @@ -1,41 +1,36 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.29.1" - +required_conan_version = ">=1.52.0" class CgnsConan(ConanFile): name = "cgns" description = "Standard for data associated with the numerical solution " \ "of fluid dynamics equations." - topics = ("conan", "cgns", "data", "cfd", "fluids") + topics = "data", "cfd", "fluids" homepage = "http://cgns.org/" license = "Zlib" url = "https://github.com/conan-io/conan-center-index" settings = "os", "compiler", "build_type", "arch" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" options = { "shared": [True, False], "fPIC": [True, False], - "with_hdf5": [True, False] + "with_hdf5": [True, False], + "parallel": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_hdf5": True + "with_hdf5": True, + "parallel": False, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,50 +38,91 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_hdf5: - self.requires("hdf5/1.12.0") - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("CGNS-" + self.version, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake + self.requires("hdf5/1.13.1") - self._cmake = CMake(self) - self._cmake.definitions["CGNS_ENABLE_TESTS"] = False - self._cmake.definitions["CGNS_BUILD_TESTING"] = False - self._cmake.definitions["CGNS_ENABLE_FORTRAN"] = False - self._cmake.definitions["CGNS_ENABLE_HDF5"] = self.options.with_hdf5 - self._cmake.definitions["CGNS_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["CGNS_USE_SHARED"] = self.options.shared - self._cmake.definitions["CGNS_BUILD_CGNSTOOLS"] = False - self._cmake.configure() + def validate(self): + if self.info.options.parallel and not (self.info.options.with_hdf5 and self.dependencies["hdf5"].options.parallel): + raise ConanInvalidConfiguration("The option 'parallel' requires HDF5 with parallel=True") + if self.info.options.parallel and self.info.options.with_hdf5 and self.dependencies["hdf5"].options.enable_cxx: + raise ConanInvalidConfiguration("The option 'parallel' requires HDF5 with enable_cxx=False") - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + cmake = CMakeDeps(self) + cmake.generate() + + tc = CMakeToolchain(self) + tc.variables["CGNS_ENABLE_TESTS"] = False + tc.variables["CGNS_BUILD_TESTING"] = False + tc.variables["CGNS_ENABLE_FORTRAN"] = False + tc.variables["CGNS_ENABLE_HDF5"] = self.options.with_hdf5 + tc.variables["CGNS_BUILD_SHARED"] = self.options.shared + tc.variables["CGNS_USE_SHARED"] = self.options.shared + tc.variables["CGNS_ENABLE_PARALLEL"] = self.options.parallel + tc.variables["CGNS_BUILD_CGNSTOOLS"] = False + tc.generate() + + # Other flags, seen in appveyor.yml in source code, not currently managed. + # CGNS_ENABLE_LFS:BOOL=OFF --- note in code: needed on 32 bit systems + # CGNS_ENABLE_SCOPING:BOOL=OFF --- disabled in VTK's bundle + # HDF5_NEED_ZLIB:BOOL=ON -- should be dealt with by cmake auto dependency management or something? def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build(target="cgns_shared" if self.options.shared else "cgns_static") def package(self): - self.copy("license.txt", dst="licenses", src=self._source_subfolder) + copy(self, "license.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - os.remove(os.path.join(self.package_folder, "include", "cgnsBuild.defs")) + rm(self, "cgnsBuild.defs", os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.libs = ["cgnsdll" if self.settings.os == "Windows" and self.options.shared else "cgns"] - if self.settings.os == "Windows" and self.options.shared: - self.cpp_info.defines = ["CGNSDLL=__declspec(dllimport)"] # we could instead define USE_DLL but it's too generic + self.cpp_info.set_property("cmake_file_name", "CGNS") + self.cpp_info.set_property("cmake_target_name", "CGNS::CGNS") + + if self.options.shared: + self.cpp_info.components["cgns_shared"].set_property("cmake_target_name", "CGNS::cgns_shared") + self.cpp_info.components["cgns_shared"].libs = ["cgnsdll" if self.settings.os == "Windows" else "cgns"] + self.cpp_info.components["cgns_shared"].libdirs = ["lib"] + if self.options.with_hdf5: + self.cpp_info.components["cgns_shared"].requires = ["hdf5::hdf5"] + if self.settings.os == "Windows": + # we could instead define USE_DLL but it's too generic + self.cpp_info.components["cgns_shared"].defines = ["CGNSDLL=__declspec(dllimport)"] + else: + self.cpp_info.components["cgns_static"].set_property("cmake_target_name", "CGNS::cgns_static") + self.cpp_info.components["cgns_static"].libs = ["cgns"] + self.cpp_info.components["cgns_static"].libdirs = ["lib"] + if self.options.with_hdf5: + self.cpp_info.components["cgns_static"].requires = ["hdf5::hdf5"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "CGNS" + self.cpp_info.names["cmake_find_package_multi"] = "CGNS" diff --git a/recipes/cgns/all/patches/4.3.0-fix_find_hdf5.patch b/recipes/cgns/all/patches/4.3.0-fix_find_hdf5.patch new file mode 100644 index 00000000000000..2863a2571c6d27 --- /dev/null +++ b/recipes/cgns/all/patches/4.3.0-fix_find_hdf5.patch @@ -0,0 +1,23 @@ +diff -r -u a/src/CMakeLists.txt b/src/CMakeLists.txt +--- a/src/CMakeLists.txt 2022-05-31 16:13:29.855723400 +0800 ++++ b/src/CMakeLists.txt 2022-05-31 16:40:39.332447379 +0800 +@@ -576,7 +576,7 @@ + add_library(CGNS::cgns-static ALIAS cgns_static) + # Needed to work around a CMake > 3.8 bug on Windows with MSVS and Intel Fortran + set_property(TARGET cgns_static PROPERTY LINKER_LANGUAGE C) +-target_link_libraries(cgns_static PRIVATE $<$:hdf5::hdf5-${CG_HDF5_LINK_TYPE}>) ++target_link_libraries(cgns_static PRIVATE $<$:HDF5::HDF5>) + + # Build a shared version of the library + if(CGNS_BUILD_SHARED) +@@ -592,8 +592,8 @@ + target_compile_definitions(cgns_shared PRIVATE -DBUILD_DLL) + target_compile_definitions(cgns_shared INTERFACE -DUSE_DLL) + endif () +- if (CGNS_ENABLE_HDF5 AND HDF5_LIBRARY) +- target_link_libraries(cgns_shared PUBLIC hdf5::hdf5-${CG_HDF5_LINK_TYPE} $<$>:${CMAKE_DL_LIBS}>) ++ if (CGNS_ENABLE_HDF5) ++ target_link_libraries(cgns_shared PUBLIC HDF5::HDF5 $<$>:${CMAKE_DL_LIBS}>) + if(HDF5_NEED_ZLIB AND ZLIB_LIBRARY) + target_link_libraries(cgns_shared PUBLIC ${ZLIB_LIBRARY}) + endif() diff --git a/recipes/cgns/all/patches/4.3.0-fix_static_or_shared.patch b/recipes/cgns/all/patches/4.3.0-fix_static_or_shared.patch new file mode 100644 index 00000000000000..8d07a513f10d2e --- /dev/null +++ b/recipes/cgns/all/patches/4.3.0-fix_static_or_shared.patch @@ -0,0 +1,24 @@ +Enforces that either static or dynamic libs are built + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 103cb1f..aae21a7 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -674,7 +674,9 @@ if(CGNS_BUILD_SHARED) + endif() + + ++if(NOT CGNS_BUILD_SHARED) + set (install_targets cgns_static) ++endif() + if(CGNS_BUILD_SHARED) + set(install_targets ${install_targets} cgns_shared) + endif () +@@ -738,7 +740,6 @@ install(EXPORT cgns-targets + # Tools # + ######### + +-add_subdirectory(tools) + + ######### + # Tests # diff --git a/recipes/cgns/all/patches/fix_find_hdf5.patch b/recipes/cgns/all/patches/fix_find_hdf5.patch deleted file mode 100644 index 1ca9fbb2be23d1..00000000000000 --- a/recipes/cgns/all/patches/fix_find_hdf5.patch +++ /dev/null @@ -1,19 +0,0 @@ -The CGNS build uses the FindHDF5 module that locates the HDF5 libs by invoking the HDF5 compiler. -In order to link to the correct libraries provided by conan, the whole logic is removed from the cmake script. - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -192,8 +192,11 @@ endif (CGNS_ENABLE_FORTRAN AND HAS_FORTRAN) - ######## - - option(CGNS_ENABLE_HDF5 "Enable or disable HDF5 interface" "OFF") --if (CGNS_ENABLE_HDF5) -- -+include_directories(${CONAN_INCLUDE_DIRS}) -+set(HDF5_LIBRARY CONAN_PKG::hdf5) -+# All this logic is useless for conan -+# (but don't forget to handle HDF5_NEED_MPI cache variable when we could use openmpi in hdf5) -+if(0) - if (CGNS_BUILD_SHARED) - set (FIND_HDF_COMPONENTS C shared) - else (CGNS_BUILD_SHARED) diff --git a/recipes/cgns/all/patches/fix_static_or_shared.patch b/recipes/cgns/all/patches/fix_static_or_shared.patch deleted file mode 100644 index df7af85cd4aa18..00000000000000 --- a/recipes/cgns/all/patches/fix_static_or_shared.patch +++ /dev/null @@ -1,31 +0,0 @@ -Enforces that either static or dynamic libs are built - ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -542,7 +542,7 @@ option(CGNS_USE_SHARED "Link programs to the CGNS shared library" "ON") - if (CGNS_ENABLE_FORTRAN) - add_library(cgns_static STATIC ${cgns_FILES} $) - else (CGNS_ENABLE_FORTRAN) -- add_library(cgns_static STATIC ${cgns_FILES}) -+ add_library(cgns_static STATIC EXCLUDE_FROM_ALL ${cgns_FILES}) - endif (CGNS_ENABLE_FORTRAN) - # Needed to work around a CMake > 3.8 bug on Windows with MSVS and Intel Fortran - set_property(TARGET cgns_static PROPERTY LINKER_LANGUAGE C) -@@ -598,7 +598,9 @@ if(CGNS_BUILD_SHARED) - endif(CGNS_BUILD_SHARED) - - # Set the install path of the static library -+if(NOT CGNS_BUILD_SHARED) - install(TARGETS cgns_static ARCHIVE DESTINATION lib) -+endif() - # Set the install path of the shared library - if(CGNS_BUILD_SHARED) - # for windows, need to install both cgnsdll.dll and cgnsdll.lib -@@ -650,7 +652,6 @@ install(FILES ${headers} - # Tools # - ######### - --add_subdirectory(tools) - - ######### - # Tests # diff --git a/recipes/cgns/all/test_package/CMakeLists.txt b/recipes/cgns/all/test_package/CMakeLists.txt index 9d13f5fdc4323f..bb8b97918cf4b6 100644 --- a/recipes/cgns/all/test_package/CMakeLists.txt +++ b/recipes/cgns/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(CGNS CONFIG REQUIRED) add_executable(test_package test_package.cpp) -target_link_libraries(test_package ${CONAN_LIBS}) +target_link_libraries(test_package CGNS::CGNS) diff --git a/recipes/cgns/all/test_package/conanfile.py b/recipes/cgns/all/test_package/conanfile.py index b4c9865828e628..7fa7076884d604 100644 --- a/recipes/cgns/all/test_package/conanfile.py +++ b/recipes/cgns/all/test_package/conanfile.py @@ -1,11 +1,20 @@ import os +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run -from conans import ConanFile, CMake, tools - +required_conan_version = ">=1.52.0" class CgnsTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cgns/all/test_v1_package/CMakeLists.txt b/recipes/cgns/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..a7c9449fc2eb15 --- /dev/null +++ b/recipes/cgns/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(test_package ../test_package/test_package.cpp) +target_link_libraries(test_package ${CONAN_LIBS}) diff --git a/recipes/cgns/all/test_v1_package/conanfile.py b/recipes/cgns/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..b4c9865828e628 --- /dev/null +++ b/recipes/cgns/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class CgnsTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cgns/config.yml b/recipes/cgns/config.yml index d212293f8478bd..fefa3b794940eb 100644 --- a/recipes/cgns/config.yml +++ b/recipes/cgns/config.yml @@ -1,3 +1,3 @@ versions: - "3.4.1": + "4.3.0": folder: all From 7bce861429fb5259ffd52324360c75ff7f19e9a9 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 13:44:57 +0200 Subject: [PATCH 154/300] (#13672) sqlite_orm: conan v2 support --- recipes/sqlite_orm/all/conandata.yml | 1 - recipes/sqlite_orm/all/conanfile.py | 53 +++++++++++-------- .../all/test_package/CMakeLists.txt | 11 ++-- .../sqlite_orm/all/test_package/conanfile.py | 19 +++++-- .../all/test_v1_package/CMakeLists.txt | 11 ++++ .../all/test_v1_package/conanfile.py | 17 ++++++ 6 files changed, 76 insertions(+), 36 deletions(-) create mode 100644 recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/sqlite_orm/all/test_v1_package/conanfile.py diff --git a/recipes/sqlite_orm/all/conandata.yml b/recipes/sqlite_orm/all/conandata.yml index 998bcbb3f677e6..b36624badba2f1 100644 --- a/recipes/sqlite_orm/all/conandata.yml +++ b/recipes/sqlite_orm/all/conandata.yml @@ -11,4 +11,3 @@ sources: patches: "1.7": - patch_file: "patches/0001-declare-is-upsert-clause.patch" - base_path: "source_subfolder" diff --git a/recipes/sqlite_orm/all/conanfile.py b/recipes/sqlite_orm/all/conanfile.py index 76f1517d72c5d8..a3b8fcd9aac81d 100644 --- a/recipes/sqlite_orm/all/conanfile.py +++ b/recipes/sqlite_orm/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class SqliteOrmConan(ConanFile): @@ -15,59 +18,63 @@ class SqliteOrmConan(ConanFile): settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property def _compilers_minimum_version(self): return { "gcc": "5", "Visual Studio": "14", + "msvc": "190", "clang": "3.4", "apple-clang": "5.1", } def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("sqlite3/3.37.2") + self.requires("sqlite3/3.39.4", transitive_headers=True, transitive_libs=True) + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, self._min_cppstd) - def lazy_lt_semver(v1, v2): + def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("sqlite_orm requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("sqlite_orm requires C++14, which your compiler does not support.") - - def package_id(self): - self.info.header_only() + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "SqliteOrm") self.cpp_info.set_property("cmake_target_name", "sqlite_orm::sqlite_orm") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] self.cpp_info.filenames["cmake_find_package"] = "SqliteOrm" self.cpp_info.filenames["cmake_find_package_multi"] = "SqliteOrm" diff --git a/recipes/sqlite_orm/all/test_package/CMakeLists.txt b/recipes/sqlite_orm/all/test_package/CMakeLists.txt index 971acc2578776b..344f40b9c7cdcc 100644 --- a/recipes/sqlite_orm/all/test_package/CMakeLists.txt +++ b/recipes/sqlite_orm/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(SqliteOrm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} sqlite_orm::sqlite_orm) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE sqlite_orm::sqlite_orm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/sqlite_orm/all/test_package/conanfile.py b/recipes/sqlite_orm/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/sqlite_orm/all/test_package/conanfile.py +++ b/recipes/sqlite_orm/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt b/recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..c4fec8ca6bb0b4 --- /dev/null +++ b/recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(SqliteOrm REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE sqlite_orm::sqlite_orm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/sqlite_orm/all/test_v1_package/conanfile.py b/recipes/sqlite_orm/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/sqlite_orm/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From d23ab8d9a529417f09cc5c475334a4eb6b604ea9 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 14:05:22 +0200 Subject: [PATCH 155/300] (#13679) cppzmq: conan v2 support --- recipes/cppzmq/all/conanfile.py | 39 +++++++++++-------- .../cppzmq/all/test_package/CMakeLists.txt | 7 +--- recipes/cppzmq/all/test_package/conanfile.py | 19 ++++++--- .../cppzmq/all/test_v1_package/CMakeLists.txt | 8 ++++ .../cppzmq/all/test_v1_package/conanfile.py | 17 ++++++++ 5 files changed, 63 insertions(+), 27 deletions(-) create mode 100644 recipes/cppzmq/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/cppzmq/all/test_v1_package/conanfile.py diff --git a/recipes/cppzmq/all/conanfile.py b/recipes/cppzmq/all/conanfile.py index b76e007c8835d4..44e3718dd5de34 100644 --- a/recipes/cppzmq/all/conanfile.py +++ b/recipes/cppzmq/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get, save +from conan.tools.layout import basic_layout import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class CppZmqConan(ConanFile): @@ -17,23 +19,25 @@ class CppZmqConan(ConanFile): no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("zeromq/4.3.4") + self.requires("zeromq/4.3.4", transitive_headers=True, transitive_libs=True) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("zmq*.hpp", dst="include", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "zmq*.hpp", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self._create_cmake_module_alias_targets( @@ -44,21 +48,20 @@ def package(self): } ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "cppzmq") @@ -67,6 +70,8 @@ def package_info(self): # - cppzmq-static if cppzmq depends on static zeromq self.cpp_info.set_property("cmake_target_name", "cppzmq") self.cpp_info.set_property("cmake_target_aliases", ["cppzmq-static"]) + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "cppzmq" diff --git a/recipes/cppzmq/all/test_package/CMakeLists.txt b/recipes/cppzmq/all/test_package/CMakeLists.txt index 6f9d165d70f7b8..207bcc2f27a5a7 100644 --- a/recipes/cppzmq/all/test_package/CMakeLists.txt +++ b/recipes/cppzmq/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(cppzmq REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cppzmq) +target_link_libraries(${PROJECT_NAME} PRIVATE cppzmq) diff --git a/recipes/cppzmq/all/test_package/conanfile.py b/recipes/cppzmq/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/cppzmq/all/test_package/conanfile.py +++ b/recipes/cppzmq/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cppzmq/all/test_v1_package/CMakeLists.txt b/recipes/cppzmq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/cppzmq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cppzmq/all/test_v1_package/conanfile.py b/recipes/cppzmq/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/cppzmq/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 92689772fa4e3a237ae93a6e7a10af2a03e7fbc1 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 14:25:16 +0200 Subject: [PATCH 156/300] (#13680) mathfu: conan v2 support --- recipes/mathfu/all/conanfile.py | 34 ++++++++++++------- .../mathfu/all/test_package/CMakeLists.txt | 7 ++-- recipes/mathfu/all/test_package/conanfile.py | 19 ++++++++--- .../mathfu/all/test_v1_package/CMakeLists.txt | 8 +++++ .../mathfu/all/test_v1_package/conanfile.py | 17 ++++++++++ 5 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 recipes/mathfu/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/mathfu/all/test_v1_package/conanfile.py diff --git a/recipes/mathfu/all/conanfile.py b/recipes/mathfu/all/conanfile.py index f683a695f0807b..1b35d3c154c774 100644 --- a/recipes/mathfu/all/conanfile.py +++ b/recipes/mathfu/all/conanfile.py @@ -1,35 +1,43 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.52.0" + class MathfuConan(ConanFile): name = "mathfu" description = "C++ math library developed primarily for games focused on simplicity and efficiency." - topics = ("conan", "mathfu", "math", "geometry") + topics = ("math", "geometry") license = "Apache-2.0" homepage = "https://github.com/google/mathfu" url = "https://github.com/conan-io/conan-center-index" - settings = "os" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("vectorial/cci.20190628") + self.requires("vectorial/cci.20190628", transitive_headers=True, transitive_libs=True) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(self.name + "-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): - if self.settings.os == "Linux": + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/mathfu/all/test_package/CMakeLists.txt b/recipes/mathfu/all/test_package/CMakeLists.txt index 196188113685c8..71adac698445b9 100644 --- a/recipes/mathfu/all/test_package/CMakeLists.txt +++ b/recipes/mathfu/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mathfu REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE mathfu::mathfu) diff --git a/recipes/mathfu/all/test_package/conanfile.py b/recipes/mathfu/all/test_package/conanfile.py index 5216332f39f5ca..0a6bc68712d901 100644 --- a/recipes/mathfu/all/test_package/conanfile.py +++ b/recipes/mathfu/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mathfu/all/test_v1_package/CMakeLists.txt b/recipes/mathfu/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/mathfu/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mathfu/all/test_v1_package/conanfile.py b/recipes/mathfu/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/mathfu/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From ce749b33037ca03076d6e084084a3485d035b360 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 14:45:08 +0200 Subject: [PATCH 157/300] (#13682) xproperty: conan v2 support --- recipes/xproperty/all/conanfile.py | 48 +++++++++++-------- .../xproperty/all/test_package/CMakeLists.txt | 11 ++--- .../xproperty/all/test_package/conanfile.py | 19 ++++++-- .../all/test_v1_package/CMakeLists.txt | 8 ++++ .../all/test_v1_package/conanfile.py | 17 +++++++ 5 files changed, 70 insertions(+), 33 deletions(-) create mode 100644 recipes/xproperty/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/xproperty/all/test_v1_package/conanfile.py diff --git a/recipes/xproperty/all/conanfile.py b/recipes/xproperty/all/conanfile.py index 4eb06511f769a9..f3db566cfff6d7 100644 --- a/recipes/xproperty/all/conanfile.py +++ b/recipes/xproperty/all/conanfile.py @@ -1,66 +1,72 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, save +from conan.tools.layout import basic_layout import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class XpropertyConan(ConanFile): name = "xproperty" description = "Traitlets-like C++ properties and implementation of the observer pattern." license = "BSD-3-Clause" - topics = ("xproperty", "observer", "traitlets") + topics = ("observer", "traitlets") homepage = "https://github.com/jupyter-xeus/xproperty" url = "https://github.com/conan-io/conan-center-index" no_copy_source = True settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("xtl/0.7.4") + self.requires("xtl/0.7.4", transitive_headers=True, transitive_libs=True) + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 14) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"xproperty": "xproperty::xproperty"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "xproperty") self.cpp_info.set_property("cmake_target_name", "xproperty") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/xproperty/all/test_package/CMakeLists.txt b/recipes/xproperty/all/test_package/CMakeLists.txt index f01f0f02aa1d40..5115f7961f51a2 100644 --- a/recipes/xproperty/all/test_package/CMakeLists.txt +++ b/recipes/xproperty/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(xproperty REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} xproperty) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE xproperty) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/xproperty/all/test_package/conanfile.py b/recipes/xproperty/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/xproperty/all/test_package/conanfile.py +++ b/recipes/xproperty/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xproperty/all/test_v1_package/CMakeLists.txt b/recipes/xproperty/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/xproperty/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/xproperty/all/test_v1_package/conanfile.py b/recipes/xproperty/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/xproperty/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 9ea42385db74e275449de93187a6f30e428d220f Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 15:05:50 +0200 Subject: [PATCH 158/300] (#13686) zmqpp: conan v2 support --- recipes/zmqpp/all/CMakeLists.txt | 7 -- recipes/zmqpp/all/conandata.yml | 3 - recipes/zmqpp/all/conanfile.py | 90 +++++++++++-------- .../zmqpp/all/patches/0001-fix-cmake.patch | 63 ++++++++----- recipes/zmqpp/all/test_package/CMakeLists.txt | 15 +--- recipes/zmqpp/all/test_package/conanfile.py | 21 +++-- .../zmqpp/all/test_v1_package/CMakeLists.txt | 8 ++ .../zmqpp/all/test_v1_package/conanfile.py | 17 ++++ 8 files changed, 136 insertions(+), 88 deletions(-) delete mode 100644 recipes/zmqpp/all/CMakeLists.txt create mode 100644 recipes/zmqpp/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/zmqpp/all/test_v1_package/conanfile.py diff --git a/recipes/zmqpp/all/CMakeLists.txt b/recipes/zmqpp/all/CMakeLists.txt deleted file mode 100644 index e4233e81e86f07..00000000000000 --- a/recipes/zmqpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/zmqpp/all/conandata.yml b/recipes/zmqpp/all/conandata.yml index b277f02bd34529..b8b843edf38c8e 100644 --- a/recipes/zmqpp/all/conandata.yml +++ b/recipes/zmqpp/all/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "4.2.0": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-missing-includes.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-Allow-building-with-Werror-undef.patch" - base_path: "source_subfolder" diff --git a/recipes/zmqpp/all/conanfile.py b/recipes/zmqpp/all/conanfile.py index c18e485f5b94d9..8d4bf7d455227f 100644 --- a/recipes/zmqpp/all/conanfile.py +++ b/recipes/zmqpp/all/conanfile.py @@ -1,6 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class ZmqppConan(ConanFile): @@ -8,22 +12,24 @@ class ZmqppConan(ConanFile): homepage = "https://github.com/zeromq/zmqpp" license = "MPL-2.0" url = "https://github.com/conan-io/conan-center-index" - description = "This C++ binding for 0mq/zmq is a 'high-level' library that hides most of the c-style interface core 0mq provides." - topics = ("conan", "zmq", "0mq", "zeromq", "message-queue", "asynchronous") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake" - _cmake = None + description = ( + "This C++ binding for 0mq/zmq is a 'high-level' library that hides " + "most of the c-style interface core 0mq provides." + ) + topics = ("zmq", "0mq", "zeromq", "message-queue", "asynchronous") - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -31,45 +37,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("zeromq/4.3.4") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ZMQPP_LIBZMQ_CMAKE"] = False - self._cmake.definitions["ZMQPP_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["ZMQPP_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["ZMQPP_BUILD_EXAMPLES"] = False - self._cmake.definitions["ZMQPP_BUILD_CLIENT"] = False - self._cmake.definitions["ZMQPP_BUILD_TESTS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + # No bool cast until https://github.com/conan-io/conan/pull/12086 (conan 1.53.0) + tc.cache_variables["ZMQPP_LIBZMQ_CMAKE"] = "ON" + tc.cache_variables["ZMQPP_BUILD_STATIC"] = "OFF" if self.options.shared else "ON" + tc.cache_variables["ZMQPP_BUILD_SHARED"] = "ON" if self.options.shared else "OFF" + tc.cache_variables["ZMQPP_BUILD_EXAMPLES"] = "OFF" + tc.cache_variables["ZMQPP_BUILD_CLIENT"] = "OFF" + tc.cache_variables["ZMQPP_BUILD_TESTS"] = "OFF" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["pkg_config"] = "libzmqpp" + self.cpp_info.set_property("pkg_config_name", "libzmqpp") self.cpp_info.libs = ["zmqpp" if self.options.shared else "zmqpp-static"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/zmqpp/all/patches/0001-fix-cmake.patch b/recipes/zmqpp/all/patches/0001-fix-cmake.patch index 5b7f7f83fb25b5..bc1a37ef765bec 100644 --- a/recipes/zmqpp/all/patches/0001-fix-cmake.patch +++ b/recipes/zmqpp/all/patches/0001-fix-cmake.patch @@ -1,8 +1,5 @@ -Patch from https://github.com/zeromq/zmqpp/commit/05ad2f3255e5d74febbd1e17663bbfc2ded46c18 -It also allows more robust injection of zeromq and C++11 - --- a/CMakeLists.txt -+++ b/CMakeLists_new.txt ++++ b/CMakeLists.txt @@ -11,14 +11,17 @@ # @@ -22,43 +19,66 @@ It also allows more robust injection of zeromq and C++11 # Set compiler flags that don't work on Windows if(NOT MSVC) -@@ -63,7 +66,6 @@ set( ZEROMQ_INCLUDE_DIR "" CACHE PATH "The include directory for ZMQ" ) - set( IS_TRAVIS_CI_BUILD true CACHE bool "Defines TRAVIS_CI_BUILD - Should the tests avoid running cases where memory is scarce." ) +@@ -31,7 +34,7 @@ endif() + # remove this block (see CMP0042). + # + # TODO: verify correctness of this flag +-if(NOT DEFINED CMAKE_MACOSX_RPATH) ++if(0) + set(CMAKE_MACOSX_RPATH 0) + endif() + +@@ -60,11 +63,11 @@ set( ZEROMQ_LIB_DIR "" CACHE PATH "The library directory for libzmq" + set( ZEROMQ_INCLUDE_DIR "" CACHE PATH "The include directory for ZMQ" ) + + # Build flags +-set( IS_TRAVIS_CI_BUILD true CACHE bool "Defines TRAVIS_CI_BUILD - Should the tests avoid running cases where memory is scarce." ) ++set( IS_TRAVIS_CI_BUILD true CACHE BOOL "Defines TRAVIS_CI_BUILD - Should the tests avoid running cases where memory is scarce." ) # Find zmq.h and add its dir to the includes -find_path(ZEROMQ_INCLUDE zmq.h PATHS ${ZEROMQ_INCLUDE_DIR}) - include_directories(${ZEROMQ_INCLUDE_DIR} ${ZEROMQ_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src ) +-include_directories(${ZEROMQ_INCLUDE_DIR} ${ZEROMQ_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src ) ++find_package(ZeroMQ REQUIRED CONFIG) ++include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src ) # Do not run some tests when building on travis-ci (this cause oom error and kill the test -@@ -108,13 +110,12 @@ set( LIBZMQPP_SOURCES + # process) +@@ -107,7 +110,8 @@ set( LIBZMQPP_SOURCES + # Staticlib if (ZMQPP_BUILD_STATIC) add_library( zmqpp-static STATIC ${LIBZMQPP_SOURCES}) - target_compile_definitions(zmqpp-static PUBLIC ZMQ_STATIC ZMQPP_STATIC_DEFINE) +- target_compile_definitions(zmqpp-static PUBLIC ZMQ_STATIC ZMQPP_STATIC_DEFINE) ++ target_compile_definitions(zmqpp-static PUBLIC ZMQPP_STATIC_DEFINE) + target_compile_features(zmqpp-static PRIVATE cxx_std_11) if (NOT ZMQPP_LIBZMQ_CMAKE) -- find_library(ZEROMQ_LIBRARY_STATIC ${ZMQPP_LIBZMQ_NAME_STATIC} PATHS ${ZEROMQ_LIB_DIR}) + find_library(ZEROMQ_LIBRARY_STATIC ${ZMQPP_LIBZMQ_NAME_STATIC} PATHS ${ZEROMQ_LIB_DIR}) if (NOT ZEROMQ_LIBRARY_STATIC) - # If libzmq was not installed through CMake, the static binary is libzmq.a not libzmq-static.a -- find_library(ZEROMQ_LIBRARY_STATIC libzmq.a PATHS ${ZEROMQ_LIB_DIR}) - endif() -- target_link_libraries( zmqpp-static ${ZEROMQ_LIBRARY_STATIC}) -+ target_link_libraries( zmqpp-static CONAN_PKG::zeromq) +@@ -118,7 +122,7 @@ if (ZMQPP_BUILD_STATIC) else() # libzmq-static is the name of the target from # libzmq's CMake -@@ -127,9 +128,9 @@ endif() # ZMQPP_BUILD_STATIC +- target_link_libraries(zmqpp-static libzmq-static) ++ target_link_libraries(zmqpp-static $,libzmq,libzmq-static>) + endif() + list( APPEND INSTALL_TARGET_LIST zmqpp-static) + set( LIB_TO_LINK_TO_EXAMPLES zmqpp-static ) +@@ -127,13 +131,14 @@ endif() # ZMQPP_BUILD_STATIC # Shared lib if (ZMQPP_BUILD_SHARED) add_library( zmqpp SHARED ${LIBZMQPP_SOURCES}) + target_compile_features(zmqpp PRIVATE cxx_std_11) if (NOT ZMQPP_LIBZMQ_CMAKE) -- find_library(ZEROMQ_LIBRARY_SHARED ${ZMQPP_LIBZMQ_NAME_SHARED} PATHS ${ZEROMQ_LIB_DIR}) -- target_link_libraries( zmqpp ${ZEROMQ_LIBRARY_SHARED} ) -+ target_link_libraries( zmqpp CONAN_PKG::zeromq ) + find_library(ZEROMQ_LIBRARY_SHARED ${ZMQPP_LIBZMQ_NAME_SHARED} PATHS ${ZEROMQ_LIB_DIR}) + target_link_libraries( zmqpp ${ZEROMQ_LIBRARY_SHARED} ) else() # libzmq is the name of the target from # libzmq's CMake -@@ -141,11 +142,22 @@ endif() # ZMQPP_BUILD_SHARED +- target_link_libraries(zmqpp libzmq) ++ target_link_libraries(zmqpp $,libzmq,libzmq-static>) + endif() + list( APPEND INSTALL_TARGET_LIST zmqpp) + set( LIB_TO_LINK_TO_EXAMPLES zmqpp ) +@@ -141,11 +146,22 @@ endif() # ZMQPP_BUILD_SHARED # We need to link zmqpp to ws2_32 on windows for the implementation of winsock2.h if(WIN32) @@ -73,9 +93,8 @@ It also allows more robust injection of zeromq and C++11 endif() # WIN32 include(GenerateExportHeader) --generate_export_header(zmqpp) +if(ZMQPP_BUILD_SHARED) -+ generate_export_header(zmqpp) + generate_export_header(zmqpp) +elseif(ZMQPP_BUILD_STATIC) + generate_export_header(zmqpp-static BASE_NAME zmqpp) +endif() diff --git a/recipes/zmqpp/all/test_package/CMakeLists.txt b/recipes/zmqpp/all/test_package/CMakeLists.txt index 84aa17fcd594c4..18add93ce2d952 100644 --- a/recipes/zmqpp/all/test_package/CMakeLists.txt +++ b/recipes/zmqpp/all/test_package/CMakeLists.txt @@ -1,15 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(zmqpp REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) - -target_link_libraries(${PROJECT_NAME} zmqpp::zmqpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zmqpp::zmqpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/zmqpp/all/test_package/conanfile.py b/recipes/zmqpp/all/test_package/conanfile.py index 795f5c8fbb30e8..0a6bc68712d901 100644 --- a/recipes/zmqpp/all/test_package/conanfile.py +++ b/recipes/zmqpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zmqpp/all/test_v1_package/CMakeLists.txt b/recipes/zmqpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/zmqpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zmqpp/all/test_v1_package/conanfile.py b/recipes/zmqpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/zmqpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 99b38f37a37210a5223e0a6d84549a5b9a042be0 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 15:25:11 +0200 Subject: [PATCH 159/300] (#13688) tinyobjloader: add 1.0.7 & 2.0.0-rc10 + conan v2 support * conan v2 support * prefer tar.gz * add tinyobjloader/1.0.7 * add tinyobjloader/2.0.0-rc10 * remove implementation in header file * use v2 API in test package --- recipes/tinyobjloader/all/CMakeLists.txt | 9 -- recipes/tinyobjloader/all/conandata.yml | 26 ++++- recipes/tinyobjloader/all/conanfile.py | 94 ++++++++++--------- .../1.0.x-0001-cmake-minimum-required.patch | 12 +++ ...0.0-rc10-0001-cmake-minimum-required.patch | 12 +++ .../all/test_package/CMakeLists.txt | 28 +++--- .../all/test_package/conanfile.py | 23 +++-- .../{test_package_2.cpp => test_package.cpp} | 29 +++++- .../all/test_package/test_package_1.cpp | 24 ----- .../all/test_v1_package/CMakeLists.txt | 8 ++ .../all/test_v1_package/conanfile.py | 20 ++++ recipes/tinyobjloader/config.yml | 4 + 12 files changed, 185 insertions(+), 104 deletions(-) delete mode 100644 recipes/tinyobjloader/all/CMakeLists.txt create mode 100644 recipes/tinyobjloader/all/patches/1.0.x-0001-cmake-minimum-required.patch create mode 100644 recipes/tinyobjloader/all/patches/2.0.0-rc10-0001-cmake-minimum-required.patch rename recipes/tinyobjloader/all/test_package/{test_package_2.cpp => test_package.cpp} (50%) delete mode 100644 recipes/tinyobjloader/all/test_package/test_package_1.cpp create mode 100644 recipes/tinyobjloader/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/tinyobjloader/all/test_v1_package/conanfile.py diff --git a/recipes/tinyobjloader/all/CMakeLists.txt b/recipes/tinyobjloader/all/CMakeLists.txt deleted file mode 100644 index 881b1cb39250b4..00000000000000 --- a/recipes/tinyobjloader/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/tinyobjloader/all/conandata.yml b/recipes/tinyobjloader/all/conandata.yml index 1db573226b501c..a7c8b081490fbf 100644 --- a/recipes/tinyobjloader/all/conandata.yml +++ b/recipes/tinyobjloader/all/conandata.yml @@ -1,4 +1,26 @@ sources: + "2.0.0-rc10": + url: "https://github.com/tinyobjloader/tinyobjloader/archive/refs/tags/v2.0.0rc10.tar.gz" + sha256: "e1bc2e5547b562d33ca4a90b581717984a70d58113d83208dbc97c82e137b9fe" + "1.0.7": + url: "https://github.com/tinyobjloader/tinyobjloader/archive/refs/tags/v1.0.7.tar.gz" + sha256: "b9d08b675ba54b9cb00ffc99eaba7616d0f7e6f6b8947a7e118474e97d942129" "1.0.6": - url: https://github.com/syoyo/tinyobjloader/archive/v1.0.6.zip - sha256: ba549b59eafcdcd3d6a0ce367c9655affbc8e6f85053ea793a7333fe276879a2 + url: "https://github.com/tinyobjloader/tinyobjloader/archive/refs/tags/v1.0.6.tar.gz" + sha256: "19ee82cd201761954dd833de551edb570e33b320d6027e0d91455faf7cd4c341" +patches: + "2.0.0-rc10": + - patch_file: "patches/2.0.0-rc10-0001-cmake-minimum-required.patch" + patch_description: "CMake: move cmake_minimum_required() before project()" + patch_type: "backport" + patch_source: "https://github.com/tinyobjloader/tinyobjloader/pull/347" + "1.0.7": + - patch_file: "patches/1.0.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: move cmake_minimum_required() before project()" + patch_type: "backport" + patch_source: "https://github.com/tinyobjloader/tinyobjloader/pull/347" + "1.0.6": + - patch_file: "patches/1.0.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: move cmake_minimum_required() before project()" + patch_type: "backport" + patch_source: "https://github.com/tinyobjloader/tinyobjloader/pull/347" diff --git a/recipes/tinyobjloader/all/conanfile.py b/recipes/tinyobjloader/all/conanfile.py index 09b19ed30254ec..33703508847076 100644 --- a/recipes/tinyobjloader/all/conanfile.py +++ b/recipes/tinyobjloader/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, get, export_conandata_patches, load, replace_in_file, rmdir, save +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class TinyObjLoaderConan(ConanFile): @@ -11,7 +14,7 @@ class TinyObjLoaderConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/syoyo/tinyobjloader" - topics = ("tinyobjloader", "wavefront", "geometry") + topics = ("loader", "obj", "3d", "wavefront", "geometry") settings = "os", "arch", "build_type", "compiler" options = { @@ -25,17 +28,8 @@ class TinyObjLoaderConan(ConanFile): "double": False, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,33 +37,42 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TINYOBJLOADER_USE_DOUBLE"] = self.options.double - self._cmake.definitions["TINYOBJLOADER_BUILD_TEST_LOADER"] = False - self._cmake.definitions["TINYOBJLOADER_COMPILATION_SHARED"] = self.options.shared - self._cmake.definitions["TINYOBJLOADER_BUILD_OBJ_STICHER"] = False - self._cmake.definitions["CMAKE_INSTALL_DOCDIR"] = "licenses" - self._cmake.configure(build_dir=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TINYOBJLOADER_USE_DOUBLE"] = self.options.double + tc.variables["TINYOBJLOADER_BUILD_TEST_LOADER"] = False + if Version(self.version) < "1.0.7": + tc.variables["TINYOBJLOADER_COMPILATION_SHARED"] = self.options.shared + tc.variables["TINYOBJLOADER_BUILD_OBJ_STICHER"] = False + tc.variables["CMAKE_INSTALL_DOCDIR"] = "licenses" + if Version(self.version).major < 2: + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "tinyobjloader")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "tinyobjloader")) + self._remove_implementation(os.path.join(self.package_folder, "include", "tiny_obj_loader.h")) # TODO: to remove in conan v2 once cmake_find_package* generators removed cmake_target = "tinyobjloader_double" if self.options.double else "tinyobjloader" @@ -78,32 +81,37 @@ def package(self): {cmake_target: "tinyobjloader::tinyobjloader"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _remove_implementation(self, header_fullpath): + header_content = load(self, header_fullpath) + begin = header_content.find("#ifdef TINYOBJLOADER_IMPLEMENTATION") + implementation = header_content[begin:-1] + replace_in_file(self, header_fullpath, implementation, "") + + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): suffix = "_double" if self.options.double else "" self.cpp_info.set_property("cmake_file_name", "tinyobjloader") - self.cpp_info.set_property("cmake_target_name", "tinyobjloader{}".format(suffix)) - self.cpp_info.set_property("pkg_config_name", "tinyobjloader{}".format(suffix)) - self.cpp_info.libs = ["tinyobjloader{}".format(suffix)] + self.cpp_info.set_property("cmake_target_name", f"tinyobjloader::tinyobjloader{suffix}") + self.cpp_info.set_property("cmake_target_aliases", [f"tinyobjloader{suffix}"]) # old target (before 1.0.7) + self.cpp_info.set_property("pkg_config_name", f"tinyobjloader{suffix}") + self.cpp_info.libs = [f"tinyobjloader{suffix}"] if self.options.double: self.cpp_info.defines.append("TINYOBJLOADER_USE_DOUBLE") # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - self.cpp_info.names["pkg_config"] = "tinyobjloader{}".format(suffix) diff --git a/recipes/tinyobjloader/all/patches/1.0.x-0001-cmake-minimum-required.patch b/recipes/tinyobjloader/all/patches/1.0.x-0001-cmake-minimum-required.patch new file mode 100644 index 00000000000000..aafa055df46bb4 --- /dev/null +++ b/recipes/tinyobjloader/all/patches/1.0.x-0001-cmake-minimum-required.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,8 +1,8 @@ + #Tiny Object Loader Cmake configuration file. + #This configures the Cmake system with multiple properties, depending + #on the platform and configuration it is set to build in. ++cmake_minimum_required(VERSION 3.1) + project(tinyobjloader) +-cmake_minimum_required(VERSION 2.8.11) + set(TINYOBJLOADER_SOVERSION 1) + set(TINYOBJLOADER_VERSION 1.0.4) + diff --git a/recipes/tinyobjloader/all/patches/2.0.0-rc10-0001-cmake-minimum-required.patch b/recipes/tinyobjloader/all/patches/2.0.0-rc10-0001-cmake-minimum-required.patch new file mode 100644 index 00000000000000..a2d751763b9404 --- /dev/null +++ b/recipes/tinyobjloader/all/patches/2.0.0-rc10-0001-cmake-minimum-required.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,8 +1,8 @@ + #Tiny Object Loader Cmake configuration file. + #This configures the Cmake system with multiple properties, depending + #on the platform and configuration it is set to build in. +-project(tinyobjloader) + cmake_minimum_required(VERSION 3.2) ++project(tinyobjloader) + set(TINYOBJLOADER_SOVERSION 2) + set(TINYOBJLOADER_VERSION 2.0.0-rc.10) + diff --git a/recipes/tinyobjloader/all/test_package/CMakeLists.txt b/recipes/tinyobjloader/all/test_package/CMakeLists.txt index c6aaba9ebe8754..05eed698062d78 100644 --- a/recipes/tinyobjloader/all/test_package/CMakeLists.txt +++ b/recipes/tinyobjloader/all/test_package/CMakeLists.txt @@ -1,23 +1,17 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -configure_file(cube.obj cube.obj COPYONLY) -configure_file(cube.mtl cube.mtl COPYONLY) +cmake_minimum_required(VERSION 3.7) +project(test_package LANGUAGES CXX) find_package(tinyobjloader REQUIRED CONFIG) -string(FIND "${CONAN_TINYOBJLOADER_ROOT}" "2." IS_2x) -if ("${IS_2x}" EQUAL "-1") - add_executable(${PROJECT_NAME} test_package_1.cpp) +add_executable(${PROJECT_NAME} test_package.cpp) +if(TARGET tinyobjloader::tinyobjloader_double) + target_link_libraries(${PROJECT_NAME} PRIVATE tinyobjloader::tinyobjloader_double) else() - add_executable(${PROJECT_NAME} test_package_2.cpp) + target_link_libraries(${PROJECT_NAME} PRIVATE tinyobjloader::tinyobjloader) endif() - -if(TARGET tinyobjloader_double) - target_link_libraries(${PROJECT_NAME} tinyobjloader_double) -else() - target_link_libraries(${PROJECT_NAME} tinyobjloader) +if(tinyobjloader_VERSION VERSION_GREATER_EQUAL "1.0.7") + target_compile_definitions(${PROJECT_NAME} PRIVATE TINYOBJLOADER_GE_1_0_7) +endif() +if(tinyobjloader_VERSION VERSION_GREATER_EQUAL "2") + target_compile_definitions(${PROJECT_NAME} PRIVATE TINYOBJLOADER_GE_2) endif() diff --git a/recipes/tinyobjloader/all/test_package/conanfile.py b/recipes/tinyobjloader/all/test_package/conanfile.py index 49a3a66ea5bad4..ba7f5d3e170c1a 100644 --- a/recipes/tinyobjloader/all/test_package/conanfile.py +++ b/recipes/tinyobjloader/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + obj_path = os.path.join(self.source_folder, "cube.obj") + mtl_dir = os.path.join(self.source_folder, "") + self.run(f"{bin_path} {obj_path} {mtl_dir}", env="conanrun") diff --git a/recipes/tinyobjloader/all/test_package/test_package_2.cpp b/recipes/tinyobjloader/all/test_package/test_package.cpp similarity index 50% rename from recipes/tinyobjloader/all/test_package/test_package_2.cpp rename to recipes/tinyobjloader/all/test_package/test_package.cpp index 00b10dbabe2096..886f96cfb34298 100644 --- a/recipes/tinyobjloader/all/test_package/test_package_2.cpp +++ b/recipes/tinyobjloader/all/test_package/test_package.cpp @@ -1,20 +1,42 @@ #include -#include + #include +#include +#include -int main (void) +int main(int argc, char **argv) { + if (argc < 3) { + std::cerr << "Need at least two arguments" << std::endl; + return 1; + } + +#ifdef TINYOBJLOADER_GE_2 + tinyobj::ObjReaderConfig config; + config.mtl_search_path = argv[2]; + + tinyobj::ObjReader reader; + reader.ParseFromFile(argv[1], config); +#else tinyobj::attrib_t attrib; std::vector shapes; std::vector materials; +#ifdef TINYOBJLOADER_GE_1_0_7 std::string warn; +#endif std::string err; bool ret = tinyobj::LoadObj( - &attrib, &shapes, &materials, &warn, &err, "cube.obj"); + &attrib, &shapes, &materials, +#ifdef TINYOBJLOADER_GE_1_0_7 + &warn, +#endif + &err, argv[1], argv[2]); +#ifdef TINYOBJLOADER_GE_1_0_7 if (!warn.empty()) { std::cout << "WARN: " << warn << std::endl; } +#endif if (!err.empty()) { std::cerr << "ERR: " << err << std::endl; @@ -24,6 +46,7 @@ int main (void) std::cerr << "Failed to load/parse .obj" << std::endl; return 1; } +#endif return 0; } diff --git a/recipes/tinyobjloader/all/test_package/test_package_1.cpp b/recipes/tinyobjloader/all/test_package/test_package_1.cpp deleted file mode 100644 index 5f572e6c88eb93..00000000000000 --- a/recipes/tinyobjloader/all/test_package/test_package_1.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -int main (void) -{ - tinyobj::attrib_t attrib; - std::vector shapes; - std::vector materials; - std::string err; - bool ret = tinyobj::LoadObj( - &attrib, &shapes, &materials, &err, "cube.obj"); - - if (!err.empty()) { - std::cerr << "ERR: " << err << std::endl; - } - - if (!ret) { - std::cerr << "Failed to load/parse .obj" << std::endl; - return 1; - } - - return 0; -} diff --git a/recipes/tinyobjloader/all/test_v1_package/CMakeLists.txt b/recipes/tinyobjloader/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/tinyobjloader/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinyobjloader/all/test_v1_package/conanfile.py b/recipes/tinyobjloader/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..159afa2f8c3405 --- /dev/null +++ b/recipes/tinyobjloader/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + res_dir = os.path.join(self.source_folder, os.pardir, "test_package") + obj_path = os.path.join(res_dir, "cube.obj") + mtl_dir = os.path.join(res_dir, "") + self.run(f"{bin_path} {obj_path} {mtl_dir}", run_environment=True) diff --git a/recipes/tinyobjloader/config.yml b/recipes/tinyobjloader/config.yml index c8c4465c974158..a6a9ff8a03a2ab 100644 --- a/recipes/tinyobjloader/config.yml +++ b/recipes/tinyobjloader/config.yml @@ -1,3 +1,7 @@ versions: + "2.0.0-rc10": + folder: all + "1.0.7": + folder: all "1.0.6": folder: all From e91bc534fb911ab656de76ec41b39328ed2f12e9 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 15:44:48 +0200 Subject: [PATCH 160/300] (#13689) tinyxml: conan v2 support * conan v2 support * drop msvc shared --- recipes/tinyxml/all/CMakeLists.txt | 36 ++++----- recipes/tinyxml/all/conanfile.py | 74 +++++++++++-------- .../tinyxml/all/test_package/CMakeLists.txt | 7 +- recipes/tinyxml/all/test_package/conanfile.py | 21 ++++-- .../all/test_v1_package/CMakeLists.txt | 10 +++ .../tinyxml/all/test_v1_package/conanfile.py | 17 +++++ 6 files changed, 102 insertions(+), 63 deletions(-) create mode 100644 recipes/tinyxml/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/tinyxml/all/test_v1_package/conanfile.py diff --git a/recipes/tinyxml/all/CMakeLists.txt b/recipes/tinyxml/all/CMakeLists.txt index 513e8c93e18586..c8bf6c2939aa71 100644 --- a/recipes/tinyxml/all/CMakeLists.txt +++ b/recipes/tinyxml/all/CMakeLists.txt @@ -1,35 +1,27 @@ cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() +project(tinyxml LANGUAGES CXX) option(TINYXML_WITH_STL "Compile TinyXML with STL" OFF) -set(SOURCE_SUBFOLDER "source_subfolder") - -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - set(TINYXML_HDRS - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinystr.h - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinyxml.h) + ${TINYXML_SRC_DIR}/tinystr.h + ${TINYXML_SRC_DIR}/tinyxml.h) set(TINYXML_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinystr.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinyxml.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinyxmlerror.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinyxmlparser.cpp) + ${TINYXML_SRC_DIR}/tinystr.cpp + ${TINYXML_SRC_DIR}/tinyxml.cpp + ${TINYXML_SRC_DIR}/tinyxmlerror.cpp + ${TINYXML_SRC_DIR}/tinyxmlparser.cpp) -add_library(tinyxml STATIC ${TINYXML_SRCS}) -target_include_directories(tinyxml PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}) +add_library(tinyxml ${TINYXML_SRCS}) +target_include_directories(tinyxml PUBLIC ${TINYXML_SRC_DIR}) if(TINYXML_WITH_STL) target_compile_definitions(tinyxml PUBLIC TIXML_USE_STL) endif() +include(GNUInstallDirs) install(TARGETS tinyxml - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) -install(FILES ${TINYXML_HDRS} DESTINATION include) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES ${TINYXML_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/tinyxml/all/conanfile.py b/recipes/tinyxml/all/conanfile.py index bd887d9df371d0..b6d3aba1021b42 100644 --- a/recipes/tinyxml/all/conanfile.py +++ b/recipes/tinyxml/all/conanfile.py @@ -1,74 +1,86 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import get, save +from conan.tools.microsoft import is_msvc import os -from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.47.0" + class TinyXmlConan(ConanFile): name = "tinyxml" description = "TinyXML is a simple, small, C++ XML parser that can be easily integrated into other programs." license = "Zlib" - topics = ("conan", "tinyxml", "xml", "parser") + topics = ("xml", "parser") homepage = "http://www.grinninglizard.com/tinyxml/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "CMakeLists.txt" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" options = { + "shared": [True, False], "fPIC": [True, False], "with_stl": [True, False], } default_options = { + "shared": False, "fPIC": True, "with_stl": False, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + exports_sources = "CMakeLists.txt" def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("tinyxml", self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TINYXML_WITH_STL"] = self.options.with_stl - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TINYXML_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["TINYXML_WITH_STL"] = self.options.with_stl + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def _extract_license(self): - with open(os.path.join(self._source_subfolder, "tinyxml.h")) as f: + with open(os.path.join(self.source_folder, "tinyxml.h")) as f: content_lines = f.readlines() license_content = [] for i in range(2, 22): license_content.append(content_lines[i][:-1]) - tools.save("LICENSE", "\n".join(license_content)) - + return "\n".join(license_content) def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + cmake = CMake(self) cmake.install() - self._extract_license() - self.copy(pattern="LICENSE", dst="licenses") def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["tinyxml"] if self.options.with_stl: self.cpp_info.defines = ["TIXML_USE_STL"] + + # TODO: to remove in conan v2, and do not port these names to CMakeDeps, it was a mistake self.cpp_info.names["cmake_find_package"] = "TinyXML" self.cpp_info.names["cmake_find_package_multi"] = "TinyXML" diff --git a/recipes/tinyxml/all/test_package/CMakeLists.txt b/recipes/tinyxml/all/test_package/CMakeLists.txt index 196188113685c8..f35c28e75d81cc 100644 --- a/recipes/tinyxml/all/test_package/CMakeLists.txt +++ b/recipes/tinyxml/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(tinyxml REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE tinyxml::tinyxml) diff --git a/recipes/tinyxml/all/test_package/conanfile.py b/recipes/tinyxml/all/test_package/conanfile.py index ea57a464900be9..0a6bc68712d901 100644 --- a/recipes/tinyxml/all/test_package/conanfile.py +++ b/recipes/tinyxml/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tinyxml/all/test_v1_package/CMakeLists.txt b/recipes/tinyxml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..f0821ea56fd5b9 --- /dev/null +++ b/recipes/tinyxml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(TinyXML REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE TinyXML::TinyXML) diff --git a/recipes/tinyxml/all/test_v1_package/conanfile.py b/recipes/tinyxml/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/tinyxml/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From b9c1ffb8c455fe079a68d3b312a5c23b4a6b411a Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 16:08:25 +0200 Subject: [PATCH 161/300] (#13698) opencl-headers: add 2022.09.30 * add opencl-headers/2022.09.30 * cleanup a little bit --- recipes/opencl-headers/all/conandata.yml | 3 +++ recipes/opencl-headers/all/conanfile.py | 12 ++++-------- recipes/opencl-headers/all/test_package/conanfile.py | 7 ++++--- .../all/test_v1_package/CMakeLists.txt | 8 +++----- recipes/opencl-headers/config.yml | 2 ++ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/recipes/opencl-headers/all/conandata.yml b/recipes/opencl-headers/all/conandata.yml index 1fa22044b31c04..bc33b51742e453 100644 --- a/recipes/opencl-headers/all/conandata.yml +++ b/recipes/opencl-headers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2022.09.30": + url: "https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2022.09.30.tar.gz" + sha256: "0ae857ecb28af95a420c800b21ed2d0f437503e104f841ab8db249df5f4fbe5c" "2022.05.18": url: "https://github.com/KhronosGroup/OpenCL-Headers/archive/v2022.05.18.tar.gz" sha256: "88a1177853b279eaf574e2aafad26a84be1a6f615ab1b00c20d5af2ace95c42e" diff --git a/recipes/opencl-headers/all/conanfile.py b/recipes/opencl-headers/all/conanfile.py index 818ee5e05bd79c..3e936c8d7457e6 100644 --- a/recipes/opencl-headers/all/conanfile.py +++ b/recipes/opencl-headers/all/conanfile.py @@ -10,18 +10,18 @@ class OpenclHeadersConan(ConanFile): name = "opencl-headers" description = "C language headers for the OpenCL API" license = "Apache-2.0" - topics = ("opencl-headers", "opencl", "header-only", "api-headers") + topics = ("opencl", "header-only", "api-headers") homepage = "https://github.com/KhronosGroup/OpenCL-Headers" 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() - def layout(self): basic_layout(self, src_folder="src") + def package_id(self): + self.info.clear() + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -38,9 +38,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "OpenCL::Headers") self.cpp_info.set_property("pkg_config_name", "OpenCL") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "OpenCLHeaders" @@ -53,6 +51,4 @@ def package_info(self): self.cpp_info.components["_opencl-headers"].set_property("cmake_target_name", "OpenCL::Headers") self.cpp_info.components["_opencl-headers"].set_property("pkg_config_name", "OpenCL") self.cpp_info.components["_opencl-headers"].bindirs = [] - self.cpp_info.components["_opencl-headers"].frameworkdirs = [] self.cpp_info.components["_opencl-headers"].libdirs = [] - self.cpp_info.components["_opencl-headers"].resdirs = [] diff --git a/recipes/opencl-headers/all/test_package/conanfile.py b/recipes/opencl-headers/all/test_package/conanfile.py index d120a992c06a69..0a6bc68712d901 100644 --- a/recipes/opencl-headers/all/test_package/conanfile.py +++ b/recipes/opencl-headers/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/opencl-headers/all/test_v1_package/CMakeLists.txt b/recipes/opencl-headers/all/test_v1_package/CMakeLists.txt index 0fb6ffa063526c..0d20897301b68b 100644 --- a/recipes/opencl-headers/all/test_v1_package/CMakeLists.txt +++ b/recipes/opencl-headers/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(OpenCLHeaders REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE OpenCL::Headers) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencl-headers/config.yml b/recipes/opencl-headers/config.yml index 20c740973773ea..ce621bb7cdbe5c 100644 --- a/recipes/opencl-headers/config.yml +++ b/recipes/opencl-headers/config.yml @@ -1,4 +1,6 @@ versions: + "2022.09.30": + folder: all "2022.05.18": folder: all "2022.01.04": From 2f236d83bf5422decdf7b0fbcf0da62320261cdb Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 24 Oct 2022 23:24:49 +0900 Subject: [PATCH 162/300] (#13693) tscns: add recipe * tscns: add recipe * add new line and delete empty line * include cstdint for int64_t * support gcc 5 * add C++11 validation * use target_compile_features * add patch for older compiler support --- recipes/tscns/all/conandata.yml | 15 +++++ recipes/tscns/all/conanfile.py | 56 +++++++++++++++++++ .../all/patches/0001-include-thread.patch | 12 ++++ .../patches/0002-support-older-compiler.patch | 13 +++++ recipes/tscns/all/test_package/CMakeLists.txt | 8 +++ recipes/tscns/all/test_package/conanfile.py | 26 +++++++++ .../tscns/all/test_package/test_package.cpp | 23 ++++++++ .../tscns/all/test_v1_package/CMakeLists.txt | 11 ++++ .../tscns/all/test_v1_package/conanfile.py | 17 ++++++ recipes/tscns/config.yml | 3 + 10 files changed, 184 insertions(+) create mode 100644 recipes/tscns/all/conandata.yml create mode 100644 recipes/tscns/all/conanfile.py create mode 100644 recipes/tscns/all/patches/0001-include-thread.patch create mode 100644 recipes/tscns/all/patches/0002-support-older-compiler.patch create mode 100644 recipes/tscns/all/test_package/CMakeLists.txt create mode 100644 recipes/tscns/all/test_package/conanfile.py create mode 100644 recipes/tscns/all/test_package/test_package.cpp create mode 100644 recipes/tscns/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/tscns/all/test_v1_package/conanfile.py create mode 100644 recipes/tscns/config.yml diff --git a/recipes/tscns/all/conandata.yml b/recipes/tscns/all/conandata.yml new file mode 100644 index 00000000000000..953de473617556 --- /dev/null +++ b/recipes/tscns/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + # upstream don't create tag for releases + "2.0": + url: "https://github.com/MengRao/tscns/archive/40240b92fc9431710005faccb422d3dbdcb324dd.tar.gz" + sha256: "5564f9984e7984a68b767ed44acc70ba605300511bcd7673aa46c207e907263d" + +patches: + "2.0": + - patch_file: "patches/0001-include-thread.patch" + patch_description: "include thread header (this patch is already applied upstream)" + patch_type: "backport" + patch_source: "https://github.com/MengRao/tscns/commit/3d9179de9af88358eef66d9f03c8e2126d35296a" + - patch_file: "patches/0002-support-older-compiler.patch" + patch_description: "support older compiler by fix initializer" + patch_type: "backport" diff --git a/recipes/tscns/all/conanfile.py b/recipes/tscns/all/conanfile.py new file mode 100644 index 00000000000000..f9a1b573dbe33f --- /dev/null +++ b/recipes/tscns/all/conanfile.py @@ -0,0 +1,56 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout + +import os + +required_conan_version = ">=1.52.0" + +class TscnsConan(ConanFile): + name = "tscns" + description = "A low overhead nanosecond clock based on x86 TSC" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/MengRao/tscns/" + topics = ("timestamp", "x86_64", "header-only") + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.arch != "x86_64": + raise ConanInvalidConfiguration(f"{self.ref} supports x86_64 only.") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="tscns.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/tscns/all/patches/0001-include-thread.patch b/recipes/tscns/all/patches/0001-include-thread.patch new file mode 100644 index 00000000000000..5a125217b7fa07 --- /dev/null +++ b/recipes/tscns/all/patches/0001-include-thread.patch @@ -0,0 +1,12 @@ +diff --git a/tscns.h b/tscns.h +index e66153d..a7c9a73 100644 +--- a/tscns.h ++++ b/tscns.h +@@ -25,6 +25,7 @@ SOFTWARE. + #pragma once + #include + #include ++#include + + #ifdef _MSC_VER + #include diff --git a/recipes/tscns/all/patches/0002-support-older-compiler.patch b/recipes/tscns/all/patches/0002-support-older-compiler.patch new file mode 100644 index 00000000000000..078437e591d8fa --- /dev/null +++ b/recipes/tscns/all/patches/0002-support-older-compiler.patch @@ -0,0 +1,13 @@ +diff --git a/tscns.h b/tscns.h +index e66153d..a7c9a73 100644 +--- a/tscns.h ++++ b/tscns.h +@@ -139,7 +139,7 @@ public: + param_seq.store(++seq, std::memory_order_release); + } + +- alignas(64) std::atomic param_seq = 0; ++ alignas(64) std::atomic param_seq{0}; + double ns_per_tsc = 1.0; + int64_t ns_offset = 0; + int64_t calibate_interval_ns; diff --git a/recipes/tscns/all/test_package/CMakeLists.txt b/recipes/tscns/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..46909114bb6571 --- /dev/null +++ b/recipes/tscns/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(tscns REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tscns::tscns) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tscns/all/test_package/conanfile.py b/recipes/tscns/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/tscns/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tscns/all/test_package/test_package.cpp b/recipes/tscns/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..2383256ac42ac1 --- /dev/null +++ b/recipes/tscns/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include + +#include "tscns.h" + +int main() { + TSCNS tn; + tn.init(); + + std::cout << tn.getTscGhz() << std::endl; + + uint64_t count = (tn.rdns() % 100u) + 1; + + uint64_t tsc1 = tn.rdtsc(); + int total = 0; + while (count-- > 0) { + total += count; + } + uint64_t tsc2 = tn.rdtsc(); + + std::cout << (tn.tsc2ns(tsc2) - tn.tsc2ns(tsc1)) << " ns" << std::endl; + + return 0; +} diff --git a/recipes/tscns/all/test_v1_package/CMakeLists.txt b/recipes/tscns/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..eebfbab4ba7b5f --- /dev/null +++ b/recipes/tscns/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tscns REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tscns::tscns) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tscns/all/test_v1_package/conanfile.py b/recipes/tscns/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/tscns/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tscns/config.yml b/recipes/tscns/config.yml new file mode 100644 index 00000000000000..eab700ad534a3f --- /dev/null +++ b/recipes/tscns/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0": + folder: all From 1dc0ab45691eaa768d6c781ae35529e380de39ff Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 16:46:50 +0200 Subject: [PATCH 163/300] (#13707) blend2d: more conan v2 stuff & fix improper imports - fix improper imports of conan v2 features - use export_conandata_patches - remove CMakeLists wrapper - get_safe of compiler.cppstd - inject BL_STATIC with tc.preprocessor_definitions - explicit cmake names - use can_run in test package - avoid duplication of CMake code logic in test v1 package --- recipes/blend2d/all/CMakeLists.txt | 7 --- recipes/blend2d/all/conanfile.py | 63 +++++++++---------- .../blend2d/all/test_package/CMakeLists.txt | 2 +- recipes/blend2d/all/test_package/conanfile.py | 11 ++-- .../all/test_v1_package/CMakeLists.txt | 11 ++-- .../blend2d/all/test_v1_package/conanfile.py | 4 +- 6 files changed, 43 insertions(+), 55 deletions(-) delete mode 100644 recipes/blend2d/all/CMakeLists.txt diff --git a/recipes/blend2d/all/CMakeLists.txt b/recipes/blend2d/all/CMakeLists.txt deleted file mode 100644 index 0839374b3b5f4d..00000000000000 --- a/recipes/blend2d/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper LANGUAGES CXX) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -set(CMAKE_CXX_STANDARD 11) - -add_subdirectory(src) diff --git a/recipes/blend2d/all/conanfile.py b/recipes/blend2d/all/conanfile.py index 215edc5b728db8..0a668681e0e114 100644 --- a/recipes/blend2d/all/conanfile.py +++ b/recipes/blend2d/all/conanfile.py @@ -1,15 +1,12 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import check_min_vs import os -from conan import ConanFile -from conan import tools -from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout -from conan.tools.scm import Version -from conan.tools.files import apply_conandata_patches -from conan.tools.microsoft import is_msvc -from conan.errors import ConanInvalidConfiguration +required_conan_version = ">=1.52.0" -required_conan_version = ">=1.50.0" class Blend2dConan(ConanFile): name = "blend2d" @@ -29,9 +26,7 @@ class Blend2dConan(ConanFile): } def export_sources(self): - tools.files.copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - tools.files.copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,37 +34,41 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def layout(self): - cmake_layout(self, src_folder='src') + cmake_layout(self, src_folder="src") def requirements(self): self.requires("asmjit/cci.20220210") def validate(self): - if self.info.settings.compiler.cppstd: + if self.info.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) # In Visual Studio < 16, there are compilation error. patch is already provided. # https://github.com/blend2d/blend2d/commit/63db360c7eb2c1c3ca9cd92a867dbb23dc95ca7d - if is_msvc(self) and Version(self.settings.compiler.version) < "16": - raise ConanInvalidConfiguration("This recipe does not support this compiler version") + check_min_vs(self, 192) def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): - toolchain = CMakeToolchain(self) - toolchain.variables["BUILD_TESTING"] = False - toolchain.variables["BLEND2D_TEST"] = False - toolchain.variables["BLEND2D_EMBED"] = False - toolchain.variables["BLEND2D_STATIC"] = not self.options.shared - toolchain.variables["BLEND2D_NO_STDCXX"] = False + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["BLEND2D_TEST"] = False + tc.variables["BLEND2D_EMBED"] = False + tc.variables["BLEND2D_STATIC"] = not self.options.shared + tc.variables["BLEND2D_NO_STDCXX"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if not valid_min_cppstd(self, 11): + tc.variables["CMAKE_CXX_STANDARD"] = 11 if not self.options.shared: - toolchain.variables["CMAKE_C_FLAGS"] = "-DBL_STATIC" - toolchain.variables["CMAKE_CXX_FLAGS"] = "-DBL_STATIC" - toolchain.generate() + tc.preprocessor_definitions["BL_STATIC"] = "1" + tc.generate() deps = CMakeDeps(self) deps.generate() @@ -77,20 +76,20 @@ def generate(self): def build(self): apply_conandata_patches(self) cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.configure() cmake.build() def package(self): - tools.files.copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "blend2d") + self.cpp_info.set_property("cmake_target_name", "blend2d::blend2d") self.cpp_info.libs = ["blend2d"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["pthread", "rt",]) if not self.options.shared: self.cpp_info.defines.append("BL_STATIC") - - self.cpp_info.requires.append("asmjit::asmjit") diff --git a/recipes/blend2d/all/test_package/CMakeLists.txt b/recipes/blend2d/all/test_package/CMakeLists.txt index 345822c0de7cba..7ac05ac9286e73 100644 --- a/recipes/blend2d/all/test_package/CMakeLists.txt +++ b/recipes/blend2d/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(blend2d CONFIG REQUIRED) diff --git a/recipes/blend2d/all/test_package/conanfile.py b/recipes/blend2d/all/test_package/conanfile.py index 3a8c6c5442b33b..0a6bc68712d901 100644 --- a/recipes/blend2d/all/test_package/conanfile.py +++ b/recipes/blend2d/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/blend2d/all/test_v1_package/CMakeLists.txt b/recipes/blend2d/all/test_v1_package/CMakeLists.txt index e215fae6aabbd4..0d20897301b68b 100644 --- a/recipes/blend2d/all/test_v1_package/CMakeLists.txt +++ b/recipes/blend2d/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(blend2d CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE blend2d::blend2d) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/blend2d/all/test_v1_package/conanfile.py b/recipes/blend2d/all/test_v1_package/conanfile.py index 1dab42df853ca8..38f4483872d47f 100644 --- a/recipes/blend2d/all/test_v1_package/conanfile.py +++ b/recipes/blend2d/all/test_v1_package/conanfile.py @@ -1,7 +1,5 @@ -# pylint: skip-file -import os - from conans import ConanFile, CMake, tools +import os class TestPackageConan(ConanFile): From 3acf79c5bc98a7bb1ba678e6ee18e5e41bf4ef5e Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 17:06:10 +0200 Subject: [PATCH 164/300] (#13709) cpputest: conan v2 support * conan v2 support * fix cmake --- recipes/cpputest/all/CMakeLists.txt | 7 -- recipes/cpputest/all/conandata.yml | 4 ++ recipes/cpputest/all/conanfile.py | 71 +++++++++---------- .../cpputest/all/patches/0001-fix-cmake.patch | 15 ++++ .../cpputest/all/test_package/CMakeLists.txt | 9 +-- .../cpputest/all/test_package/conanfile.py | 33 ++++++--- .../all/test_v1_package/CMakeLists.txt | 8 +++ .../cpputest/all/test_v1_package/conanfile.py | 21 ++++++ 8 files changed, 105 insertions(+), 63 deletions(-) delete mode 100644 recipes/cpputest/all/CMakeLists.txt create mode 100644 recipes/cpputest/all/patches/0001-fix-cmake.patch create mode 100644 recipes/cpputest/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/cpputest/all/test_v1_package/conanfile.py diff --git a/recipes/cpputest/all/CMakeLists.txt b/recipes/cpputest/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9a..00000000000000 --- a/recipes/cpputest/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/cpputest/all/conandata.yml b/recipes/cpputest/all/conandata.yml index 09eda2464fea7c..6511c1a3d01886 100644 --- a/recipes/cpputest/all/conandata.yml +++ b/recipes/cpputest/all/conandata.yml @@ -2,3 +2,7 @@ sources: "4.0": url: "https://github.com/cpputest/cpputest/releases/download/v4.0/cpputest-4.0.tar.gz" sha256: 21c692105db15299b5529af81a11a7ad80397f92c122bd7bf1e4a4b0e85654f7 +patches: + "4.0": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "CMake: move cmake_minimum_required() before project()" diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index da85e23f49b83e..ee586cab99d827 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -1,10 +1,10 @@ -from conans import CMake from conan import ConanFile -from conan import tools +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class CppUTestConan(ConanFile): @@ -32,51 +32,44 @@ class CppUTestConan(ConanFile): "with_leak_detection": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["STD_C"] = True + tc.variables["STD_CPP"] = True + tc.variables["C++11"] = True + tc.variables["MEMORY_LEAK_DETECTION"] = self.options.with_leak_detection + tc.variables["EXTENSIONS"] = self.options.with_extensions + tc.variables["LONGLONG"] = True + tc.variables["COVERAGE"] = False + tc.variables["TESTS"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["STD_C"] = "ON" - self._cmake.definitions["STD_CPP"] = "ON" - self._cmake.definitions["C++11"] = "ON" - self._cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.with_leak_detection - self._cmake.definitions["EXTENSIONS"] = self.options.with_extensions - self._cmake.definitions["LONGLONG"] = "ON" - self._cmake.definitions["COVERAGE"] = "OFF" - self._cmake.definitions["TESTS"] = "OFF" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "CppUTest")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "CppUTest")) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self._create_cmake_module_alias_targets( @@ -90,13 +83,13 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.files.save(self, module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): diff --git a/recipes/cpputest/all/patches/0001-fix-cmake.patch b/recipes/cpputest/all/patches/0001-fix-cmake.patch new file mode 100644 index 00000000000000..a40096caf1d6d2 --- /dev/null +++ b/recipes/cpputest/all/patches/0001-fix-cmake.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,3 +1,4 @@ ++cmake_minimum_required(VERSION 3.1) + project(CppUTest) + + set(CppUTest_version_major 4) +@@ -5,7 +6,6 @@ set(CppUTest_version_minor 0) + + # 2.6.3 is needed for ctest support + # 3.1 is needed for target_sources +-cmake_minimum_required(VERSION 3.1) + + ############### + # Conan support diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt index 969978c25106c8..be713b804677f3 100644 --- a/recipes/cpputest/all/test_package/CMakeLists.txt +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(CppUTest REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package CppUTest) +target_link_libraries(test_package PRIVATE CppUTest) if(WITH_EXTENSIONS) add_executable(test_package_with_extensions test_package_with_extensions.cpp) - target_link_libraries(test_package_with_extensions CppUTestExt) + target_link_libraries(test_package_with_extensions PRIVATE CppUTestExt) endif() diff --git a/recipes/cpputest/all/test_package/conanfile.py b/recipes/cpputest/all/test_package/conanfile.py index 95ba20dea51741..f422d1c08f29f5 100644 --- a/recipes/cpputest/all/test_package/conanfile.py +++ b/recipes/cpputest/all/test_package/conanfile.py @@ -1,23 +1,34 @@ -from conans import CMake -from conan import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_EXTENSIONS"] = self.dependencies["cpputest"].options.with_extensions + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_EXTENSIONS"] = self.options["cpputest"].with_extensions cmake.configure() cmake.build() def test(self): - if tools.build.cross_building(self): - return - - self.run(os.path.join("bin", "test_package"), run_environment=True) - - if self.options["cpputest"].with_extensions: - self.run(os.path.join("bin", "test_package_with_extensions"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + if self.options["cpputest"].with_extensions: + bin_extensions_path = os.path.join(self.cpp.build.bindirs[0], "test_package_with_extensions") + self.run(bin_extensions_path, env="conanrun") diff --git a/recipes/cpputest/all/test_v1_package/CMakeLists.txt b/recipes/cpputest/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/cpputest/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpputest/all/test_v1_package/conanfile.py b/recipes/cpputest/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..cce86300f1595e --- /dev/null +++ b/recipes/cpputest/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_EXTENSIONS"] = self.options["cpputest"].with_extensions + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + if self.options["cpputest"].with_extensions: + bin_extensions_path = os.path.join("bin", "test_package_with_extensions") + self.run(bin_extensions_path, run_environment=True) From 35905b3ef19b5598950f5c4603e166c183e8d34f Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Mon, 24 Oct 2022 20:25:22 +0200 Subject: [PATCH 165/300] (#13684) libcurl: several fixes & bump dependencies * do not remove compiler from package id * bump dependencies * no need to copy dylib files of dependencies for conftest In case of native build, VirtualRunEnv in build scope is sufficient * fix install of autotools branch if build machine is windows * pass CACHE variables as cache_variables * protect deletion of options and settings * fix with_ca_bundle & with_ca_path options for conan v2 client * fix with_ca_bundle & with_ca_path mapping None is not False * properly package cacert.pem & define resdirs --- recipes/libcurl/all/conanfile.py | 100 +++++++++++++++---------------- 1 file changed, 48 insertions(+), 52 deletions(-) diff --git a/recipes/libcurl/all/conanfile.py b/recipes/libcurl/all/conanfile.py index 5c732a75e757f3..82f6473ce9b610 100644 --- a/recipes/libcurl/all/conanfile.py +++ b/recipes/libcurl/all/conanfile.py @@ -67,8 +67,8 @@ class LibcurlConan(ConanFile): "with_symbol_hiding": [True, False], "with_unix_sockets": [True, False], "with_verbose_strings": [True, False], - "with_ca_bundle": "ANY", - "with_ca_path": "ANY", + "with_ca_bundle": [None, "ANY"], + "with_ca_path": [None, "ANY"], } default_options = { "shared": False, @@ -158,9 +158,18 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass # These options are not used in CMake build yet if self._is_using_cmake_build: @@ -172,13 +181,13 @@ def requirements(self): if self.options.with_ssl == "openssl": self.requires("openssl/1.1.1q") elif self.options.with_ssl == "wolfssl": - self.requires("wolfssl/5.4.0") + self.requires("wolfssl/5.5.1") if self.options.with_nghttp2: - self.requires("libnghttp2/1.48.0") + self.requires("libnghttp2/1.49.0") if self.options.with_libssh2: self.requires("libssh2/1.10.0") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_brotli: self.requires("brotli/1.0.9") if self.options.get_safe("with_zstd"): @@ -186,9 +195,6 @@ def requirements(self): if self.options.with_c_ares: self.requires("c-ares/1.18.1") - def package_id(self): - del self.info.settings.compiler - def validate(self): if self.info.options.with_ssl == "schannel" and self.info.settings.os != "Windows": raise ConanInvalidConfiguration("schannel only suppported on Windows.") @@ -204,14 +210,14 @@ def validate(self): def build_requirements(self): if self._is_using_cmake_build: if self._is_win_x_android: - self.tool_requires("ninja/1.11.0") + self.tool_requires("ninja/1.11.1") else: - self.tool_requires("libtool/2.4.6") - if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") if self._settings_build.os == "Windows": self.win_bash = True - if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + if not self.conf.get("tools.microsoft.bash:path", check_type=str): self.tool_requires("msys2/cci.latest") def layout(self): @@ -226,27 +232,12 @@ def source(self): download(self, "https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True, sha256="2cff03f9efdaf52626bd1b451d700605dc1ea000c5da56bd0fc59f8f43071040") def generate(self): + env = VirtualBuildEnv(self) + env.generate() if self._is_using_cmake_build: self._generate_with_cmake() else: self._generate_with_autotools() - ms = VirtualBuildEnv(self) - ms.generate() - if not cross_building(self): - env = VirtualRunEnv(self) - env.generate(scope="build") - - # TODO: remove imports once rpath of shared libs of libcurl dependencies fixed on macOS - def imports(self): - # Copy shared libraries for dependencies to fix DYLD_LIBRARY_PATH problems - # - # Configure script creates conftest that cannot execute without shared openssl binaries. - # Ways to solve the problem: - # 1. set *LD_LIBRARY_PATH (works with Linux with RunEnvironment - # but does not work on OS X 10.11 with SIP) - # 2. copying dylib's to the build directory (fortunately works on OS X) - if self.settings.os == "Macos": - copy(self, "*.dylib*", src=self.build_folder, dst=self.source_folder, keep_path=False) def build(self): self._patch_sources() @@ -368,6 +359,10 @@ def _yes_no(self, value): return "yes" if value else "no" def _generate_with_autotools(self): + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) tc.configure_args.extend([ f"--with-libidn2={self._yes_no(self.options.with_libidn)}", @@ -456,15 +451,15 @@ def _generate_with_autotools(self): if not self.options.with_ntlm_wb: tc.configure_args.append("--disable-ntlm-wb") - if self.options.with_ca_bundle is False: + if self.options.with_ca_bundle: + tc.configure_args.append(f"--with-ca-bundle={str(self.options.with_ca_bundle)}") + else: tc.configure_args.append("--without-ca-bundle") - elif self.options.with_ca_bundle: - tc.configure_args.append("--with-ca-bundle=" + str(self.options.with_ca_bundle)) - if self.options.with_ca_path is False: - tc.configure_args.append('--without-ca-path') - elif self.options.with_ca_path: - tc.configure_args.append("--with-ca-path=" + str(self.options.with_ca_path)) + if self.options.with_ca_path: + tc.configure_args.append(f"--with-ca-path={str(self.options.with_ca_path)}") + else: + tc.configure_args.append("--without-ca-path") # Cross building flags if cross_building(self): @@ -501,7 +496,6 @@ def _generate_with_autotools(self): tc = AutotoolsDeps(self) tc.generate() - def _get_linux_arm_host(self): arch = None if self.settings.os == "Linux": @@ -577,28 +571,29 @@ def _generate_with_cmake(self): tc.variables["CURL_DISABLE_NTLM"] = True tc.variables["NTLM_WB_ENABLED"] = self.options.with_ntlm_wb - if self.options.with_ca_bundle is False: - tc.variables['CURL_CA_BUNDLE'] = 'none' - elif self.options.with_ca_bundle: - tc.variables['CURL_CA_BUNDLE'] = self.options.with_ca_bundle + if self.options.with_ca_bundle: + tc.cache_variables["CURL_CA_BUNDLE"] = str(self.options.with_ca_bundle) + else: + tc.cache_variables["CURL_CA_BUNDLE"] = "none" - if self.options.with_ca_path is False: - tc.variables['CURL_CA_PATH'] = 'none' - elif self.options.with_ca_path: - tc.variables['CURL_CA_PATH'] = self.options.with_ca_path + if self.options.with_ca_path: + tc.cache_variables["CURL_CA_PATH"] = str(self.options.with_ca_path) + else: + tc.cache_variables["CURL_CA_PATH"] = "none" tc.generate() def package(self): - copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - copy(self, pattern="cacert.pem", src=self.build_folder, dst="res") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "cacert.pem", src=self.source_folder, dst=os.path.join(self.package_folder, "res")) if self._is_using_cmake_build: cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) else: autotools = Autotools(self) - autotools.install() + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) fix_apple_shared_install_name(self) rmdir(self, os.path.join(self.package_folder, "share")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) @@ -615,6 +610,7 @@ def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("pkg_config_name", "libcurl") + self.cpp_info.components["curl"].resdirs = ["res"] if is_msvc(self): self.cpp_info.components["curl"].libs = ["libcurl_imp"] if self.options.shared else ["libcurl"] else: From 0bab4d3ce8a751edaa2fabad147bcb8bb9f25f5a Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Mon, 24 Oct 2022 15:46:16 -0500 Subject: [PATCH 166/300] (#13355) libffi: Support Conan V2 * Added Conan v2 support Based on this template: https://github.com/conan-io/conan-center-index/tree/master/docs/package_templates/autotools_package Contribute to CURA-9628 * catch ValueError instead of broad Exception catch Contributes to CURA-9628 * Validating not needed in this recipe Contributes to CURA-9628 * Clean-up various path references Contributes to CURA-9628 * Use modern apple rpath fix Contributes to CURA-9628 * Reapplied patches again Contributes to CURA-9628 * convert Path to str before passing to unix_path Contributes to CURA-9628 * Removed clang exception in generate Contributes to CURA-9628 * Use user_info.ar_lib as a workaround Should be reverted once https://github.com/conan-io/conan-center-index/pull/12898 has been merged Contribute to CURA-9628 and CURA-9575 * disable multi os directory when compiling with apple-clang Contributes to CURA-9628 * Use conf for AR variable Contributes to CURA-9628 * Slight clean up * Evaluate ar-lib path * Update recipes/libffi/all/conanfile.py Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * Move DLL's to the bin directory * Rename source folder to src * Small fixes * Fix renaming DLL's * Make bin directory * Be sure to set DISABLE_FFI_CALL properly * Remove stuff AutotoolsToolchain should set * Clean up compiler wrapper * Move VirtualBuildEnv before MSVC settings * Add missing generate method for toolchain * Use provided compile wrapper and add missing defines * Set build and host * Add architecture flags * Pass architecture flag to compiler wrapper * Fix for Clang on Windows * Use gnu-config * Fix copy-paste * Use cygwin triplet * Use the VCVars generator * Revert "Use cygwin triplet" This reverts commit 0ef94c6e07af1458ea561716d91495a9c1ea1050. * Revert "Use gnu-config" This reverts commit 79d2f4eacebb792b7cc731b379cbb1ed02ff34d0. * Fix wrapper * Define the assembler in the wrapper script * Remove VCVars * Use the toolchain's environment * Fix Windows to use wrapper script * Align with updated autotools template * Always define FFI_BUILDING * Don't define FFI_DEBUG * Try patching version 3.2.1 * Revert "Try patching version 3.2.1" This reverts commit f15d3e4e292e5b7edd5fd43ea0d1db7990b09783. * Drop version 3.2.1 This is no longer building and I don't know why. It's also from 2014, so hopefully it's okay to drop. * Clean up Co-authored-by: Jelle Spijker Co-authored-by: j.spijker@ultimaker.com Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/libffi/all/conandata.yml | 52 +--- recipes/libffi/all/conanfile.py | 266 +++++++++--------- .../0001-3.2.1-add-support-windows-dll.patch | 163 ----------- .../patches/0002-3.2.1-fix-libtool-path.patch | 20 -- .../0003-3.2.1-fix-win64-assembly.patch | 92 ------ .../0004-3.2.1-fix-complex-type-msvc.patch | 55 ---- ...raries-to-arch-dependent-directories.patch | 32 --- ...0006-3.2.1-library-no-version-suffix.patch | 11 - .../libffi/all/test_package/CMakeLists.txt | 13 +- recipes/libffi/all/test_package/conanfile.py | 32 ++- .../libffi/all/test_v1_package/CMakeLists.txt | 11 + .../libffi/all/test_v1_package/conanfile.py | 17 ++ recipes/libffi/config.yml | 2 - 13 files changed, 204 insertions(+), 562 deletions(-) delete mode 100644 recipes/libffi/all/patches/0001-3.2.1-add-support-windows-dll.patch delete mode 100644 recipes/libffi/all/patches/0002-3.2.1-fix-libtool-path.patch delete mode 100644 recipes/libffi/all/patches/0003-3.2.1-fix-win64-assembly.patch delete mode 100644 recipes/libffi/all/patches/0004-3.2.1-fix-complex-type-msvc.patch delete mode 100644 recipes/libffi/all/patches/0005-3.2.1-do-not-install-libraries-to-arch-dependent-directories.patch delete mode 100644 recipes/libffi/all/patches/0006-3.2.1-library-no-version-suffix.patch create mode 100644 recipes/libffi/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libffi/all/test_v1_package/conanfile.py diff --git a/recipes/libffi/all/conandata.yml b/recipes/libffi/all/conandata.yml index 4ce9946df3a326..869663acc18e9c 100644 --- a/recipes/libffi/all/conandata.yml +++ b/recipes/libffi/all/conandata.yml @@ -8,47 +8,19 @@ sources: "3.3": url: "https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz" sha256: "72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056" - "3.2.1": - url: "https://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz" - sha256: "d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37" patches: "3.4.3": - - base_path: "source_subfolder" - patch_file: "patches/0002-3.4.3-fix-libtool-path.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/0005-3.4.3-do-not-install-libraries-to-arch-dependent-directories.patch" - - base_path: "source_subfolder" - patch_file: "patches/0006-3.4.3-library-no-version-suffix.patch" + - patch_file: "patches/0002-3.4.3-fix-libtool-path.patch" + - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" + - patch_file: "patches/0005-3.4.3-do-not-install-libraries-to-arch-dependent-directories.patch" + - patch_file: "patches/0006-3.4.3-library-no-version-suffix.patch" "3.4.2": - - base_path: "source_subfolder" - patch_file: "patches/0002-3.4.2-fix-libtool-path.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/0005-3.4.2-do-not-install-libraries-to-arch-dependent-directories.patch" - - base_path: "source_subfolder" - patch_file: "patches/0006-3.4.2-library-no-version-suffix.patch" + - patch_file: "patches/0002-3.4.2-fix-libtool-path.patch" + - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" + - patch_file: "patches/0005-3.4.2-do-not-install-libraries-to-arch-dependent-directories.patch" + - patch_file: "patches/0006-3.4.2-library-no-version-suffix.patch" "3.3": - - base_path: "source_subfolder" - patch_file: "patches/0002-3.3-fix-libtool-path.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/0005-3.3-do-not-install-libraries-to-arch-dependent-directories.patch" - - base_path: "source_subfolder" - patch_file: "patches/0006-3.3-library-no-version-suffix.patch" - "3.2.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-3.2.1-add-support-windows-dll.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-3.2.1-fix-libtool-path.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-3.2.1-fix-win64-assembly.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-3.2.1-fix-complex-type-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/0005-3.2.1-do-not-install-libraries-to-arch-dependent-directories.patch" - - base_path: "source_subfolder" - patch_file: "patches/0006-3.2.1-library-no-version-suffix.patch" + - patch_file: "patches/0002-3.3-fix-libtool-path.patch" + - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" + - patch_file: "patches/0005-3.3-do-not-install-libraries-to-arch-dependent-directories.patch" + - patch_file: "patches/0006-3.3-library-no-version-suffix.patch" diff --git a/recipes/libffi/all/conanfile.py b/recipes/libffi/all/conanfile.py index 0c3c43ae18843e..fca2894b5fa7bc 100644 --- a/recipes/libffi/all/conanfile.py +++ b/recipes/libffi/all/conanfile.py @@ -1,20 +1,25 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, tools, AutoToolsBuildEnvironment -import contextlib +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, msvc_runtime_flag, unix_path +from conan.tools.scm import Version +import glob import os import shutil -required_conan_version = ">=1.36" +required_conan_version = ">=1.52.0" class LibffiConan(ConanFile): name = "libffi" description = "A portable, high level programming interface to various calling conventions" - topics = ("libffi", "runtime", "foreign-function-interface", "runtime-library") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://sourceware.org/libffi/" - license = "MIT" - + topics = ("runtime", "foreign-function-interface", "runtime-library") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,27 +30,13 @@ class LibffiConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): + # TODO: Remove for Conan v2 return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,133 +44,142 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - self.build_requires("gnu-config/cci.20201022") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") 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) - # Generate rpath friendly shared lib on macOS - configure_path = os.path.join(self._source_subfolder, "configure") - tools.replace_in_file(configure_path, "-install_name \\$rpath/", "-install_name @rpath/") - - if tools.Version(self.version) < "3.3": - if self.settings.compiler == "clang" and tools.Version(str(self.settings.compiler.version)) >= 7.0: - # https://android.googlesource.com/platform/external/libffi/+/ca22c3cb49a8cca299828c5ffad6fcfa76fdfa77 - sysv_s_src = os.path.join(self._source_subfolder, "src", "arm", "sysv.S") - tools.replace_in_file(sysv_s_src, "fldmiad", "vldmia") - tools.replace_in_file(sysv_s_src, "fstmiad", "vstmia") - tools.replace_in_file(sysv_s_src, "fstmfdd\tsp!,", "vpush") + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() - # https://android.googlesource.com/platform/external/libffi/+/7748bd0e4a8f7d7c67b2867a3afdd92420e95a9f - tools.replace_in_file(sysv_s_src, "stmeqia", "stmiaeq") - - @contextlib.contextmanager - def _build_context(self): - extra_env_vars = {} - if tools.os_info.is_windows and (self._is_msvc or self.settings.compiler == "clang") : - msvcc = tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "msvcc.sh")) - msvcc_args = [] - if self._is_msvc: - if self.settings.arch == "x86_64": - msvcc_args.append("-m64") - elif self.settings.arch == "x86": - msvcc_args.append("-m32") - elif self.settings.compiler == "clang": - msvcc_args.append("-clang-cl") - - if msvcc_args: - msvcc = "{} {}".format(msvcc, " ".join(msvcc_args)) - extra_env_vars.update(tools.vcvars_dict(self.settings)) - extra_env_vars.update({ - "INSTALL": tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "install-sh")), - "LIBTOOL": tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "ltmain.sh")), - "CC": msvcc, - "CXX": msvcc, - "LD": "link", - "CPP": "cl -nologo -EP", - "CXXCPP": "cl -nologo -EP", - }) - with tools.environment_append(extra_env_vars): - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) yes_no = lambda v: "yes" if v else "no" - config_args = [ - "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - self._autotools.defines.append("FFI_BUILDING") + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + f"--enable-debug={yes_no(self.settings.build_type == 'Debug')}", + "--enable-builddir=no", + "--enable-docs=no", + ]) + + if self._settings_build.compiler == "apple-clang": + tc.configure_args.append("--disable-multi-os-directory") + + tc.extra_defines.append("FFI_BUILDING") if self.options.shared: - self._autotools.defines.append("FFI_BUILDING_DLL") - if self._is_msvc: - if "MT" in msvc_runtime_flag(self): - self._autotools.defines.append("USE_STATIC_RTL") - if "d" in msvc_runtime_flag(self): - self._autotools.defines.append("USE_DEBUG_RTL") - build = None - host = None - if self._is_msvc: + tc.extra_defines.append("FFI_BUILDING_DLL") + + env = tc.environment() + if self._settings_build.os == "Windows" and (is_msvc(self) or self.settings.compiler == "clang"): build = "{}-{}-{}".format( "x86_64" if self._settings_build.arch == "x86_64" else "i686", - "pc" if self._settings_build.arch == "x86" else "w64", - "cygwin") + "pc" if self._settings_build.arch == "x86" else "win64", + "mingw64") host = "{}-{}-{}".format( "x86_64" if self.settings.arch == "x86_64" else "i686", - "pc" if self.settings.arch == "x86" else "w64", - "cygwin") - else: - if self._autotools.host and "x86-" in self._autotools.host: - self._autotools.host = self._autotools.host.replace("x86", "i686") - self._autotools.configure(args=config_args, configure_dir=self._source_subfolder, build=build, host=host) - return self._autotools + "pc" if self.settings.arch == "x86" else "win64", + "mingw64") + tc.configure_args.extend([ + f"--build={build}", + f"--host={host}", + ]) + + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + + if is_msvc_static_runtime(self): + tc.extra_defines.append("USE_STATIC_RTL") + if "d" in msvc_runtime_flag(self): + tc.extra_defines.append("USE_DEBUG_RTL") + + architecture_flag = "" + if is_msvc(self): + if self.settings.arch == "x86_64": + architecture_flag = "-m64" + elif self.settings.arch == "x86": + architecture_flag = "-m32" + elif self.settings.compiler == "clang": + architecture_flag = "-clang-cl" + + compile_wrapper = unix_path(self, os.path.join(self.source_folder, "msvcc.sh")) + if architecture_flag: + compile_wrapper = f"{compile_wrapper} {architecture_flag}" + # FIXME: Use the conf once https://github.com/conan-io/conan-center-index/pull/12898 is merged + # env.define("AR", f"{unix_path(self, self.conf.get('tools.automake:ar-lib'))}") + [version_major, version_minor, _] = self.dependencies.direct_build['automake'].ref.version.split(".", 2) + automake_version = f"{version_major}.{version_minor}" + ar_wrapper = unix_path(self, os.path.join(self.dependencies.direct_build['automake'].cpp_info.resdirs[0], f"automake-{automake_version}", "ar-lib")) + env.define("CC", f"{compile_wrapper}") + env.define("CXX", f"{compile_wrapper}") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.define("CXXCPP", "cl -nologo -EP") + env.define("CPP", "cl -nologo -EP") + env.define("LIBTOOL", unix_path(self, os.path.join(self.source_folder, "ltmain.sh"))) + env.define("INSTALL", unix_path(self, os.path.join(self.source_folder, "install-sh"))) + tc.generate(env=env) + + def _patch_source(self): + apply_conandata_patches(self) + + if Version(self.version) < "3.3": + if self.settings.compiler == "clang" and Version(str(self.settings.compiler.version)) >= 7.0: + # https://android.googlesource.com/platform/external/libffi/+/ca22c3cb49a8cca299828c5ffad6fcfa76fdfa77 + sysv_s_src = os.path.join(self.source_folder, "src", "arm", "sysv.S") + replace_in_file(self, sysv_s_src, "fldmiad", "vldmia") + replace_in_file(self, sysv_s_src, "fstmiad", "vstmia") + replace_in_file(self, sysv_s_src, "fstmfdd\tsp!,", "vpush") + + # https://android.googlesource.com/platform/external/libffi/+/7748bd0e4a8f7d7c67b2867a3afdd92420e95a9f + replace_in_file(self, sysv_s_src, "stmeqia", "stmiaeq") def build(self): - self._patch_sources() - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() - if tools.get_env("CONAN_RUN_TESTS", False): - autotools.make(target="check") + self._patch_source() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - if self._is_msvc: - if self.options.shared: - self.copy("libffi.dll", src=".libs", dst="bin") - self.copy("libffi.lib", src=".libs", dst="lib") - self.copy("*.h", src="include", dst="include") - else: - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + autotools = Autotools(self) + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) # Need to specify the `DESTDIR` as a Unix path, aware of the subsystem + fix_apple_shared_install_name(self) + mkdir(self, os.path.join(self.package_folder, "bin")) + for dll in glob.glob(os.path.join(self.package_folder, "lib", "*.dll")): + shutil.move(dll, os.path.join(self.package_folder, "bin")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.libs = ["{}ffi".format("lib" if is_msvc(self) else "")] self.cpp_info.set_property("pkg_config_name", "libffi") - self.cpp_info.libs = ["{}ffi".format("lib" if self._is_msvc else "")] if not self.options.shared: self.cpp_info.defines = ["FFI_BUILDING"] - diff --git a/recipes/libffi/all/patches/0001-3.2.1-add-support-windows-dll.patch b/recipes/libffi/all/patches/0001-3.2.1-add-support-windows-dll.patch deleted file mode 100644 index 91b34fdcb090a4..00000000000000 --- a/recipes/libffi/all/patches/0001-3.2.1-add-support-windows-dll.patch +++ /dev/null @@ -1,163 +0,0 @@ ---- include/ffi.h.in -+++ include/ffi.h.in -@@ -66,6 +66,18 @@ - - #include - -+#if defined _MSC_VER -+# if defined FFI_BUILDING_DLL /* Building libffi.DLL with msvcc.sh */ -+# define FFI_EXTERN __declspec(dllexport) -+# elif !defined FFI_BUILDING /* Importing libffi.DLL */ -+# define FFI_EXTERN __declspec(dllimport) -+# else -+# define FFI_EXTERN extern -+# endif -+#else -+# define FFI_EXTERN extern -+#endif -+ - #ifndef LIBFFI_ASM - - #if defined(_MSC_VER) && !defined(__clang__) -@@ -166,20 +180,6 @@ - #error "long size not supported" - #endif - --/* Need minimal decorations for DLLs to works on Windows. */ --/* GCC has autoimport and autoexport. Rely on Libtool to */ --/* help MSVC export from a DLL, but always declare data */ --/* to be imported for MSVC clients. This costs an extra */ --/* indirection for MSVC clients using the static version */ --/* of the library, but don't worry about that. Besides, */ --/* as a workaround, they can define FFI_BUILDING if they */ --/* *know* they are going to link with the static library. */ --#if defined _MSC_VER && !defined FFI_BUILDING --#define FFI_EXTERN extern __declspec(dllimport) --#else --#define FFI_EXTERN extern --#endif -- - /* These are defined in types.c */ - FFI_EXTERN ffi_type ffi_type_void; - FFI_EXTERN ffi_type ffi_type_uint8; -@@ -237,7 +237,7 @@ - #endif - - /* Used internally, but overridden by some architectures */ --ffi_status ffi_prep_cif_core(ffi_cif *cif, -+FFI_EXTERN ffi_status ffi_prep_cif_core(ffi_cif *cif, - ffi_abi abi, - unsigned int isvariadic, - unsigned int nfixedargs, -@@ -282,27 +282,27 @@ - #endif - - --void ffi_raw_call (ffi_cif *cif, -+FFI_EXTERN void ffi_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_raw *avalue); - --void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); --void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); --size_t ffi_raw_size (ffi_cif *cif); -+FFI_EXTERN void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); -+FFI_EXTERN void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); -+FFI_EXTERN size_t ffi_raw_size (ffi_cif *cif); - - /* This is analogous to the raw API, except it uses Java parameter */ - /* packing, even on 64-bit machines. I.e. on 64-bit machines */ - /* longs and doubles are followed by an empty 64-bit word. */ - --void ffi_java_raw_call (ffi_cif *cif, -+FFI_EXTERN void ffi_java_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_java_raw *avalue); - --void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); --void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); --size_t ffi_java_raw_size (ffi_cif *cif); -+FFI_EXTERN void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); -+FFI_EXTERN void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); -+FFI_EXTERN size_t ffi_java_raw_size (ffi_cif *cif); - - /* ---- Definitions for closures ----------------------------------------- */ - -@@ -330,16 +330,16 @@ - # endif - #endif - --void *ffi_closure_alloc (size_t size, void **code); --void ffi_closure_free (void *); -+FFI_EXTERN void *ffi_closure_alloc (size_t size, void **code); -+FFI_EXTERN void ffi_closure_free (void *); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_closure (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_closure_loc (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), -@@ -400,26 +400,26 @@ - - } ffi_java_raw_closure; - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_raw_closure (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_raw_closure_loc (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data, - void *codeloc); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_java_raw_closure (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), -@@ -430,20 +430,20 @@ - - /* ---- Public interface definition -------------------------------------- */ - --ffi_status ffi_prep_cif(ffi_cif *cif, -+FFI_EXTERN ffi_status ffi_prep_cif(ffi_cif *cif, - ffi_abi abi, - unsigned int nargs, - ffi_type *rtype, - ffi_type **atypes); - --ffi_status ffi_prep_cif_var(ffi_cif *cif, -+FFI_EXTERN ffi_status ffi_prep_cif_var(ffi_cif *cif, - ffi_abi abi, - unsigned int nfixedargs, - unsigned int ntotalargs, - ffi_type *rtype, - ffi_type **atypes); - --void ffi_call(ffi_cif *cif, -+FFI_EXTERN void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, - void **avalue); diff --git a/recipes/libffi/all/patches/0002-3.2.1-fix-libtool-path.patch b/recipes/libffi/all/patches/0002-3.2.1-fix-libtool-path.patch deleted file mode 100644 index a09551d110a1e3..00000000000000 --- a/recipes/libffi/all/patches/0002-3.2.1-fix-libtool-path.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- configure -+++ configure -@@ -8796,7 +8796,7 @@ - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)/libtool.sh' - - - -@@ -8889,7 +8889,7 @@ - esac - - # Global variables: --ofile=libtool -+ofile=libtool.sh - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, diff --git a/recipes/libffi/all/patches/0003-3.2.1-fix-win64-assembly.patch b/recipes/libffi/all/patches/0003-3.2.1-fix-win64-assembly.patch deleted file mode 100644 index 622ab2065a4778..00000000000000 --- a/recipes/libffi/all/patches/0003-3.2.1-fix-win64-assembly.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- src/x86/win64.S -+++ src/x86/win64.S -@@ -170,7 +170,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - movzx rax, ax - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_sint16$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT16 -@@ -179,7 +179,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - movsx rax, ax - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_uint32$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT32 -@@ -188,7 +188,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - mov eax, eax - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_sint32$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT32 -@@ -197,7 +197,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - cdqe - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_float$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_FLOAT -@@ -205,7 +205,7 @@ - - mov rax, QWORD PTR RVALUE[rbp] - movss DWORD PTR [rax], xmm0 -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_double$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_DOUBLE -@@ -213,7 +213,7 @@ - - mov rax, QWORD PTR RVALUE[rbp] - movlpd QWORD PTR [rax], xmm0 -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_uint64$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT64 -@@ -221,7 +221,7 @@ - - mov rcx, QWORD PTR RVALUE[rbp] - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_sint64$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT64 -@@ -229,7 +229,7 @@ - - mov rcx, QWORD PTR RVALUE[rbp] - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_pointer$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_POINTER -@@ -237,7 +237,7 @@ - - mov rcx, QWORD PTR RVALUE[rbp] - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_int$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_INT -@@ -246,7 +246,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - cdqe - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_void$: - xor rax, rax diff --git a/recipes/libffi/all/patches/0004-3.2.1-fix-complex-type-msvc.patch b/recipes/libffi/all/patches/0004-3.2.1-fix-complex-type-msvc.patch deleted file mode 100644 index 2b35695041bacb..00000000000000 --- a/recipes/libffi/all/patches/0004-3.2.1-fix-complex-type-msvc.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- src/types.c -+++ src/types.c -@@ -31,6 +31,8 @@ - #include - #include - -+#include -+ - /* Type definitions */ - - #define FFI_TYPEDEF(name, type, id, maybe_const)\ -@@ -44,16 +46,16 @@ - id, NULL \ - } - --#define FFI_COMPLEX_TYPEDEF(name, type, maybe_const) \ -+#define FFI_COMPLEX_TYPEDEF(name, complex_type, maybe_const) \ - static ffi_type *ffi_elements_complex_##name [2] = { \ - (ffi_type *)(&ffi_type_##name), NULL \ - }; \ - struct struct_align_complex_##name { \ - char c; \ -- _Complex type x; \ -+ complex_type x; \ - }; \ - maybe_const ffi_type ffi_type_complex_##name = { \ -- sizeof(_Complex type), \ -+ sizeof(complex_type), \ - offsetof(struct struct_align_complex_##name, x), \ - FFI_TYPE_COMPLEX, \ - (ffi_type **)ffi_elements_complex_##name \ -@@ -97,10 +99,20 @@ - FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE, FFI_LDBL_CONST); - #endif - -+#ifdef _MSC_VER -+# define FLOAT_COMPLEX _C_float_complex -+# define DOUBLE_COMPLEX _C_double_complex -+# define LDOUBLE_COMPLEX _C_ldouble_complex -+#else -+# define FLOAT_COMPLEX float _Complex -+# define DOUBLE_COMPLEX double _Complex -+# define LDOUBLE_COMPLEX long double _Complex -+#endif -+ - #ifdef FFI_TARGET_HAS_COMPLEX_TYPE --FFI_COMPLEX_TYPEDEF(float, float, const); --FFI_COMPLEX_TYPEDEF(double, double, const); -+FFI_COMPLEX_TYPEDEF(float, FLOAT_COMPLEX, const); -+FFI_COMPLEX_TYPEDEF(double, DOUBLE_COMPLEX, const); - #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE --FFI_COMPLEX_TYPEDEF(longdouble, long double, FFI_LDBL_CONST); -+FFI_COMPLEX_TYPEDEF(longdouble, LDOUBLE_COMPLEX, FFI_LDBL_CONST); - #endif - #endif diff --git a/recipes/libffi/all/patches/0005-3.2.1-do-not-install-libraries-to-arch-dependent-directories.patch b/recipes/libffi/all/patches/0005-3.2.1-do-not-install-libraries-to-arch-dependent-directories.patch deleted file mode 100644 index 4abeffb8768726..00000000000000 --- a/recipes/libffi/all/patches/0005-3.2.1-do-not-install-libraries-to-arch-dependent-directories.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -600,7 +600,7 @@ - target_os = @target_os@ - target_vendor = @target_vendor@ - toolexecdir = @toolexecdir@ --toolexeclibdir = @toolexeclibdir@ -+toolexeclibdir = @libdir@ - top_build_prefix = @top_build_prefix@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - ---- include/Makefile.in -+++ include/Makefile.in -@@ -307,15 +307,15 @@ - target_os = @target_os@ - target_vendor = @target_vendor@ - toolexecdir = @toolexecdir@ --toolexeclibdir = @toolexeclibdir@ -+toolexeclibdir = @libdir@ - top_build_prefix = @top_build_prefix@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - AUTOMAKE_OPTIONS = foreign - DISTCLEANFILES = ffitarget.h - EXTRA_DIST = ffi.h.in ffi_common.h --includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include -+includesdir = @includedir@ - nodist_includes_HEADERS = ffi.h ffitarget.h - all: all-am - - .SUFFIXES: diff --git a/recipes/libffi/all/patches/0006-3.2.1-library-no-version-suffix.patch b/recipes/libffi/all/patches/0006-3.2.1-library-no-version-suffix.patch deleted file mode 100644 index 915977c19a4ff2..00000000000000 --- a/recipes/libffi/all/patches/0006-3.2.1-library-no-version-suffix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -723,7 +723,7 @@ - nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) - LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS)) - AM_CFLAGS = $(am__append_41) --libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) -+libffi_la_LDFLAGS = -no-undefined -avoid-version $(LTLDFLAGS) $(AM_LTLDFLAGS) - AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src - AM_CCASFLAGS = $(AM_CPPFLAGS) - all: fficonfig.h diff --git a/recipes/libffi/all/test_package/CMakeLists.txt b/recipes/libffi/all/test_package/CMakeLists.txt index abdb4e55993d77..80fe7087b6f9f7 100644 --- a/recipes/libffi/all/test_package/CMakeLists.txt +++ b/recipes/libffi/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() -if(CONAN_SETTINGS_COMPILER_RUNTIME MATCHES ".*d") - add_compile_definitions(DISABLE_FFI_CALL) -endif() +project(test_package LANGUAGES C) + +find_package(libffi REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libffi::libffi) diff --git a/recipes/libffi/all/test_package/conanfile.py b/recipes/libffi/all/test_package/conanfile.py index d4128b04507778..2d636399fa7110 100644 --- a/recipes/libffi/all/test_package/conanfile.py +++ b/recipes/libffi/all/test_package/conanfile.py @@ -1,10 +1,30 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualRunEnv +from conan.tools.microsoft import msvc_runtime_flag import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + tc = CMakeToolchain(self) + if "d" in msvc_runtime_flag(self): + tc.preprocessor_definitions["DISABLE_FFI_CALL"] = 1 + tc.generate() + virtual_run_env = VirtualRunEnv(self) + virtual_run_env.generate() def build(self): cmake = CMake(self) @@ -12,6 +32,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libffi/all/test_v1_package/CMakeLists.txt b/recipes/libffi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..5b6f863b5bbc14 --- /dev/null +++ b/recipes/libffi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup() +if(CONAN_SETTINGS_COMPILER_RUNTIME MATCHES ".*d") + add_compile_definitions(DISABLE_FFI_CALL) +endif() + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/libffi/all/test_v1_package/conanfile.py b/recipes/libffi/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..d4128b04507778 --- /dev/null +++ b/recipes/libffi/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libffi/config.yml b/recipes/libffi/config.yml index c1c6e30f4ceeea..7f562b85ed6ac1 100644 --- a/recipes/libffi/config.yml +++ b/recipes/libffi/config.yml @@ -5,5 +5,3 @@ versions: folder: "all" "3.3": folder: "all" - "3.2.1": - folder: "all" From 1a1b7fc7959cdf8fc97cce745fe844e31194db29 Mon Sep 17 00:00:00 2001 From: Enwei Jiao Date: Tue, 25 Oct 2022 05:07:26 +0800 Subject: [PATCH 167/300] (#13593) rocksdb: add versions 6.27.3 and 6.29.5 --- recipes/rocksdb/all/conandata.yml | 12 ++++++++++++ ...name-jemalloc-according-to-conan-packages.patch | 14 ++++++++++++++ ...name-jemalloc-according-to-conan-packages.patch | 14 ++++++++++++++ recipes/rocksdb/config.yml | 4 ++++ 4 files changed, 44 insertions(+) create mode 100644 recipes/rocksdb/all/patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch create mode 100644 recipes/rocksdb/all/patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch diff --git a/recipes/rocksdb/all/conandata.yml b/recipes/rocksdb/all/conandata.yml index 1e7bb33dbcc27e..2e0d65d48f0787 100644 --- a/recipes/rocksdb/all/conandata.yml +++ b/recipes/rocksdb/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "6.29.5": + url: "https://github.com/facebook/rocksdb/archive/v6.29.5.tar.gz" + sha256: "ddbf84791f0980c0bbce3902feb93a2c7006f6f53bfd798926143e31d4d756f0" + "6.27.3": + url: "https://github.com/facebook/rocksdb/archive/v6.27.3.tar.gz" + sha256: "ee29901749b9132692b26f0a6c1d693f47d1a9ed8e3771e60556afe80282bf58" "6.20.3": url: "https://github.com/facebook/rocksdb/archive/v6.20.3.tar.gz" sha256: "c6502c7aae641b7e20fafa6c2b92273d935d2b7b2707135ebd9a67b092169dca" @@ -12,6 +18,12 @@ sources: url: "https://github.com/facebook/rocksdb/archive/v6.0.2.tar.gz" sha256: "89e0832f1fb00ac240a9438d4bbdae37dd3e52f7c15c3f646dc26887da16f342" patches: + "6.29.5": + - patch_file: "patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch" + base_path: "source_subfolder" + "6.27.3": + - patch_file: "patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch" + base_path: "source_subfolder" "6.20.3": - patch_file: "patches/6.20.3/0001-Rename-jemalloc-according-to-conan-packages.patch" base_path: "source_subfolder" diff --git a/recipes/rocksdb/all/patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch b/recipes/rocksdb/all/patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch new file mode 100644 index 00000000000000..862805a12fdf1f --- /dev/null +++ b/recipes/rocksdb/all/patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch @@ -0,0 +1,14 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -108,9 +108,9 @@ else() + set(WITH_JEMALLOC ON) + else() + if(WITH_JEMALLOC) +- find_package(JeMalloc REQUIRED) ++ find_package(jemalloc REQUIRED) + add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE) +- list(APPEND THIRDPARTY_LIBS JeMalloc::JeMalloc) ++ list(APPEND THIRDPARTY_LIBS jemalloc::jemalloc) + endif() + endif() + diff --git a/recipes/rocksdb/all/patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch b/recipes/rocksdb/all/patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch new file mode 100644 index 00000000000000..862805a12fdf1f --- /dev/null +++ b/recipes/rocksdb/all/patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch @@ -0,0 +1,14 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -108,9 +108,9 @@ else() + set(WITH_JEMALLOC ON) + else() + if(WITH_JEMALLOC) +- find_package(JeMalloc REQUIRED) ++ find_package(jemalloc REQUIRED) + add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE) +- list(APPEND THIRDPARTY_LIBS JeMalloc::JeMalloc) ++ list(APPEND THIRDPARTY_LIBS jemalloc::jemalloc) + endif() + endif() + diff --git a/recipes/rocksdb/config.yml b/recipes/rocksdb/config.yml index 7417a5aaa20ed7..51a8046980930b 100644 --- a/recipes/rocksdb/config.yml +++ b/recipes/rocksdb/config.yml @@ -1,4 +1,8 @@ versions: + "6.29.5": + folder: all + "6.27.3": + folder: all "6.20.3": folder: all "6.10.2": From f6e9704d38799d1e639a356328d16e0b646db922 Mon Sep 17 00:00:00 2001 From: Xianda Ke Date: Tue, 25 Oct 2022 05:45:24 +0800 Subject: [PATCH 168/300] (#13621) refine Folly recipe * refine folly recipe 1. add sse42 option projects with simd enabled can not not be linked with folly since sse is not enabled currently. 2. Keep consistent with folly's cmake files. folly itself export components such as follybenchmark the cmake script uses target_link_libraries(xxlib Folly::follybenchmark) works if using manually install folly. but will fail if uses conan's recipe. * address code review comments * address codereview comments * minor fix * fix lylint error * fix. folly also needs -mfma flag when simd >= sse4.2 --- recipes/folly/all/conanfile.py | 59 +++++++++++++++++-- recipes/folly/all/test_package/CMakeLists.txt | 4 +- .../folly/all/test_v1_package/conanfile.py | 1 - 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/recipes/folly/all/conanfile.py b/recipes/folly/all/conanfile.py index f1a32a1e02e304..06dc6965155a77 100755 --- a/recipes/folly/all/conanfile.py +++ b/recipes/folly/all/conanfile.py @@ -2,8 +2,9 @@ from conan.tools.build import can_run from conan.tools.scm import Version from conan.tools import files -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conans import CMake, tools +from conan.errors import ConanInvalidConfiguration import functools import os @@ -22,10 +23,12 @@ class FollyConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "use_sse4_2" : [True, False], } default_options = { "shared": False, "fPIC": True, + "use_sse4_2" : False } generators = "cmake", "cmake_find_package" @@ -57,10 +60,14 @@ def export_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): self.copy(patch["patch_file"]) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if str(self.settings.arch) not in ['x86', 'x86_64']: + del self.options.use_sse4_2 + def configure(self): if self.options.shared: del self.options.fPIC @@ -103,7 +110,7 @@ def validate(self): raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) - if self.version < "2022.01.31.00" and self.settings.os != "Linux": + if Version(self.version) < "2022.01.31.00" and self.settings.os != "Linux": raise ConanInvalidConfiguration("Conan support for non-Linux platforms starts with Folly version 2022.01.31.00") if self.settings.os == "Macos" and self.settings.arch != "x86_64": @@ -115,7 +122,7 @@ def validate(self): if self.settings.os in ["Macos", "Windows"] and self.options.shared: raise ConanInvalidConfiguration("Folly could not be built on {} as shared library".format(self.settings.os)) - if self.version == "2020.08.10.00" and self.settings.compiler == "clang" and self.options.shared: + if Version(self.version) == "2020.08.10.00" and self.settings.compiler == "clang" and self.options.shared: raise ConanInvalidConfiguration("Folly could not be built by clang as a shared library") if self.options["boost"].header_only: @@ -133,6 +140,9 @@ def validate(self): raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) + if self.options.get_safe("use_sse4_2") and str(self.settings.arch) not in ['x86', 'x86_64']: + raise ConanInvalidConfiguration(f"{self.ref} can use the option use_sse4_2 only on x86 and x86_64 archs.") + # FIXME: Freeze max. CMake version at 3.16.2 to fix the Linux build def build_requirements(self): self.build_requires("cmake/3.16.9") @@ -152,6 +162,16 @@ def _configure_cmake(self): cmake.definitions["FOLLY_HAVE_WCHAR_SUPPORT_EXITCODE__TRYRUN_OUTPUT"] = "" cmake.definitions["HAVE_VSNPRINTF_ERRORS_EXITCODE"] = "0" cmake.definitions["HAVE_VSNPRINTF_ERRORS_EXITCODE__TRYRUN_OUTPUT"] = "" + + if self.options.get_safe("use_sse4_2") and str(self.settings.arch) in ['x86', 'x86_64']: + # in folly, if simd >=sse4.2, we also needs -mfma flag to avoid compiling error. + if not is_msvc(self): + cmake.definitions["CMAKE_C_FLAGS"] = "-mfma" + cmake.definitions["CMAKE_CXX_FLAGS"] = "-mfma" + else: + cmake.definitions["CMAKE_C_FLAGS"] = "/arch:FMA" + cmake.definitions["CMAKE_CXX_FLAGS"] = "/arch:FMA" + cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) cxx_std_flag = tools.cppstd_flag(self.settings) @@ -164,6 +184,7 @@ def _configure_cmake(self): cmake.configure() return cmake + def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) @@ -244,6 +265,9 @@ def package_info(self): if self.settings.os == "Macos" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version.value) >= "11.0": self.cpp_info.components["libfolly"].system_libs.append("c++abi") + if self.options.get_safe("use_sse4_2") and str(self.settings.arch) in ['x86', 'x86_64']: + self.cpp_info.components["libfolly"].defines = ["FOLLY_SSE=4", "FOLLY_SSE_MINOR=2"] + # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed self.cpp_info.filenames["cmake_find_package"] = "folly" self.cpp_info.filenames["cmake_find_package_multi"] = "folly" @@ -254,3 +278,30 @@ def package_info(self): self.cpp_info.components["libfolly"].names["cmake_find_package_multi"] = "folly" self.cpp_info.components["libfolly"].set_property("cmake_target_name", "Folly::folly") self.cpp_info.components["libfolly"].set_property("pkg_config_name", "libfolly") + + if Version(self.version) >= "2019.10.21.00": + self.cpp_info.components["follybenchmark"].set_property("cmake_target_name", "Folly::follybenchmark") + self.cpp_info.components["follybenchmark"].set_property("pkg_config_name", "libfollybenchmark") + self.cpp_info.components["follybenchmark"].libs = ["follybenchmark"] + self.cpp_info.components["follybenchmark"].requires = ["libfolly"] + + self.cpp_info.components["folly_test_util"].set_property("cmake_target_name", "Folly::folly_test_util") + self.cpp_info.components["folly_test_util"].set_property("pkg_config_name", "libfolly_test_util") + self.cpp_info.components["folly_test_util"].libs = ["folly_test_util"] + self.cpp_info.components["folly_test_util"].requires = ["libfolly"] + + if Version(self.version) >= "2020.08.10.00" and self.settings.os == "Linux": + self.cpp_info.components["folly_exception_tracer_base"].set_property("cmake_target_name", "Folly::folly_exception_tracer_base") + self.cpp_info.components["folly_exception_tracer_base"].set_property("pkg_config_name", "libfolly_exception_tracer_base") + self.cpp_info.components["folly_exception_tracer_base"].libs = ["folly_exception_tracer_base"] + self.cpp_info.components["folly_exception_tracer_base"].requires = ["libfolly"] + + self.cpp_info.components["folly_exception_tracer"].set_property("cmake_target_name", "Folly::folly_exception_tracer") + self.cpp_info.components["folly_exception_tracer"].set_property("pkg_config_name", "libfolly_exception_tracer") + self.cpp_info.components["folly_exception_tracer"].libs = ["folly_exception_tracer"] + self.cpp_info.components["folly_exception_tracer"].requires = ["folly_exception_tracer_base"] + + self.cpp_info.components["folly_exception_counter"].set_property("cmake_target_name", "Folly::folly_exception_counter") + self.cpp_info.components["folly_exception_counter"].set_property("pkg_config_name", "libfolly_exception_counter") + self.cpp_info.components["folly_exception_counter"].libs = ["folly_exception_counter"] + self.cpp_info.components["folly_exception_counter"].requires = ["folly_exception_tracer"] diff --git a/recipes/folly/all/test_package/CMakeLists.txt b/recipes/folly/all/test_package/CMakeLists.txt index 7ecfe43826b6f8..6a9df4ea0b7523 100644 --- a/recipes/folly/all/test_package/CMakeLists.txt +++ b/recipes/folly/all/test_package/CMakeLists.txt @@ -4,7 +4,9 @@ project(test_package CXX) find_package(folly REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Folly::folly) +target_link_libraries(${PROJECT_NAME} + Folly::folly + Folly::follybenchmark) if (${FOLLY_VERSION} VERSION_LESS "2021.07.20.00") diff --git a/recipes/folly/all/test_v1_package/conanfile.py b/recipes/folly/all/test_v1_package/conanfile.py index 46bc83449db7c7..8b8cfae4c18820 100644 --- a/recipes/folly/all/test_v1_package/conanfile.py +++ b/recipes/folly/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os From 2d9b4b8e73d0a608df69a88d8e845816c09246ec Mon Sep 17 00:00:00 2001 From: theirix Date: Tue, 25 Oct 2022 01:06:49 +0300 Subject: [PATCH 169/300] (#13628) libnghttp2: add 1.50.0, bump deps * Add nghttp2 1.50.0 * Bump deps * Update for Conan 2.0 Signed-off-by: Uilian Ries * Remove extra files Signed-off-by: Uilian Ries * Use rm_safe from 1.53.0 * Revert "Use rm_safe from 1.53.0" This reverts commit 51ed2486b26c3770efd32620c8550cbbff6e96c7. * Use src for cmake_layout Co-authored-by: Jordan Williams Signed-off-by: Uilian Ries Co-authored-by: Uilian Ries Co-authored-by: Jordan Williams --- recipes/libnghttp2/all/CMakeLists.txt | 7 - recipes/libnghttp2/all/conandata.yml | 22 +-- recipes/libnghttp2/all/conanfile.py | 138 +++++++++--------- .../all/test_package/CMakeLists.txt | 11 +- .../libnghttp2/all/test_package/conanfile.py | 26 ++-- .../all/test_v1_package/CMakeLists.txt | 7 + .../all/test_v1_package/conanfile.py | 17 +++ recipes/libnghttp2/config.yml | 2 + 8 files changed, 117 insertions(+), 113 deletions(-) delete mode 100644 recipes/libnghttp2/all/CMakeLists.txt create mode 100644 recipes/libnghttp2/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libnghttp2/all/test_v1_package/conanfile.py diff --git a/recipes/libnghttp2/all/CMakeLists.txt b/recipes/libnghttp2/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33fc..00000000000000 --- a/recipes/libnghttp2/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libnghttp2/all/conandata.yml b/recipes/libnghttp2/all/conandata.yml index 8131565e0ca21e..3925076a99152a 100644 --- a/recipes/libnghttp2/all/conandata.yml +++ b/recipes/libnghttp2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.50.0": + url: "https://github.com/nghttp2/nghttp2/archive/v1.50.0.tar.gz" + sha256: "6de469efc8e9d47059327a6736aebe0a7d73f57e5e37ab4c4f838fb1eebd7889" "1.49.0": url: "https://github.com/nghttp2/nghttp2/archive/v1.49.0.tar.gz" sha256: "744f38f8d6e400a424bf62df449c91e3ffacbae11b5fab99e44a480f5c735ab9" @@ -29,48 +32,29 @@ sources: patches: "1.49.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.48.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.47.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.46.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.45.1": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.43.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.42.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.40.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.39.2": - patch_file: "patches/fix-addNghttp2IncludesPathCMake.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" diff --git a/recipes/libnghttp2/all/conanfile.py b/recipes/libnghttp2/all/conanfile.py index 0029f5d21561ea..b3b58ce1c61eb9 100644 --- a/recipes/libnghttp2/all/conanfile.py +++ b/recipes/libnghttp2/all/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, save, replace_in_file, rmdir, copy +from conan.tools.microsoft import is_msvc +from conan.tools.apple import is_apple_os +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.36.0" + +required_conan_version = ">=1.52.0" class Nghttp2Conan(ConanFile): @@ -13,7 +19,6 @@ class Nghttp2Conan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://nghttp2.org" license = "MIT" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,20 +37,8 @@ class Nghttp2Conan(ConanFile): "with_asio": False, } - generators = "cmake", "cmake_find_package", "pkg_config" - - @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"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,13 +46,25 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass if not (self.options.with_app or self.options.with_hpack or self.options.with_asio): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass if not self.options.with_app: del self.options.with_jemalloc + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.with_app or self.options.with_asio: self.requires("openssl/1.1.1q") @@ -68,64 +73,62 @@ def requirements(self): self.requires("libev/4.33") self.requires("libevent/2.1.12") self.requires("libxml2/2.9.14") - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_jemalloc: - self.requires("jemalloc/5.2.1") + self.requires("jemalloc/5.3.0") if self.options.with_hpack: self.requires("jansson/2.14") if self.options.with_asio: - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") def validate(self): - if self.options.with_asio and self._is_msvc: + if self.info.options.with_asio and is_msvc(self): raise ConanInvalidConfiguration("Build with asio and MSVC is not supported yet, see upstream bug #589") - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "6": - raise ConanInvalidConfiguration("gcc >= 6.0 required") + if self.info.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >= 6.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ENABLE_SHARED_LIB"] = self.options.shared - cmake.definitions["ENABLE_STATIC_LIB"] = not self.options.shared - cmake.definitions["ENABLE_HPACK_TOOLS"] = self.options.with_hpack - cmake.definitions["ENABLE_APP"] = self.options.with_app - cmake.definitions["ENABLE_EXAMPLES"] = False - cmake.definitions["ENABLE_PYTHON_BINDINGS"] = False - cmake.definitions["ENABLE_FAILMALLOC"] = False + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_SHARED_LIB"] = self.options.shared + tc.variables["ENABLE_STATIC_LIB"] = not self.options.shared + tc.variables["ENABLE_HPACK_TOOLS"] = self.options.with_hpack + tc.variables["ENABLE_APP"] = self.options.with_app + tc.variables["ENABLE_EXAMPLES"] = False + tc.variables["ENABLE_PYTHON_BINDINGS"] = False + tc.variables["ENABLE_FAILMALLOC"] = False # disable unneeded auto-picked dependencies - cmake.definitions["WITH_LIBXML2"] = False - cmake.definitions["WITH_JEMALLOC"] = self.options.get_safe("with_jemalloc", False) - cmake.definitions["WITH_SPDYLAY"] = False - - cmake.definitions["ENABLE_ASIO_LIB"] = self.options.with_asio - - if tools.Version(self.version) >= "1.42.0": + tc.variables["WITH_LIBXML2"] = False + tc.variables["WITH_JEMALLOC"] = self.options.get_safe("with_jemalloc", False) + tc.variables["WITH_SPDYLAY"] = False + tc.variables["ENABLE_ASIO_LIB"] = self.options.with_asio + if Version(self.version) >= "1.42.0": # backward-incompatible change in 1.42.0 - cmake.definitions["STATIC_LIB_SUFFIX"] = "_static" - - if tools.is_apple_os(self.settings.os): + tc.variables["STATIC_LIB_SUFFIX"] = "_static" + if is_apple_os(self): # workaround for: install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable - cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False + tc.cache_variables["CMAKE_MACOSX_BUNDLE"] = False + tc.generate() - cmake.configure() - return cmake + tc = CMakeDeps(self) + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if not self.options.shared: # easier to patch here rather than have patch 'nghttp_static_include_directories' for each version - tools.save(os.path.join(self._source_subfolder, "lib", "CMakeLists.txt"), + save(self, os.path.join(self.source_folder, "lib", "CMakeLists.txt"), "target_include_directories(nghttp2_static INTERFACE\n" "${CMAKE_CURRENT_BINARY_DIR}/includes\n" "${CMAKE_CURRENT_SOURCE_DIR}/includes)\n", append=True) target_libnghttp2 = "nghttp2" if self.options.shared else "nghttp2_static" - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "\n" "link_libraries(\n" " nghttp2\n", @@ -133,36 +136,37 @@ def _patch_sources(self): "link_libraries(\n" " {} ${{CONAN_LIBS}}\n".format(target_libnghttp2)) if not self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "\n" " add_library(nghttp2_asio SHARED\n", "\n" " add_library(nghttp2_asio\n") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "\n" " target_link_libraries(nghttp2_asio\n" " nghttp2\n", "\n" " target_link_libraries(nghttp2_asio\n" - " {}\n".format(target_libnghttp2)) + f" {target_libnghttp2}\n") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.components["nghttp2"].set_property("pkg_config_name", "libnghttp2") - suffix = "_static" if tools.Version(self.version) > "1.39.2" and not self.options.shared else "" + suffix = "_static" if Version(self.version) > "1.39.2" and not self.options.shared else "" self.cpp_info.components["nghttp2"].libs = [f"nghttp2{suffix}"] - if self._is_msvc and not self.options.shared: + if is_msvc(self) and not self.options.shared: self.cpp_info.components["nghttp2"].defines.append("NGHTTP2_STATICLIB") if self.options.with_asio: diff --git a/recipes/libnghttp2/all/test_package/CMakeLists.txt b/recipes/libnghttp2/all/test_package/CMakeLists.txt index db17f433a0df2d..eb7f9cd8b97692 100644 --- a/recipes/libnghttp2/all/test_package/CMakeLists.txt +++ b/recipes/libnghttp2/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) find_package(libnghttp2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} libnghttp2::libnghttp2) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE libnghttp2::libnghttp2) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/libnghttp2/all/test_package/conanfile.py b/recipes/libnghttp2/all/test_package/conanfile.py index 697dfef261b53b..a9fb96656f2039 100644 --- a/recipes/libnghttp2/all/test_package/conanfile.py +++ b/recipes/libnghttp2/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libnghttp2/all/test_v1_package/CMakeLists.txt b/recipes/libnghttp2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..a7596ce0a8b971 --- /dev/null +++ b/recipes/libnghttp2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ ${CMAKE_CURRENT_BINARY_DIR}/binary_dir/) diff --git a/recipes/libnghttp2/all/test_v1_package/conanfile.py b/recipes/libnghttp2/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libnghttp2/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libnghttp2/config.yml b/recipes/libnghttp2/config.yml index 0d99bd0a335cec..a0683e79679b09 100644 --- a/recipes/libnghttp2/config.yml +++ b/recipes/libnghttp2/config.yml @@ -1,4 +1,6 @@ versions: + "1.50.0": + folder: all "1.49.0": folder: all "1.48.0": From 63083cc957636355c89afcb027a3e7e74a12fcff Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Mon, 24 Oct 2022 18:05:27 -0500 Subject: [PATCH 170/300] (#13667) bzip2: Conan V2 improvements * bzip2: Conan V2 improvments Use export patches method. Safely delete fPIC option. Use Python F-Strings. * Remove redundant package name from topics * Modernize the CMakeLists.txt file * Fix spacing * Use can_run in test package * Incorporate changes from #13703 * More fixes * Remove use of conan_version * Update recipes/bzip2/all/test_package/CMakeLists.txt Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/bzip2/all/CMakeLists.txt | 71 +++++++++---------- recipes/bzip2/all/conanfile.py | 38 +++++----- recipes/bzip2/all/test_package/CMakeLists.txt | 23 ++++-- recipes/bzip2/all/test_package/conanfile.py | 5 +- .../bzip2/all/test_v1_package/CMakeLists.txt | 14 +--- .../bzip2/all/test_v1_package/conanfile.py | 3 +- 6 files changed, 77 insertions(+), 77 deletions(-) diff --git a/recipes/bzip2/all/CMakeLists.txt b/recipes/bzip2/all/CMakeLists.txt index a76b3d6139c7e1..cce959a4a45c57 100644 --- a/recipes/bzip2/all/CMakeLists.txt +++ b/recipes/bzip2/all/CMakeLists.txt @@ -1,44 +1,41 @@ cmake_minimum_required(VERSION 3.4) -project(bzip2 C) +project(bzip2 LANGUAGES C) include(GNUInstallDirs) -if(MSVC OR MSVC90 OR MSVC10) - set(MSVC ON) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -set(SOURCE_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src) -set(BZ2_LIBRARY bz2) - -option(BZ2_BUILD_EXE ON) - -set(BZ2_TARGETS ${BZ2_LIBRARY}) - -add_library(${BZ2_LIBRARY} ${SOURCE_SUBFOLDER}/blocksort.c - ${SOURCE_SUBFOLDER}/bzlib.c - ${SOURCE_SUBFOLDER}/compress.c - ${SOURCE_SUBFOLDER}/crctable.c - ${SOURCE_SUBFOLDER}/decompress.c - ${SOURCE_SUBFOLDER}/huffman.c - ${SOURCE_SUBFOLDER}/randtable.c - ${SOURCE_SUBFOLDER}/bzlib.h - ${SOURCE_SUBFOLDER}/bzlib_private.h) -target_include_directories(${BZ2_LIBRARY} PRIVATE ${SOURCE_SUBFOLDER}) +option(BZ2_BUILD_EXE "Build bzip2 command-line utility" ON) + +add_library( + bz2 + ${BZ2_SRC_DIR}/blocksort.c + ${BZ2_SRC_DIR}/bzlib.c + ${BZ2_SRC_DIR}/compress.c + ${BZ2_SRC_DIR}/crctable.c + ${BZ2_SRC_DIR}/decompress.c + ${BZ2_SRC_DIR}/huffman.c + ${BZ2_SRC_DIR}/randtable.c +) + +target_include_directories(bz2 PUBLIC ${BZ2_SRC_DIR}) +set_target_properties( + bz2 + PROPERTIES + PUBLIC_HEADER "${BZ2_SRC_DIR}/bzlib.h" + SOVERSION ${BZ2_VERSION_MAJOR} + VERSION ${BZ2_VERSION_STRING} + WINDOWS_EXPORT_ALL_SYMBOLS ON +) + +install( + TARGETS bz2 + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) if(BZ2_BUILD_EXE) - add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_SUBFOLDER}/bzip2.c) - target_link_libraries(${CMAKE_PROJECT_NAME} ${BZ2_LIBRARY}) - target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${SOURCE_SUBFOLDER}) - list(APPEND BZ2_TARGETS ${CMAKE_PROJECT_NAME}) + add_executable(bzip2 ${BZ2_SRC_DIR}/bzip2.c) + target_link_libraries(bzip2 PRIVATE bz2) + install(TARGETS bzip2 DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() - -set_target_properties(${BZ2_LIBRARY} PROPERTIES VERSION ${BZ2_VERSION_STRING} SOVERSION ${BZ2_VERSION_MAJOR}) - -install(TARGETS ${BZ2_TARGETS} - BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -install(FILES ${SOURCE_SUBFOLDER}/bzlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/bzip2/all/conanfile.py b/recipes/bzip2/all/conanfile.py index 1c4db485095a24..49ea55c0163497 100644 --- a/recipes/bzip2/all/conanfile.py +++ b/recipes/bzip2/all/conanfile.py @@ -1,10 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, save +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class Bzip2Conan(ConanFile): @@ -13,8 +14,7 @@ class Bzip2Conan(ConanFile): homepage = "http://www.bzip.org" license = "bzip2-1.0.8" description = "bzip2 is a free and open-source file compression program that uses the Burrows Wheeler algorithm." - topics = ("bzip2", "data-compressor", "file-compression") - + topics = ("data-compressor", "file-compression") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,25 +29,27 @@ class Bzip2Conan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - self.license = "bzip2-{}".format(self.version) + self.license = f"bzip2-{self.version}" def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: - del self.settings.compiler.libcxx + del self.settings.compiler.libcxx except Exception: - pass + pass try: - del self.settings.compiler.cppstd + del self.settings.compiler.cppstd except Exception: - pass + pass def layout(self): cmake_layout(self, src_folder="src") @@ -58,9 +60,10 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["BZ2_VERSION_STRING"] = self.version - tc.variables["BZ2_VERSION_MAJOR"] = str(self.version).split(".")[0] tc.variables["BZ2_BUILD_EXE"] = self.options.build_executable + tc.variables["BZ2_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["BZ2_VERSION_MAJOR"] = Version(self.version).major + tc.variables["BZ2_VERSION_STRING"] = self.version tc.generate() def build(self): @@ -98,7 +101,7 @@ def _create_cmake_module_variables(self, module_file): @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -110,8 +113,5 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "BZip2" self.cpp_info.names["cmake_find_package_multi"] = "BZip2" self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - if self.options.build_executable: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/bzip2/all/test_package/CMakeLists.txt b/recipes/bzip2/all/test_package/CMakeLists.txt index 41f56a28f0fb32..540d39e432a7ed 100644 --- a/recipes/bzip2/all/test_package/CMakeLists.txt +++ b/recipes/bzip2/all/test_package/CMakeLists.txt @@ -2,12 +2,23 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) find_package(BZip2 REQUIRED) -message("BZIP2_FOUND: ${BZIP2_FOUND}") -message("BZIP2_NEED_PREFIX: ${BZIP2_NEED_PREFIX}") -message("BZIP2_INCLUDE_DIRS: ${BZIP2_INCLUDE_DIRS}") -message("BZIP2_INCLUDE_DIR: ${BZIP2_INCLUDE_DIR}") -message("BZIP2_LIBRARIES: ${BZIP2_LIBRARIES}") -message("BZIP2_VERSION_STRING: ${BZIP2_VERSION_STRING}") add_executable(test_package test_package.c) target_link_libraries(test_package PRIVATE BZip2::BZip2) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindBZip2.html are properly defined +set(_custom_vars + BZIP2_FOUND + BZIP2_NEED_PREFIX + BZIP2_INCLUDE_DIRS + BZIP2_INCLUDE_DIR + BZIP2_LIBRARIES + BZIP2_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/bzip2/all/test_package/conanfile.py b/recipes/bzip2/all/test_package/conanfile.py index 3a8c6c5442b33b..8a5bb47f50c4ce 100644 --- a/recipes/bzip2/all/test_package/conanfile.py +++ b/recipes/bzip2/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) @@ -20,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/bzip2/all/test_v1_package/CMakeLists.txt b/recipes/bzip2/all/test_v1_package/CMakeLists.txt index 5760ab61162940..0d20897301b68b 100644 --- a/recipes/bzip2/all/test_v1_package/CMakeLists.txt +++ b/recipes/bzip2/all/test_v1_package/CMakeLists.txt @@ -1,16 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(BZip2 REQUIRED) -message("BZIP2_FOUND: ${BZIP2_FOUND}") -message("BZIP2_NEED_PREFIX: ${BZIP2_NEED_PREFIX}") -message("BZIP2_INCLUDE_DIRS: ${BZIP2_INCLUDE_DIRS}") -message("BZIP2_INCLUDE_DIR: ${BZIP2_INCLUDE_DIR}") -message("BZIP2_LIBRARIES: ${BZIP2_LIBRARIES}") -message("BZIP2_VERSION_STRING: ${BZIP2_VERSION_STRING}") - -add_executable(test_package ../test_package/test_package.c) -target_link_libraries(test_package PRIVATE BZip2::BZip2) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bzip2/all/test_v1_package/conanfile.py b/recipes/bzip2/all/test_v1_package/conanfile.py index ce96086e831ac1..19e6a0c06e3d81 100644 --- a/recipes/bzip2/all/test_v1_package/conanfile.py +++ b/recipes/bzip2/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os @@ -15,4 +14,4 @@ def build(self): def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") - self.run("%s --help" % bin_path, run_environment=True) + self.run(bin_path, run_environment=True) From ac2e5233c8c36b54c5bd3e785089a0a939f3dece Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Mon, 24 Oct 2022 18:25:36 -0500 Subject: [PATCH 171/300] (#13668) xkbcommon: Revert using a separate directory for the build context * xkbcommon: Revert using a separate directory for the build context I made an oops in my previous change. This actually does end up breaking cross-compilation. The requirements of `wayland-scanner` aren't available in the build context. This causes pkg-config to fail to "find" `wayland-scanner`. The `expat` and `libxml2` files would need to be in this same directory. Omitting the separate build context directory for pkg-config files works around this issue for now. Work will need to be done upstream to ensure dependencies are also made available in the build context for PkgConfigDeps. See conan-io/conan#12342 for progress on the issue upstream. It's important to note that pointing Meson to the generators directory for "native" pkg-config files isn't the safest thing to do. It's possible for Meson to mistakenly think dependencies in the generators directory are meant for the build context when they are of course meant for the host context whenever they lack the `_BUILD` suffix. I've also placed `wayland-protocols` in the build context. While it provides XML files only, really, this maps to how it is used. * Remove lingering import * Improve the set of topics --- recipes/xkbcommon/all/conanfile.py | 49 +++++++++++++++--------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/recipes/xkbcommon/all/conanfile.py b/recipes/xkbcommon/all/conanfile.py index 40d3c56584b835..68b38a05ecf99d 100644 --- a/recipes/xkbcommon/all/conanfile.py +++ b/recipes/xkbcommon/all/conanfile.py @@ -1,11 +1,9 @@ -import glob import os -import shutil from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import VirtualBuildEnv -from conan.tools.files import copy, get, mkdir, replace_in_file, rmdir +from conan.tools.files import copy, get, replace_in_file, rmdir from conan.tools.gnu import PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain @@ -18,7 +16,7 @@ class XkbcommonConan(ConanFile): name = "xkbcommon" description = "keymap handling library for toolkits and window systems" - topics = ("keyboard") + topics = ("keyboard", "wayland", "x11", "xkb") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xkbcommon/libxkbcommon" license = "MIT" @@ -106,38 +104,41 @@ def generate(self): if self._has_xkbregistry_option: tc.project_options["enable-xkbregistry"] = self.options.xkbregistry if self._has_build_profile: - tc.project_options["build.pkg_config_path"] = os.path.join(self.generators_folder, "build") + tc.project_options["build.pkg_config_path"] = self.generators_folder tc.generate() pkg_config_deps = PkgConfigDeps(self) if self._has_build_profile and self.options.get_safe("with_wayland"): pkg_config_deps.build_context_activated = ["wayland", "wayland-protocols"] - pkg_config_deps.build_context_suffix = {"wayland": "_BUILD"} + pkg_config_deps.build_context_suffix = {"wayland": "_BUILD", "wayland-protocols": "_BUILD"} pkg_config_deps.generate() - if self._has_build_profile and self.options.get_safe("with_wayland"): - mkdir(self, os.path.join(self.generators_folder, "build")) - for pc in glob.glob(os.path.join(self.generators_folder, "*_BUILD.pc")): - original_pc = os.path.basename(pc)[:-9] + ".pc" - shutil.move(pc, os.path.join(self.generators_folder, "build", original_pc)) virtual_build_env = VirtualBuildEnv(self) virtual_build_env.generate() def build(self): - # Conan doesn't provide a `wayland-scanner.pc` file for the package in the _build_ context - if self.options.get_safe("with_wayland") and not self._has_build_profile: + if self.options.get_safe("with_wayland"): meson_build_file = os.path.join(self.source_folder, "meson.build") - replace_in_file(self, meson_build_file, - "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", - "# wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)") - - replace_in_file(self, meson_build_file, - "if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()", - "if not wayland_client_dep.found() or not wayland_protocols_dep.found()") - - replace_in_file(self, meson_build_file, - "wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))", - "wayland_scanner = find_program('wayland-scanner')") + # Patch the build system to use the pkg-config files generated for the build context. + if self._has_build_profile: + replace_in_file(self, meson_build_file, + "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", + "wayland_scanner_dep = dependency('wayland-scanner_BUILD', required: false, native: true)") + replace_in_file(self, meson_build_file, + "wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)", + "wayland_protocols_dep = dependency('wayland-protocols_BUILD', version: '>=1.12', required: false, native: true)") + else: + replace_in_file(self, meson_build_file, + "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", + "# wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)") + + replace_in_file(self, meson_build_file, + "if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()", + "if not wayland_client_dep.found() or not wayland_protocols_dep.found()") + + replace_in_file(self, meson_build_file, + "wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))", + "wayland_scanner = find_program('wayland-scanner')") meson = Meson(self) meson.configure() From ed76d12e34af139a9617c25d9cb9d70eee3fa74a Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 25 Oct 2022 09:05:28 +0900 Subject: [PATCH 172/300] (#13713) civetweb: update zlib and use export_conandata_patches * civetweb: update zlib and use export_conandata_patches * remove skip-file --- recipes/civetweb/all/conanfile.py | 26 ++++++++++++------- .../civetweb/all/test_v1_package/conanfile.py | 1 - 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/recipes/civetweb/all/conanfile.py b/recipes/civetweb/all/conanfile.py index 8c71ea550c4706..9b93e887c2b459 100644 --- a/recipes/civetweb/all/conanfile.py +++ b/recipes/civetweb/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.52.0" class CivetwebConan(ConanFile): @@ -14,7 +14,7 @@ class CivetwebConan(ConanFile): homepage = "https://github.com/civetweb/civetweb" url = "https://github.com/conan-io/conan-center-index" description = "Embedded C/C++ web server" - topics = ("civetweb", "web-server", "embedded") + topics = ("web-server", "embedded") settings = "os", "arch", "compiler", "build_type" options = { @@ -59,8 +59,7 @@ def _has_zlib_option(self): return Version(self.version) >= "1.15" def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, patch["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -70,10 +69,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass if not self.options.with_cxx: - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass if not self.options.with_ssl: del self.options.ssl_dynamic_loading @@ -81,7 +89,7 @@ def requirements(self): if self.options.with_ssl: self.requires("openssl/1.1.1q") if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.options.get_safe("ssl_dynamic_loading") and not self.options["openssl"].shared: diff --git a/recipes/civetweb/all/test_v1_package/conanfile.py b/recipes/civetweb/all/test_v1_package/conanfile.py index 7ba1739476336d..6f09f10193d23a 100644 --- a/recipes/civetweb/all/test_v1_package/conanfile.py +++ b/recipes/civetweb/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file import os from conans import ConanFile, tools, CMake From a8d76f51142c40fff6af7a6e7c8b4813f6d4a686 Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 25 Oct 2022 09:46:18 +0900 Subject: [PATCH 173/300] (#13714) c-blosc2: add version 2.4.3 and update dependencies --- recipes/c-blosc2/all/conandata.yml | 5 +++++ recipes/c-blosc2/all/conanfile.py | 13 ++++++------- recipes/c-blosc2/config.yml | 2 ++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/recipes/c-blosc2/all/conandata.yml b/recipes/c-blosc2/all/conandata.yml index 1d8b50594a3717..d80738613d1bde 100644 --- a/recipes/c-blosc2/all/conandata.yml +++ b/recipes/c-blosc2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.4.3": + url: "https://github.com/Blosc/c-blosc2/archive/v2.4.3.tar.gz" + sha256: "d4aa5e0794598794f20ab950e973d44f0d0d9c133ea1a5a07cb200fa54d2e036" "2.4.2": url: "https://github.com/Blosc/c-blosc2/archive/v2.4.2.tar.gz" sha256: "763ded7a6286abd248a79b1560ce8bfda11018b699a450b3e43c529f284a5232" @@ -10,6 +13,8 @@ sources: sha256: "66f9977de26d6bc9ea1c0e623d873c3225e4fff709aa09b3335fd09d41d57c0e" patches: + "2.4.3": + - patch_file: "patches/2.4.1-0001-fix-cmake.patch" "2.4.2": - patch_file: "patches/2.4.1-0001-fix-cmake.patch" "2.4.1": diff --git a/recipes/c-blosc2/all/conanfile.py b/recipes/c-blosc2/all/conanfile.py index 3b7bb98ece38b3..e8b9099a17a496 100644 --- a/recipes/c-blosc2/all/conanfile.py +++ b/recipes/c-blosc2/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile -from conan.tools.microsoft import is_msvc_static_runtime, is_msvc -from conan.tools.files import apply_conandata_patches, get, copy, rm, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy, rm, rmdir from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os import glob -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class CBlosc2Conan(ConanFile): name = "c-blosc2" @@ -36,8 +36,7 @@ class CBlosc2Conan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -71,11 +70,11 @@ def layout(self): def requirements(self): if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_zlib in ["zlib-ng", "zlib-ng-compat"]: self.requires("zlib-ng/2.0.6") elif self.options.with_zlib == "zlib": - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_zstd: self.requires("zstd/1.5.2") diff --git a/recipes/c-blosc2/config.yml b/recipes/c-blosc2/config.yml index 83b61a4e58cee2..2efeb63b2eea8f 100644 --- a/recipes/c-blosc2/config.yml +++ b/recipes/c-blosc2/config.yml @@ -1,4 +1,6 @@ versions: + "2.4.3": + folder: all "2.4.2": folder: all "2.4.1": From 46c64f1f3f8665ab02139aeb56db8b886cdbe9aa Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 25 Oct 2022 03:41:13 +0200 Subject: [PATCH 174/300] (#13720) tiny-aes-c: conan v2 support --- recipes/tiny-aes-c/all/CMakeLists.txt | 11 --- recipes/tiny-aes-c/all/conandata.yml | 5 + recipes/tiny-aes-c/all/conanfile.py | 99 ++++++++++--------- .../all/patches/0001-cmake-install.patch | 14 +++ .../all/test_package/CMakeLists.txt | 9 +- .../tiny-aes-c/all/test_package/conanfile.py | 23 +++-- .../all/test_v1_package/CMakeLists.txt | 8 ++ .../all/test_v1_package/conanfile.py | 19 ++++ 8 files changed, 115 insertions(+), 73 deletions(-) delete mode 100644 recipes/tiny-aes-c/all/CMakeLists.txt create mode 100644 recipes/tiny-aes-c/all/patches/0001-cmake-install.patch create mode 100644 recipes/tiny-aes-c/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/tiny-aes-c/all/test_v1_package/conanfile.py diff --git a/recipes/tiny-aes-c/all/CMakeLists.txt b/recipes/tiny-aes-c/all/CMakeLists.txt deleted file mode 100644 index 2fcc36dafa5135..00000000000000 --- a/recipes/tiny-aes-c/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/tiny-aes-c/all/conandata.yml b/recipes/tiny-aes-c/all/conandata.yml index 6ee30840f6f375..f5bd969c7683c6 100644 --- a/recipes/tiny-aes-c/all/conandata.yml +++ b/recipes/tiny-aes-c/all/conandata.yml @@ -2,3 +2,8 @@ sources: "1.0.0": url: "https://github.com/kokke/tiny-AES-c/archive/v1.0.0.tar.gz" sha256: "61fd99ac95df30e9ab39d6cdd41e88909b2eaf9b9806f23aa235485ac0bed2fd" +patches: + "1.0.0": + - patch_file: "patches/0001-cmake-install.patch" + patch_description: "CMake: add install target" + patch_type: "conan" diff --git a/recipes/tiny-aes-c/all/conanfile.py b/recipes/tiny-aes-c/all/conanfile.py index 058b2937bb14ba..e393e50a776979 100644 --- a/recipes/tiny-aes-c/all/conanfile.py +++ b/recipes/tiny-aes-c/all/conanfile.py @@ -1,9 +1,11 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.52.0" -required_conan_version = ">=1.32.0" class TinyAesCConan(ConanFile): name = "tiny-aes-c" @@ -13,8 +15,7 @@ class TinyAesCConan(ConanFile): description = "Small portable AES128/192/256 in C" topics = ("encryption", "crypto", "AES") - settings = "os", "compiler", "build_type", "arch" - + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,7 +28,6 @@ class TinyAesCConan(ConanFile): # enable encryption in counter-mode "ctr": [True, False], } - default_options = { "shared": False, "fPIC": True, @@ -37,26 +37,17 @@ class TinyAesCConan(ConanFile): "ctr": True, } - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _aes_defs(self): + return { + str(self.options.aes_block_size).upper(): "1", + "CBC": "1" if self.options.cbc else "0", + "ECB": "1" if self.options.ecb else "0", + "CTR": "1" if self.options.ctr else "0", + } - @property - def _cflags(self): - return [ - "{}=1".format(str(self.options.aes_block_size).upper()), - "CBC={}".format("1" if self.options.cbc else "0"), - "ECB={}".format("1" if self.options.ecb else "0"), - "CTR={}".format("1" if self.options.ctr else "0") - ] + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -64,41 +55,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if not self.options.cbc and not self.options.ecb and not self.options.ctr: + if not self.info.options.cbc and not self.info.options.ecb and not self.info.options.ctr: raise ConanInvalidConfiguration("Need to at least specify one of CBC, ECB or CTR modes") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "tiny-AES-c-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_C_FLAGS"] = " ".join("-D{}".format(flag) for flag in self._cflags) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + for definition, value in self._aes_defs.items(): + tc.preprocessor_definitions[definition] = value + # Export symbols for shared msvc + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + # Relocatable shared lib on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("unlicense.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", src=self._source_subfolder) - self.copy(pattern="*.a", dst="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) - self.copy(pattern="*.dylib", dst="lib", keep_path=False) - self.copy(pattern="*.so*", dst="lib", keep_path=False) - self.copy(pattern="*.dll", dst="bin", keep_path=False) + copy(self, "unlicense.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() def package_info(self): self.cpp_info.libs = ["tiny-aes"] - self.cpp_info.defines = self._cflags + self.cpp_info.defines.extend([f"{definition}={value}" for definition, value in self._aes_defs.items()]) diff --git a/recipes/tiny-aes-c/all/patches/0001-cmake-install.patch b/recipes/tiny-aes-c/all/patches/0001-cmake-install.patch new file mode 100644 index 00000000000000..bc75d2b9edd8c5 --- /dev/null +++ b/recipes/tiny-aes-c/all/patches/0001-cmake-install.patch @@ -0,0 +1,14 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,3 +7,11 @@ add_library(tiny-aes + ) + + target_include_directories(tiny-aes PRIVATE tiny-AES-c/) ++include(GNUInstallDirs) ++install(FILES aes.h aes.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++install( ++ TARGETS tiny-aes ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) diff --git a/recipes/tiny-aes-c/all/test_package/CMakeLists.txt b/recipes/tiny-aes-c/all/test_package/CMakeLists.txt index a5c315a7b4677e..40e72103cc9fcf 100644 --- a/recipes/tiny-aes-c/all/test_package/CMakeLists.txt +++ b/recipes/tiny-aes-c/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C CXX) find_package(tiny-aes-c REQUIRED CONFIG) add_executable(test_package_c test_package.c) add_executable(test_package_cpp test_package.cpp) -target_link_libraries(test_package_c tiny-aes-c::tiny-aes-c) -target_link_libraries(test_package_cpp tiny-aes-c::tiny-aes-c) +target_link_libraries(test_package_c PRIVATE tiny-aes-c::tiny-aes-c) +target_link_libraries(test_package_cpp PRIVATE tiny-aes-c::tiny-aes-c) diff --git a/recipes/tiny-aes-c/all/test_package/conanfile.py b/recipes/tiny-aes-c/all/test_package/conanfile.py index f90f6273aa3a6d..66426ef544d607 100644 --- a/recipes/tiny-aes-c/all/test_package/conanfile.py +++ b/recipes/tiny-aes-c/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,8 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package_c") - self.run(bin_path, run_environment=True) - bin_path = os.path.join("bin", "test_package_cpp") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_c") + self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") + self.run(bin_path, env="conanrun") diff --git a/recipes/tiny-aes-c/all/test_v1_package/CMakeLists.txt b/recipes/tiny-aes-c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/tiny-aes-c/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tiny-aes-c/all/test_v1_package/conanfile.py b/recipes/tiny-aes-c/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..43f372e78e8c31 --- /dev/null +++ b/recipes/tiny-aes-c/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package_c") + self.run(bin_path, run_environment=True) + bin_path = os.path.join("bin", "test_package_cpp") + self.run(bin_path, run_environment=True) From ee36b3756e6480f6238161052efc09c5f267dba1 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Mon, 24 Oct 2022 21:05:26 -0500 Subject: [PATCH 175/300] (#13721) eigen: Use export_conanadata_patches and explicit test_type --- recipes/eigen/all/conanfile.py | 13 ++++++------- recipes/eigen/all/test_package/CMakeLists.txt | 6 +++--- recipes/eigen/all/test_package/conanfile.py | 1 + recipes/eigen/all/test_package/test_package.cpp | 4 ++-- recipes/eigen/all/test_v1_package/CMakeLists.txt | 6 ++---- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/recipes/eigen/all/conanfile.py b/recipes/eigen/all/conanfile.py index 54efcdf97a0f3d..f51dcb30af47e9 100644 --- a/recipes/eigen/all/conanfile.py +++ b/recipes/eigen/all/conanfile.py @@ -2,9 +2,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class EigenConan(ConanFile): @@ -13,8 +13,7 @@ class EigenConan(ConanFile): homepage = "http://eigen.tuxfamily.org" description = "Eigen is a C++ template library for linear algebra: matrices, vectors," \ " numerical solvers, and related algorithms." - topics = ("eigen", "algebra", "linear-algebra", "vector", "numerical") - + topics = ("algebra", "linear-algebra", "matrix", "vector", "numerical") settings = "os", "arch", "compiler", "build_type" options = { "MPL2_only": [True, False], @@ -31,14 +30,14 @@ def layout(self): cmake_layout(self, src_folder="src") def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, patch["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def package_id(self): self.info.clear() def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/eigen/all/test_package/CMakeLists.txt b/recipes/eigen/all/test_package/CMakeLists.txt index c4fdf0bd1c765a..7a24919989d146 100644 --- a/recipes/eigen/all/test_package/CMakeLists.txt +++ b/recipes/eigen/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.16) -project(test_package) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) find_package(Eigen3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Eigen3::Eigen) +target_link_libraries(${PROJECT_NAME} PRIVATE Eigen3::Eigen) diff --git a/recipes/eigen/all/test_package/conanfile.py b/recipes/eigen/all/test_package/conanfile.py index cf2b5ffb9883da..c0ba081cf41ea7 100644 --- a/recipes/eigen/all/test_package/conanfile.py +++ b/recipes/eigen/all/test_package/conanfile.py @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/eigen/all/test_package/test_package.cpp b/recipes/eigen/all/test_package/test_package.cpp index 69a884db4af918..a253d7f1b2200f 100644 --- a/recipes/eigen/all/test_package/test_package.cpp +++ b/recipes/eigen/all/test_package/test_package.cpp @@ -9,8 +9,8 @@ int main(void) Eigen::MatrixXi A(N, N); A.setRandom(); - std::cout << "A =\n" << A << '\n' < Date: Tue, 25 Oct 2022 09:42:25 +0200 Subject: [PATCH 176/300] (#13740) Revert "actions: upgrade changed-files version" This reverts commit 016bfda6f6f613e5be0806c85e8ef4b01f681df0. --- .github/workflows/linter-conan-v2.yml | 15 ++++++--------- .github/workflows/linter-yaml.yml | 13 +++++-------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/.github/workflows/linter-conan-v2.yml b/.github/workflows/linter-conan-v2.yml index 5373722197fb8a..7a002314625378 100644 --- a/.github/workflows/linter-conan-v2.yml +++ b/.github/workflows/linter-conan-v2.yml @@ -16,12 +16,11 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 + fetch-depth: 2 - name: Get changed files - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 id: changed_files with: - base_sha: ${{ github.event.pull_request.base.sha }} files: | linter/** - name: Get Conan v1 version @@ -85,12 +84,11 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 + fetch-depth: 2 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 with: - base_sha: ${{ github.event.pull_request.base.sha }} files: | recipes/*/*/conanfile.py - name: Get Conan v1 version @@ -121,12 +119,11 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 + fetch-depth: 2 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 with: - base_sha: ${{ github.event.pull_request.base.sha }} files: | recipes/*/*/test_*/conanfile.py - name: Get Conan v1 version diff --git a/.github/workflows/linter-yaml.yml b/.github/workflows/linter-yaml.yml index 850bd3d240a9e1..59e73e83b163c0 100644 --- a/.github/workflows/linter-yaml.yml +++ b/.github/workflows/linter-yaml.yml @@ -17,13 +17,12 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 + fetch-depth: 2 - name: Get changed files - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 id: changed_files with: - base_sha: ${{ github.event.pull_request.base.sha }} files: | linter/** @@ -52,7 +51,7 @@ jobs: steps: - uses: actions/checkout@v3 with: - fetch-depth: 0 + fetch-depth: 2 - uses: actions/setup-python@v4 with: @@ -65,9 +64,8 @@ jobs: - name: Get changed files (config) id: changed_files_config if: always() - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 with: - base_sha: ${{ github.event.pull_request.base.sha }} files: | ${{ env.CONFIG_FILES_PATH }} @@ -82,9 +80,8 @@ jobs: - name: Get changed files (conandata) id: changed_files_conandata if: always() - uses: tj-actions/changed-files@v32 + uses: tj-actions/changed-files@v20 with: - base_sha: ${{ github.event.pull_request.base.sha }} files: | ${{ env.CONANDATA_FILES_PATH }} From 9b4e8a3c7e5e117685a56c6ab3e36df229fc2e05 Mon Sep 17 00:00:00 2001 From: theirix Date: Tue, 25 Oct 2022 14:05:54 +0300 Subject: [PATCH 177/300] (#13631) exiv2: add 0.27.5 + conan v2 support * Add exiv2 0.27.5 * Bump deps * Add v2 test packages * Use Conan v2 * Set CMAKE_POLICY_DEFAULT_CMP0077 Co-authored-by: Uilian Ries * Set fPIC via cache variable Co-authored-by: Uilian Ries * Parse boolean variable for cache_variable Wait until 1.53.0 which will fix parsing * Generate cmake deps * Provide patch for finding EXPAT as module, #10387 Co-authored-by: Uilian Ries --- recipes/exiv2/all/CMakeLists.txt | 7 -- recipes/exiv2/all/conandata.yml | 15 ++- recipes/exiv2/all/conanfile.py | 109 ++++++++---------- .../exiv2/all/patches/0001-link-0.27.5.patch | 29 +++++ .../exiv2/all/patches/0004-find-expat.patch | 15 +++ recipes/exiv2/all/test_package/CMakeLists.txt | 3 - recipes/exiv2/all/test_package/conanfile.py | 20 +++- .../exiv2/all/test_v1_package/CMakeLists.txt | 10 ++ .../exiv2/all/test_v1_package/conanfile.py | 17 +++ recipes/exiv2/config.yml | 2 + 10 files changed, 148 insertions(+), 79 deletions(-) delete mode 100644 recipes/exiv2/all/CMakeLists.txt create mode 100644 recipes/exiv2/all/patches/0001-link-0.27.5.patch create mode 100644 recipes/exiv2/all/patches/0004-find-expat.patch create mode 100644 recipes/exiv2/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/exiv2/all/test_v1_package/conanfile.py diff --git a/recipes/exiv2/all/CMakeLists.txt b/recipes/exiv2/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d4..00000000000000 --- a/recipes/exiv2/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/exiv2/all/conandata.yml b/recipes/exiv2/all/conandata.yml index b738a41a9258ff..5352f4d8920bf4 100644 --- a/recipes/exiv2/all/conandata.yml +++ b/recipes/exiv2/all/conandata.yml @@ -1,12 +1,21 @@ sources: + "0.27.5": + url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.27.5.tar.gz" + sha256: "1da1721f84809e4d37b3f106adb18b70b1b0441c860746ce6812bb3df184ed6c" "0.27.4": url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.27.4.tar.gz" sha256: "9fb2752c92f63c9853e0bef9768f21138eeac046280f40ded5f37d06a34880d9" patches: + "0.27.5": + - patch_file: "patches/0001-link-0.27.5.patch" + - patch_file: "patches/0003-fix-ios.patch" + - patch_file: "patches/0004-find-expat.patch" + patch_description: "enforce usage of FindEXPAT.cmake" + patch_type: "conan" "0.27.4": - patch_file: "patches/0001-link.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-fpic.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-fix-ios.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-find-expat.patch" + patch_description: "enforce usage of FindEXPAT.cmake" + patch_type: "conan" diff --git a/recipes/exiv2/all/conanfile.py b/recipes/exiv2/all/conanfile.py index d444470618ff43..ba73c4ac8d3637 100644 --- a/recipes/exiv2/all/conanfile.py +++ b/recipes/exiv2/all/conanfile.py @@ -1,10 +1,12 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, save, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc, msvc_runtime_flag import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class Exiv2Conan(ConanFile): @@ -34,25 +36,8 @@ class Exiv2Conan(ConanFile): provides = [] - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_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"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -67,56 +52,61 @@ def configure(self): self.provides.append("xmp-toolkit-sdk") def requirements(self): - self.requires("libiconv/1.16") + self.requires("libiconv/1.17") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.38") if self.options.with_xmp == "bundled": - self.requires("expat/2.4.3") + self.requires("expat/2.4.9") if self.options.with_curl: - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.85.0") def validate(self): if self.options.with_xmp == "external": raise ConanInvalidConfiguration("adobe-xmp-toolkit is not available on cci (yet)") + def layout(self): + cmake_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["EXIV2_BUILD_SAMPLES"] = False + tc.variables["EXIV2_BUILD_EXIV2_COMMAND"] = False + tc.variables["EXIV2_ENABLE_PNG"] = self.options.with_png + tc.variables["EXIV2_ENABLE_XMP"] = self.options.with_xmp == "bundled" + tc.variables["EXIV2_ENABLE_EXTERNAL_XMP"] = self.options.with_xmp == "external" + # NLS is used only for tool which is not built + tc.variables["EXIV2_ENABLE_NLS"] = False + tc.variables["EXIV2_ENABLE_WEBREADY"] = self.options.with_curl + tc.variables["EXIV2_ENABLE_CURL"] = self.options.with_curl + tc.variables["EXIV2_ENABLE_SSH"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + + if is_msvc(self): + tc.variables["EXIV2_ENABLE_DYNAMIC_RUNTIME"] = "MD" in msvc_runtime_flag(self) + # set PIC manually because of object target exiv2_int + tc.cache_variables["CMAKE_POSITION_INDEPENDENT_CODE"] = bool(self.options.get_safe("fPIC", True)) + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["EXIV2_BUILD_SAMPLES"] = False - self._cmake.definitions["EXIV2_BUILD_EXIV2_COMMAND"] = False - self._cmake.definitions["EXIV2_ENABLE_PNG"] = self.options.with_png - self._cmake.definitions["EXIV2_ENABLE_XMP"] = self.options.with_xmp == "bundled" - self._cmake.definitions["EXIV2_ENABLE_EXTERNAL_XMP"] = self.options.with_xmp == "external" - # NLS is used only for tool which is not built - self._cmake.definitions["EXIV2_ENABLE_NLS"] = False - self._cmake.definitions["EXIV2_ENABLE_WEBREADY"] = self.options.with_curl - self._cmake.definitions["EXIV2_ENABLE_CURL"] = self.options.with_curl - self._cmake.definitions["EXIV2_ENABLE_SSH"] = False - if self._is_msvc: - self._cmake.definitions["EXIV2_ENABLE_DYNAMIC_RUNTIME"] = "MD" in msvc_runtime_flag(self) - # set PIC manually because of object target exiv2_int - self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed targets = {"exiv2lib": "exiv2::exiv2lib"} @@ -127,8 +117,7 @@ def package(self): targets ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -137,7 +126,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): diff --git a/recipes/exiv2/all/patches/0001-link-0.27.5.patch b/recipes/exiv2/all/patches/0001-link-0.27.5.patch new file mode 100644 index 00000000000000..b94b7e7a8c10cd --- /dev/null +++ b/recipes/exiv2/all/patches/0001-link-0.27.5.patch @@ -0,0 +1,29 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 26e5a951..141211ef 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -142,11 +142,6 @@ if (MSVC) + set_target_properties(exiv2lib PROPERTIES LINK_FLAGS "/ignore:4099") + endif() + +-set_target_properties( exiv2lib_int PROPERTIES +- POSITION_INDEPENDENT_CODE ON +- COMPILE_DEFINITIONS exiv2lib_EXPORTS +-) +- + # NOTE: Cannot use target_link_libraries on OBJECT libraries with old versions of CMake + target_include_directories(exiv2lib_int PRIVATE ${ZLIB_INCLUDE_DIR}) + target_include_directories(exiv2lib SYSTEM PRIVATE +diff --git a/xmpsdk/CMakeLists.txt b/xmpsdk/CMakeLists.txt +index a22698fb..9ef87970 100644 +--- a/xmpsdk/CMakeLists.txt ++++ b/xmpsdk/CMakeLists.txt +@@ -28,7 +28,7 @@ add_library(exiv2-xmp STATIC + + target_link_libraries(exiv2-xmp + PRIVATE +- $ ++ EXPAT::EXPAT + ) + + target_include_directories(exiv2-xmp diff --git a/recipes/exiv2/all/patches/0004-find-expat.patch b/recipes/exiv2/all/patches/0004-find-expat.patch new file mode 100644 index 00000000000000..5bb571eb0f8079 --- /dev/null +++ b/recipes/exiv2/all/patches/0004-find-expat.patch @@ -0,0 +1,15 @@ +Ensure to use FindEXPAT.cmake instead of expat-config.cmake +(side effect of CMAKE_FIND_PACKAGE_PREFER_CONFIG ON, see https://github.com/conan-io/conan/issues/10387) +diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake +index ec3a43f5..27bf42d3 100644 +--- a/cmake/findDependencies.cmake ++++ b/cmake/findDependencies.cmake +@@ -42,7 +42,7 @@ if (EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP) + message(FATAL_ERROR "EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP are mutually exclusive. You can only choose one of them") + else() + if (EXIV2_ENABLE_XMP) +- find_package(EXPAT REQUIRED) ++ find_package(EXPAT REQUIRED MODULE) + elseif (EXIV2_ENABLE_EXTERNAL_XMP) + find_package(XmpSdk REQUIRED) + endif () diff --git a/recipes/exiv2/all/test_package/CMakeLists.txt b/recipes/exiv2/all/test_package/CMakeLists.txt index e1868b6302fec1..3bd4318c428bac 100644 --- a/recipes/exiv2/all/test_package/CMakeLists.txt +++ b/recipes/exiv2/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(exiv2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/exiv2/all/test_package/conanfile.py b/recipes/exiv2/all/test_package/conanfile.py index b6a26067f365d7..3a8c6c5442b33b 100644 --- a/recipes/exiv2/all/test_package/conanfile.py +++ b/recipes/exiv2/all/test_package/conanfile.py @@ -1,10 +1,18 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/exiv2/all/test_v1_package/CMakeLists.txt b/recipes/exiv2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..f62a34fb6ca55b --- /dev/null +++ b/recipes/exiv2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(exiv2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} exiv2lib) diff --git a/recipes/exiv2/all/test_v1_package/conanfile.py b/recipes/exiv2/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..b6a26067f365d7 --- /dev/null +++ b/recipes/exiv2/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/exiv2/config.yml b/recipes/exiv2/config.yml index 487a32d2a94543..470d3a327a30b2 100644 --- a/recipes/exiv2/config.yml +++ b/recipes/exiv2/config.yml @@ -1,3 +1,5 @@ versions: + "0.27.5": + folder: all "0.27.4": folder: all From 12a158a68ec5d4a3c9356d2ca18270c09a95f434 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Tue, 25 Oct 2022 06:44:49 -0500 Subject: [PATCH 178/300] (#13723) yaml-cpp: Use export_conandata_patches and safely delete fPIC option --- recipes/yaml-cpp/all/conanfile.py | 13 +++++++------ recipes/yaml-cpp/all/test_package/conanfile.py | 1 + recipes/yaml-cpp/all/test_v1_package/CMakeLists.txt | 11 ++++------- recipes/yaml-cpp/all/test_v1_package/conanfile.py | 1 - 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/recipes/yaml-cpp/all/conanfile.py b/recipes/yaml-cpp/all/conanfile.py index c82f3534a578a0..7e5bbdd96dbd37 100644 --- a/recipes/yaml-cpp/all/conanfile.py +++ b/recipes/yaml-cpp/all/conanfile.py @@ -2,12 +2,12 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class YamlCppConan(ConanFile): @@ -17,7 +17,6 @@ class YamlCppConan(ConanFile): topics = ("yaml", "yaml-parser", "serialization", "data-serialization") description = "A YAML parser and emitter in C++" license = "MIT" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +28,7 @@ class YamlCppConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,7 +36,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def validate(self): if self.info.settings.compiler.cppstd: diff --git a/recipes/yaml-cpp/all/test_package/conanfile.py b/recipes/yaml-cpp/all/test_package/conanfile.py index 3a8c6c5442b33b..836780b694c107 100644 --- a/recipes/yaml-cpp/all/test_package/conanfile.py +++ b/recipes/yaml-cpp/all/test_package/conanfile.py @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/yaml-cpp/all/test_v1_package/CMakeLists.txt b/recipes/yaml-cpp/all/test_v1_package/CMakeLists.txt index 9960181468073e..925ecbe19e448d 100644 --- a/recipes/yaml-cpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/yaml-cpp/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(yaml-cpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/yaml-cpp/all/test_v1_package/conanfile.py b/recipes/yaml-cpp/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/yaml-cpp/all/test_v1_package/conanfile.py +++ b/recipes/yaml-cpp/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os From 70d9c6b69e67d33fa5cb04b3e9936c76a1f75e33 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Tue, 25 Oct 2022 05:25:05 -0700 Subject: [PATCH 179/300] (#13274) linters: Add annotations for YAML lint + add schema verification for `config.yml` and `conandata.yml` * first attempt at a yaml linter wit github actions output * This is less strict but has more information * fixup message * run config linter in Action * better ux feedback * try to use newlines https://github.com/actions/toolkit/issues/193#issuecomment-605394935 * clean up * fixup file name * trying custom class for quoted str * underlying yaml parser does not keep quotes * trying to catch ints as problems * remove test code * and to "linter testing" * install deps * run new linter unconditionally * revert testing changes * new script for conandata (this one is much harder to spec) * debugging * lets see all the errors * yamale -s ../linter/config_yaml_schema.yml aaf/config.yml from linters folder as a test * adjust script to match meeting discussion * make sure the docs and linters match * fix link * Update conandata.yml * exit 1 is not needed with annotations * add annotation matchers for yaml since those do do much * fix search for type * fix whitespace * tryout a yamllint file with a better looking matcher * copy syntax from readme * test if it's running in the wrong dir :thinking: * try with debug output * bump since i dont have permissions * bump - dont glob star * bump * less star globs * also add action to conandata way * bump * drop action for cli + matcher * more docs around linters * fix file and name * cleanup --- .github/workflows/linter-yaml.yml | 47 +++++- docs/conandata_yml_format.md | 156 ++++++++---------- docs/developing_recipes_locally.md | 46 ++++++ docs/linters.md | 28 ++-- .../autotools_package/all/conandata.yml | 14 +- .../cmake_package/all/conandata.yml | 14 +- .../header_only/all/conandata.yml | 14 +- .../meson_package/all/conandata.yml | 13 +- .../msbuild_package/all/conandata.yml | 14 +- linter/conandata_yaml_linter.py | 82 +++++++++ linter/config_yaml_linter.py | 37 +++++ linter/yaml_linting.py | 9 + linter/yamllint_matcher.json | 22 +++ 13 files changed, 354 insertions(+), 142 deletions(-) create mode 100644 linter/conandata_yaml_linter.py create mode 100644 linter/config_yaml_linter.py create mode 100644 linter/yaml_linting.py create mode 100644 linter/yamllint_matcher.json diff --git a/.github/workflows/linter-yaml.yml b/.github/workflows/linter-yaml.yml index 59e73e83b163c0..edc701a2db86da 100644 --- a/.github/workflows/linter-yaml.yml +++ b/.github/workflows/linter-yaml.yml @@ -6,8 +6,8 @@ on: env: PYTHONPATH: ${{github.workspace}} PYVER: "3.8" - CONFIG_FILES_PATH: "recipes/**/config.yml" - CONANDATA_FILES_PATH: "recipes/**/**/conandata.yml" + CONFIG_FILES_PATH: "recipes/*/config.yml" + CONANDATA_FILES_PATH: "recipes/*/*/conandata.yml" jobs: test_linter: @@ -33,16 +33,35 @@ jobs: - name: Install dependencies if: steps.changed_files.outputs.any_changed == 'true' - run: pip install yamllint + run: pip install yamllint strictyaml argparse - name: Run linter (config.yml) if: steps.changed_files.outputs.any_changed == 'true' && always() - run: yamllint --config-file linter/yamllint_rules.yml -f parsable ${{ env.CONFIG_FILES_PATH }} + run: | + echo "::add-matcher::linter/yamllint_matcher.json" + yamllint --config-file linter/yamllint_rules.yml -f standard ${{ env.CONFIG_FILES_PATH }} + echo "::remove-matcher owner=yamllint_matcher::" + + - name: Run schema check (config.yml) + if: steps.changed_files.outputs.any_changed == 'true' && always() + run: | + for file in ${{ env.CONFIG_FILES_PATH }}; do + python3 linter/config_yaml_linter.py ${file} + done - name: Run linter (conandata.yml) if: steps.changed_files.outputs.any_changed == 'true' && always() - run: yamllint --config-file linter/yamllint_rules.yml -f parsable ${{ env.CONANDATA_FILES_PATH }} + run: | + echo "::add-matcher::linter/yamllint_matcher.json" + yamllint --config-file linter/yamllint_rules.yml -f standard ${{ env.CONANDATA_FILES_PATH }} + echo "::remove-matcher owner=yamllint_matcher::" + - name: Run schema check (conandata.yml) + if: steps.changed_files.outputs.any_changed == 'true' && always() + run: | + for file in ${{ env.CONANDATA_FILES_PATH }}; do + python3 linter/conandata_yaml_linter.py ${file} + done lint_pr_files: # Lint files modified in the pull_request @@ -58,7 +77,7 @@ jobs: python-version: ${{ env.PYVER }} - name: Install dependencies - run: pip install yamllint + run: pip install yamllint strictyaml argparse ## Work on config.yml files - name: Get changed files (config) @@ -72,8 +91,14 @@ jobs: - name: Run linter (config.yml) if: steps.changed_files_config.outputs.any_changed == 'true' && always() run: | + echo "::add-matcher::linter/yamllint_matcher.json" for file in ${{ steps.changed_files_config.outputs.all_changed_files }}; do - yamllint --config-file linter/yamllint_rules.yml ${file} + yamllint --config-file linter/yamllint_rules.yml -f standard ${file} + done + echo "::remove-matcher owner=yamllint_matcher::" + + for file in ${{ steps.changed_files_conandata.outputs.all_changed_files }}; do + python3 linter/config_yaml_linter.py ${file} done ## Work on conandata.yml files @@ -88,6 +113,12 @@ jobs: - name: Run linter (conandata.yml) if: steps.changed_files_conandata.outputs.any_changed == 'true' && always() run: | + echo "::add-matcher::linter/yamllint_matcher.json" + for file in ${{ steps.changed_files_conandata.outputs.all_changed_files }}; do + yamllint --config-file linter/yamllint_rules.yml -f standard ${file} + done + echo "::remove-matcher owner=yamllint_matcher::" + for file in ${{ steps.changed_files_conandata.outputs.all_changed_files }}; do - yamllint --config-file linter/yamllint_rules.yml ${file} + python3 linter/conandata_yaml_linter.py ${file} done diff --git a/docs/conandata_yml_format.md b/docs/conandata_yml_format.md index fed5e9e4643961..df72a653e73f76 100644 --- a/docs/conandata_yml_format.md +++ b/docs/conandata_yml_format.md @@ -1,13 +1,11 @@ # conandata.yml -[conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html) is a [YAML](https://yaml.org/) file to provide declarative data for the recipe (which is imperative). +[conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html) is a [YAML](https://yaml.org/) file to provide declarative data for the recipe (which is imperative). `conandata.yml` is a built-in Conan feature (available since 1.22.0) without a fixed structure, but ConanCenterIndex uses it for its own purposes and imposes some requirements. -`conandata.yml` is a built-in Conan feature (available since 1.22.0) without a fixed structure, but conan-center-index uses it for its own purposes. +In the context of ConanCenterIndex, this file is mandatory and consists of two main sections that we will explain in the next sections with more detail: -In the context of conan-center-index, this file is mandatory and consists of two main sections that we will explain in the next sections with more detail: - - * `sources`: Library sources origin with their verification checksums. - * `patches`: Details about the different patches the library needs for several reasons. +* `sources`: Library sources origin with their verification checksums. Freeform structure specific to a recipe. +* `patches`: Details about the different patches the library needs along with details for traceability. ## Contents @@ -58,90 +56,79 @@ sources: Every entry for a version consists in a dictionary with the `url` and the hashing algorithm of the artifact. `sha256` is required, but others like `sha1` or `md5` can be used as well. ### Mirrors + Sometimes it is useful to declare mirrors, use a list in the `url` field. Conan will try to download the artifacts from any of those mirrors. ```yml sources: "1.2.11": - url: [ - "https://zlib.net/zlib-1.2.11.tar.gz", - "https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz", - ] + url: + - "https://zlib.net/zlib-1.2.11.tar.gz", + - "https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz", sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1" ``` Keep in mind all the mirrors have to provide the exactly same source (e.g. no repackaging), thus using the same hash sum. -### Sources fields - -#### url - -`url` contains a string specifying [URI](https://tools.ietf.org/html/rfc3986) where to download released sources. -Usually, `url` has a [https](https://tools.ietf.org/html/rfc2660) scheme, but other schemes, such as [ftp](https://tools.ietf.org/html/rfc959) are accepted as well. - -#### sha256 - -[sha256](https://tools.ietf.org/html/rfc6234) is a preferred method to specify hash sum for the released sources. It allows to check the integrity of sources downloaded. -You may use an [online service](https://hash.online-convert.com/sha256-generator) to compute `sha256` sum for the given `url`. -Also, you may use [sha256sum](https://linux.die.net/man/1/sha256sum) command ([windows](http://www.labtestproject.com/files/win/sha256sum/sha256sum.exe)). - -#### sha1 - -[sha1](https://tools.ietf.org/html/rfc3174) is an alternate method to specify hash sum. It's usage is discouraged and `sha256` is preferred. - -#### md5 +### Multiple Assets -[md5](https://tools.ietf.org/html/rfc1321) is an alternate method to specify hash sum. It's usage is discouraged and `sha256` is preferred. +It's rare but some projects ship archives missing files that are required to build or specifically to ConanCenter requirements. +You can name each asset and download them in the `conanfile.py`'s `source()` referring to the names. -### Other cases - -There are other ways to specify sources to cover other cases. - -#### Source code & license - -Certain projects provide license on their own, and released artifacts do not include it. In this case, a license URL can be provided separately: - -``` +```yml sources: - 8.0.0: - - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.8.0.0/ApprovalTests.v.8.0.0.hpp - sha256: e16a97081f8582be951d95a9d53dc611f1f5a84e117a477029890d0b34ae99d6 - - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.8.0.0/LICENSE" + "10.12.2": + "sources": + url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.12.2/ApprovalTests.v.10.12.2.hpp + sha256: 4c43d0ea98669e3d6fbb5810cc47b19adaf88cabb1421b488aa306b08c434131 + "license": + url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.12.2/LICENSE" sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 ``` -#### Several source code archives - -Some projects may include multiple tarballs as a part of release, [OpenCV](https://opencv.org/) is an example which includes auxiliary [contrib](https://github.com/opencv/opencv_contrib) archive: +You can list as many assets you need and reference them by their index. But make sure you keep them in order if there is any specific +logic about handling. -``` +```yml sources: - "4.5.0": - - sha256: dde4bf8d6639a5d3fe34d5515eab4a15669ded609a1d622350c7ff20dace1907 - url: https://github.com/opencv/opencv/archive/4.5.0.tar.gz - - sha256: a65f1f0b98b2c720abbf122c502044d11f427a43212d85d8d2402d7a6339edda - url: https://github.com/opencv/opencv_contrib/archive/4.5.0.tar.gz + "10.12.2": + - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.12.2/ApprovalTests.v.10.12.2.hpp + sha256: 4c43d0ea98669e3d6fbb5810cc47b19adaf88cabb1421b488aa306b08c434131 + - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.12.2/LICENSE" + sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 ``` -#### Different source code archives per configuration +#### Different source archives per configuration -This is the most advanced and sophisticated use-case, but no so common. Some projects may provide different sources for different platforms for awkward reasons, it could be expressed as: +This is the most advanced and sophisticated use-case, but not so common. Some projects may provide different sources for different platforms, it could be expressed as: -``` +```yml sources: "0066": - "Macos": - "apple-clang": - "x86": - - url: "https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0066/C/MacIntel_OSX_AppleC_32bit/packages/cspice.tar.Z" - sha256: "9a4b5f674ea76821c43aa9140829da4091de646ef3ce40fd5be1d09d7c37b6b3" - "x86_64": - - url: "https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0066/C/MacIntel_OSX_AppleC_64bit/packages/cspice.tar.Z" - sha256: "f5d48c4b0d558c5d71e8bf6fcdf135b0943210c1ff91f8191dfc447419a6b12e" + "Macos": # Operating system + "x86": # Architecture + - url: "https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0066/C/MacIntel_OSX_AppleC_32bit/packages/cspice.tar.Z" + sha256: "9a4b5f674ea76821c43aa9140829da4091de646ef3ce40fd5be1d09d7c37b6b3" + "x86_64": + - url: "https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0066/C/MacIntel_OSX_AppleC_64bit/packages/cspice.tar.Z" + sha256: "f5d48c4b0d558c5d71e8bf6fcdf135b0943210c1ff91f8191dfc447419a6b12e" ``` This approach requires a special code within [build](https://docs.conan.io/en/latest/reference/conanfile/methods.html#build) method to handle. +### Sources fields + +#### url + +`url` contains a string specifying [URI](https://tools.ietf.org/html/rfc3986) where to download released sources. +Usually, `url` has a [https](https://tools.ietf.org/html/rfc2660) scheme, but other schemes, such as [ftp](https://tools.ietf.org/html/rfc959) are accepted as well. + +#### sha256 + +[sha256](https://tools.ietf.org/html/rfc6234) is a preferred method to specify hash sum for the released sources. It allows to check the integrity of sources downloaded. +You may use an [online service](https://hash.online-convert.com/sha256-generator) to compute `sha256` sum for the given `url`. +Also, you may use [sha256sum](https://linux.die.net/man/1/sha256sum) command ([windows](http://www.labtestproject.com/files/win/sha256sum/sha256sum.exe)). + ## patches Sometimes sources provided by project require patching for various reasons. The `conandata.yml` file is the right place to indicate this information as well. @@ -154,19 +141,20 @@ patches: - patch_file: "patches/1.2.0-002-link-core-with-find-library.patch" patch_description: "Link CoreFoundation and CoreServices with find_library" patch_type: "portability" - base_path: "source_subfolder" patch_source: "https://a-url-to-a-pull-request-mail-list-topic-issue-or-question" sha256: "qafe4rq54533qa43esdaq53ewqa5" ``` ### Patches fields +Theres are necessary for Conan to work as well as provide key information to reviewers and consumers which need to understand +the reasoning behind patches. + #### patch_file _Required_ -Patch file might be committed to the conan-center-index, near to the conanfile (usually, into the `patches` sub-directory). Such patch files usually have either `.diff` or `.patch` extension. -The recommended way to generate such patches is [git format-patch](https://git-scm.com/docs/git-format-patch). The path to the patch is relative to the directory containing `conandata.yml` and `conanfile.py`. +Patch file that are committed to the ConanCenterIndex, go into the `patches` sub-directory (next to the `conanfile.py`). Such patch files usually have either `.diff` or `.patch` extension. The recommended way to generate such patches is [git format-patch](https://git-scm.com/docs/git-format-patch). The path to the patch is relative to the directory containing `conandata.yml` and `conanfile.py`. #### patch_description @@ -174,9 +162,9 @@ _Required_ `patch_description` is an arbitrary text describing the following aspects of the patch: -- What does patch do (example - `add missing unistd.h header`) -- Why is it necessary (example - `port to Android`) -- How exactly does patch achieve that (example - `update configure.ac`) +* What does patch do (example - `add missing unistd.h header`) +* Why is it necessary (example - `port to Android`) +* How exactly does patch achieve that (example - `update configure.ac`) An example of a full patch description could be: `port to Android: update configure.ac adding missing unistd.h header`. @@ -184,7 +172,7 @@ An example of a full patch description could be: `port to Android: update config _Required_ -The `patch_type` field specifies the type of the patch. In conan-center-index we currently accept only several kind of patches: +The `patch_type` field specifies the type of the patch. In ConanCenterIndex we currently accept only several kind of patches: ##### official @@ -199,18 +187,20 @@ Usually, original library projects do new releases fixing vulnerabilities for th ##### backport -`patch_type: backport`: Indicates a patch that backports an existing bug fix from the newer release or master branch (or equivalent, such as main/develop/trunk/etc). The patch source may be a pull request, or bug within the project's issue tracker. +> **Note**: These are likely to undergo extra scrutiny during review as they may modify the source code. + +`patch_type: backport`: Indicates a patch that backports an existing bug fix from the newer release or master branch (or equivalent, such as main/develop/trunk/etc). The [`patch_source`](#patch_source) may be a pull request, or bug within the project's issue tracker. Backports are accepted only for bugs that break normal execution flow, never for feature requests. Usually, the following kind of problems are good candidates for backports: -- Program doesn't start at all. -- Crash (segmentation fault or access violation). -- Hang up or deadlock. -- Memory leak or resource leak in general. -- Garbage output. -- Abnormal termination without a crash (e.g. just exit code 1 at very beginning of the execution). -- Data corruption. -- Use of outdated or deprecated API or library. +* Program doesn't start at all. +* Crash (segmentation fault or access violation). +* Hang up or deadlock. +* Memory leak or resource leak in general. +* Garbage output. +* Abnormal termination without a crash (e.g. just exit code 1 at very beginning of the execution). +* Data corruption. +* Use of outdated or deprecated API or library. As sources with backports don't act exactly the same as the version officially released, it may be a source of confusion for the consumers who are relying on the buggy behavior (even if it's completely wrong). Therefore, it's required to introduce a new `cci.` version for such backports, so consumers may choose to use either official version, or modified version with backport(s) included. @@ -233,11 +223,11 @@ _Optional_ `patch_source` is the URL from where patch was taken from. https scheme is preferred, but other URLs (e.g. git/svn/hg) are also accepted if there is no alternative. Types of patch sources are: -- Link to the public commit in project hosting like GitHub/GitLab/BitBucket/Savanha/SourceForge/etc. -- Link to the Pull Request or equivalent (e.g. gerrit review). -- Link to the bug tracker (such as JIRA, BugZilla, etc.). -- Link to the mail list discussion. -- Link to the patch itself in another repository (e.g. MSYS, Debian, etc.). +* Link to the public commit in project hosting like GitHub/GitLab/BitBucket/Savanha/SourceForge/etc. +* Link to the Pull Request or equivalent (e.g. gerrit review). +* Link to the bug tracker (such as JIRA, BugZilla, etc.). +* Link to the mail list discussion. +* Link to the patch itself in another repository (e.g. MSYS, Debian, etc.). For the `patch_type: portability` there might be no patch source matching the definition above. Although we encourage contributors to submit all such portability fixes upstream first, it's not always possible (e.g. for projects no longer maintained). In that case, a link to the Conan issue is a valid patch source (if there is no issue, you may [create](https://github.com/conan-io/conan-center-index/issues/new/choose) one). For the `patch_type: conan`, it doesn't make sense to submit patch upstream, so there will be no patch source. diff --git a/docs/developing_recipes_locally.md b/docs/developing_recipes_locally.md index 57d98ecb3a216a..4700687fa8c8c6 100644 --- a/docs/developing_recipes_locally.md +++ b/docs/developing_recipes_locally.md @@ -124,6 +124,52 @@ It is possible to run the linter locally the same way it is being run [using Git pylint --rcfile=linter/pylintrc_testpackage recipes/fmt/all/test_package/conanfile.py ``` +## Running the YAML Linters + +There's two levels of YAML validation, first is syntax and the second is schema. +The style rules are located in [`linter/yamllint_rules.yml`](../linter/yamllint_rules.yml) and are used to ensure consistence. +The [`config.yml](how_to_add_packages.md#configyml) is required for the build infrastructure and the +[`conandata.yml` patch fields](conandata_yml_format.md#patches-fields) have required elements that are enforced with +schema validation. There's are to encourage the best possible quality of recipes and make reviewing faster. + +### Yamllint + +* (Recommended) Use a dedicated Python virtualenv. +* Ensure you have required tools installed: `yamllint` (better to uses fixed versions) + + ```sh + pip install yamllint==1.28 + ``` + +* Now you just need to execute the `yamllint` commands: + + ```sh + # Lint a recipe: + yamllint --config-file linter/yamllint_rules.yml -f standard recipes/fmt/all/conanfile.py + + # Lint the test_package (same command) + yamllint --config-file linter/yamllint_rules.yml -f standard recipes/fmt/all/test_package/conanfile.py + ``` + +### Yamlschema + +* (Recommended) Use a dedicated Python virtualenv. +* Ensure you have required tools installed: `strictyaml` and `argparse` (better to uses fixed versions) + + ```sh + pip install strictyaml==1.16 argparse==1.4 + ``` + +* Now you just need to execute the validation scripts: + + ```sh + # Lint a config.yml: + python3 linter/config_yaml_linter.py recipes/fmt/config.yml + + # Lint a conandata.yml + python3 linter/conandata_yaml_linter.py recipes/fmt/all/conandata.yml + ``` + ## Testing the different `test_*_package` This can be selected when calling `conan create` or separately with `conan test` diff --git a/docs/linters.md b/docs/linters.md index 8f4023733d1bab..ac6c1ce8fc4a64 100644 --- a/docs/linters.md +++ b/docs/linters.md @@ -1,15 +1,13 @@ # ConanCenterIndex Linters -Some linter configuration files are available in the folder [linter](../linter), which are executed by Github Actions to improve recipe quality. -They consume python scripts which are executed to fit CCI rules. Those scripts use [astroid](https://github.com/PyCQA/astroid) and -[pylint](https://pylint.pycqa.org/en/latest/) classes to parse Conan recipe files and manage their warnings and errors. +Some linter configuration files are available in the folder [linter](../linter), which are executed by Github Actions +and are displayed during [code review](https://github.com/features/code-review) as annotations, to improve recipe quality. +They consume python scripts which are executed to fit CCI rules. Those scripts use [astroid](https://github.com/PyCQA/astroid) +and [pylint](https://pylint.pycqa.org/en/latest/) classes to parse Conan recipe files and manage their warnings and errors. -Pylint by itself is not able to find ConanCenterIndex rules, so astroid is used to iterate over conanfiles content and -validate CCI conditions. Also, pylint uses [rcfile](https://pylint.pycqa.org/en/latest/user_guide/configuration/index.html) -(a configuration file based on [toml](https://toml.io/en/) format) to configure plugins, warnings and errors which should be enabled or disabled. - -Also, the Github [code review](https://github.com/features/code-review) is integrated with the pylint output, -parsed by [recipe_linter.json](../linter/recipe_linter.json), then presented to all users on the tab `Files changed`. +Pylint by itself is not able to find ConanCenterIndex rules, so astroid is used to iterate over a conanfile's content and +validate CCI requirements. Pylint uses an [rcfile](https://pylint.pycqa.org/en/latest/user_guide/configuration/index.html) +to configure plugins, warnings and errors which should be enabled or disabled. ## Contents @@ -26,9 +24,17 @@ parsed by [recipe_linter.json](../linter/recipe_linter.json), then presented to * [E9010 - conan-import-error-conaninvalidconfiguration: conans.errors is deprecated and conan.errors should be used instead](#e9010---conan-import-error-conaninvalidconfiguration-conanserrors-is-deprecated-and-conanerrors-should-be-used-instead) * [E9011 - conan-import-tools: Importing conan.tools or conan.tools.xxx.zzz.yyy should be considered as private](#e9011---conan-import-tools-importing-conantools-or-conantoolsxxxzzzyyy-should-be-considered-as-private) -## Running the linter locally +## Understanding the different linters + +There's a three classes of linters currently in place for ConanCenterIndex + +- ConanCenter Hook - these are responsible for validating the structure of the recipes and packages. +- Pylint Linter - these are used to ensure the code quality and conventions of a recipes (i.e `conanfile.py`) +- Yaml Checks - stylistic guidance and schema validation check for support files and best practices + +## Running the linters locally -Check the [Developing Recipes](developing_recipes_locally.md#running-the-python-linters) page for details. +Check the [Developing Recipes](developing_recipes_locally.md) for more information on each of the three linters. ## Pylint configuration files diff --git a/docs/package_templates/autotools_package/all/conandata.yml b/docs/package_templates/autotools_package/all/conandata.yml index a5aa8737e0c0ad..0cb43769c334ff 100644 --- a/docs/package_templates/autotools_package/all/conandata.yml +++ b/docs/package_templates/autotools_package/all/conandata.yml @@ -1,16 +1,14 @@ sources: # Newer versions at the top "1.2.0": - url: [ - "https://mirror1.net/package-1.2.0.tar.gz", - "https://mirror2.net/package-1.2.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.2.0.tar.gz" + - "https://mirror2.net/package-1.2.0.tar.gz" sha256: "________________________________________________________________" "1.1.0": - url: [ - "https://mirror1.net/package-1.1.0.tar.gz", - "https://mirror2.net/package-1.1.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.1.0.tar.gz" + - "https://mirror2.net/package-1.1.0.tar.gz" sha256: "________________________________________________________________" patches: # Newer versions at the top diff --git a/docs/package_templates/cmake_package/all/conandata.yml b/docs/package_templates/cmake_package/all/conandata.yml index a5aa8737e0c0ad..0cb43769c334ff 100644 --- a/docs/package_templates/cmake_package/all/conandata.yml +++ b/docs/package_templates/cmake_package/all/conandata.yml @@ -1,16 +1,14 @@ sources: # Newer versions at the top "1.2.0": - url: [ - "https://mirror1.net/package-1.2.0.tar.gz", - "https://mirror2.net/package-1.2.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.2.0.tar.gz" + - "https://mirror2.net/package-1.2.0.tar.gz" sha256: "________________________________________________________________" "1.1.0": - url: [ - "https://mirror1.net/package-1.1.0.tar.gz", - "https://mirror2.net/package-1.1.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.1.0.tar.gz" + - "https://mirror2.net/package-1.1.0.tar.gz" sha256: "________________________________________________________________" patches: # Newer versions at the top diff --git a/docs/package_templates/header_only/all/conandata.yml b/docs/package_templates/header_only/all/conandata.yml index a5aa8737e0c0ad..0cb43769c334ff 100644 --- a/docs/package_templates/header_only/all/conandata.yml +++ b/docs/package_templates/header_only/all/conandata.yml @@ -1,16 +1,14 @@ sources: # Newer versions at the top "1.2.0": - url: [ - "https://mirror1.net/package-1.2.0.tar.gz", - "https://mirror2.net/package-1.2.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.2.0.tar.gz" + - "https://mirror2.net/package-1.2.0.tar.gz" sha256: "________________________________________________________________" "1.1.0": - url: [ - "https://mirror1.net/package-1.1.0.tar.gz", - "https://mirror2.net/package-1.1.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.1.0.tar.gz" + - "https://mirror2.net/package-1.1.0.tar.gz" sha256: "________________________________________________________________" patches: # Newer versions at the top diff --git a/docs/package_templates/meson_package/all/conandata.yml b/docs/package_templates/meson_package/all/conandata.yml index a5aa8737e0c0ad..9d0f08dfa76d4b 100644 --- a/docs/package_templates/meson_package/all/conandata.yml +++ b/docs/package_templates/meson_package/all/conandata.yml @@ -1,16 +1,13 @@ sources: # Newer versions at the top "1.2.0": - url: [ - "https://mirror1.net/package-1.2.0.tar.gz", - "https://mirror2.net/package-1.2.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.2.0.tar.gz", + - "https://mirror2.net/package-1.2.0.tar.gz", sha256: "________________________________________________________________" "1.1.0": - url: [ - "https://mirror1.net/package-1.1.0.tar.gz", - "https://mirror2.net/package-1.1.0.tar.gz", - ] + - "https://mirror1.net/package-1.1.0.tar.gz", + - "https://mirror2.net/package-1.1.0.tar.gz", sha256: "________________________________________________________________" patches: # Newer versions at the top diff --git a/docs/package_templates/msbuild_package/all/conandata.yml b/docs/package_templates/msbuild_package/all/conandata.yml index a5aa8737e0c0ad..0cb43769c334ff 100644 --- a/docs/package_templates/msbuild_package/all/conandata.yml +++ b/docs/package_templates/msbuild_package/all/conandata.yml @@ -1,16 +1,14 @@ sources: # Newer versions at the top "1.2.0": - url: [ - "https://mirror1.net/package-1.2.0.tar.gz", - "https://mirror2.net/package-1.2.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.2.0.tar.gz" + - "https://mirror2.net/package-1.2.0.tar.gz" sha256: "________________________________________________________________" "1.1.0": - url: [ - "https://mirror1.net/package-1.1.0.tar.gz", - "https://mirror2.net/package-1.1.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.1.0.tar.gz" + - "https://mirror2.net/package-1.1.0.tar.gz" sha256: "________________________________________________________________" patches: # Newer versions at the top diff --git a/linter/conandata_yaml_linter.py b/linter/conandata_yaml_linter.py new file mode 100644 index 00000000000000..0ac34bdb2e90e7 --- /dev/null +++ b/linter/conandata_yaml_linter.py @@ -0,0 +1,82 @@ +import argparse +from strictyaml import ( + load, + Map, + Str, + YAMLValidationError, + MapPattern, + Optional, + Seq, + Enum, + Any, +) +from yaml_linting import file_path + + +def main(): + parser = argparse.ArgumentParser( + description="Validate Conan's 'conandata.yaml' file to ConanCenterIndex's requirements." + ) + parser.add_argument( + "path", + nargs="?", + type=file_path, + help="file to validate.", + ) + args = parser.parse_args() + + patch_fields = Map( + { + "patch_file": Str(), + "patch_description": Str(), + "patch_type": Enum( + ["official", "conan", "portability", "backport", "vulnerability"] + ), + Optional("patch_source"): Str(), + Optional("sha256"): Str(), # Really uncommon + # No longer required for v2 recipes with layouts + Optional("base_path"): Str(), + } + ) + schema = Map( + { + "sources": MapPattern(Str(), Any(), minimum_keys=1), + Optional("patches"): MapPattern(Str(), Seq(patch_fields), minimum_keys=1), + } + ) + + with open(args.path) as f: + content = f.read() + + try: + parsed = load(content, schema) + + if "patches" in parsed: + for version in parsed["patches"]: + patches = parsed["patches"][version] + for i, patch in enumerate(patches): + type = parsed["patches"][version][i]["patch_type"] + if ( + type in ["official", "backport", "vulnerability"] + and not "patch_source" in patch + ): + print( + f"::warning file={args.path},line={type.start_line},endline={type.end_line}," + f"title='patch_type' should have 'patch_source'" + "::As per https://github.com/conan-io/conan-center-index/blob/master/docs/conandata_yml_format.md#patches-fields" + " it is expected to have a source (e.g. a URL) to where it originates from to help with reviewing and consumers to evaluate patches\n" + ) + except YAMLValidationError as error: + e = error.__str__().replace("\n", "%0A") + print( + f"::error file={args.path},line={error.context_mark.line},endline={error.problem_mark.line}," + f"title=config.yml schema error" + f"::{e}\n" + ) + except error: + e = error.__str__().replace("\n", "%0A") + print(f"::error ::{e}") + + +if __name__ == "__main__": + main() diff --git a/linter/config_yaml_linter.py b/linter/config_yaml_linter.py new file mode 100644 index 00000000000000..29807e6ce3b99c --- /dev/null +++ b/linter/config_yaml_linter.py @@ -0,0 +1,37 @@ +import argparse +from strictyaml import load, Map, Str, YAMLValidationError, MapPattern +from yaml_linting import file_path + + +def main(): + parser = argparse.ArgumentParser( + description="Validate ConanCenterIndex's 'config.yaml' file." + ) + parser.add_argument( + "path", + nargs="?", + type=file_path, + help="file to validate.", + ) + args = parser.parse_args() + + schema = Map( + {"versions": MapPattern(Str(), Map({"folder": Str()}), minimum_keys=1)} + ) + + with open(args.path) as f: + content = f.read() + + try: + load(content, schema) + except YAMLValidationError as error: + e = error.__str__().replace("\n", "%0A") + print( + f"::error file={args.path},line={error.context_mark.line},endline={error.problem_mark.line}," + f"title=config.yml schema error" + f"::{e}\n" + ) + + +if __name__ == "__main__": + main() diff --git a/linter/yaml_linting.py b/linter/yaml_linting.py new file mode 100644 index 00000000000000..8b61d99ba39f98 --- /dev/null +++ b/linter/yaml_linting.py @@ -0,0 +1,9 @@ +import argparse + + +def file_path(a_string): + from os.path import isfile + + if not isfile(a_string): + raise argparse.ArgumentTypeError(f"{a_string} does not point to a file") + return a_string diff --git a/linter/yamllint_matcher.json b/linter/yamllint_matcher.json new file mode 100644 index 00000000000000..42a3ef93b59567 --- /dev/null +++ b/linter/yamllint_matcher.json @@ -0,0 +1,22 @@ +{ + "problemMatcher": [ + { + "owner": "yamllint_matcher", + "pattern": [ + { + "regexp": "^(.*\\.ya?ml)$", + "file": 1 + }, + { + "regexp": "^\\s{2}(\\d+):(\\d+)\\s+(error|warning)\\s+(.*?)\\s+\\((.*)\\)$", + "line": 1, + "column": 2, + "severity": 3, + "message": 4, + "code": 5, + "loop": true + } + ] + } + ] +} From 0740db641c324100016ce62e2e78f3e7a8a0fa05 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Tue, 25 Oct 2022 07:45:46 -0500 Subject: [PATCH 180/300] (#13725) ms-gsl: Several minor fixes and improvements --- recipes/ms-gsl/all/conandata.yml | 24 +++++++++---------- recipes/ms-gsl/all/conanfile.py | 17 +++++++++---- .../ms-gsl/all/test_package/CMakeLists.txt | 8 +++---- recipes/ms-gsl/all/test_package/conanfile.py | 1 + .../ms-gsl/all/test_v1_package/CMakeLists.txt | 9 +++---- recipes/ms-gsl/config.yml | 8 +++---- 6 files changed, 36 insertions(+), 31 deletions(-) diff --git a/recipes/ms-gsl/all/conandata.yml b/recipes/ms-gsl/all/conandata.yml index 34cb37d416bb29..00aab19c60dba2 100644 --- a/recipes/ms-gsl/all/conandata.yml +++ b/recipes/ms-gsl/all/conandata.yml @@ -1,16 +1,16 @@ sources: - "2.0.0": - url: https://github.com/microsoft/GSL/archive/v2.0.0.tar.gz - sha256: "6cce6fb16b651e62711a4f58e484931013c33979b795d1b1f7646f640cfa9c8e" - "2.1.0": - url: https://github.com/microsoft/GSL/archive/v2.1.0.tar.gz - sha256: "ef73814657b073e1be86c8f7353718771bf4149b482b6cb54f99e79b23ff899d" - "3.0.1": - url: "https://github.com/microsoft/GSL/archive/v3.0.1.tar.gz" - sha256: "7ceba191e046e5347357c6b605f53e6bed069c974aeda851254cb6962a233572" - "3.1.0": - url: "https://github.com/microsoft/GSL/archive/v3.1.0.tar.gz" - sha256: "d3234d7f94cea4389e3ca70619b82e8fb4c2f33bb3a070799f1e18eef500a083" "4.0.0": url: "https://github.com/microsoft/GSL/archive/v4.0.0.tar.gz" sha256: "f0e32cb10654fea91ad56bde89170d78cfbf4363ee0b01d8f097de2ba49f6ce9" + "3.1.0": + url: "https://github.com/microsoft/GSL/archive/v3.1.0.tar.gz" + sha256: "d3234d7f94cea4389e3ca70619b82e8fb4c2f33bb3a070799f1e18eef500a083" + "3.0.1": + url: "https://github.com/microsoft/GSL/archive/v3.0.1.tar.gz" + sha256: "7ceba191e046e5347357c6b605f53e6bed069c974aeda851254cb6962a233572" + "2.1.0": + url: https://github.com/microsoft/GSL/archive/v2.1.0.tar.gz + sha256: "ef73814657b073e1be86c8f7353718771bf4149b482b6cb54f99e79b23ff899d" + "2.0.0": + url: https://github.com/microsoft/GSL/archive/v2.0.0.tar.gz + sha256: "6cce6fb16b651e62711a4f58e484931013c33979b795d1b1f7646f640cfa9c8e" diff --git a/recipes/ms-gsl/all/conanfile.py b/recipes/ms-gsl/all/conanfile.py index 61ef355511a049..1f2447a4480af3 100644 --- a/recipes/ms-gsl/all/conanfile.py +++ b/recipes/ms-gsl/all/conanfile.py @@ -13,7 +13,7 @@ class MicrosoftGslConan(ConanFile): name = "ms-gsl" - description = "Microsoft implementation of the Guidelines Support Library" + description = "Microsoft's implementation of the Guidelines Support Library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/microsoft/GSL" license = "MIT" @@ -27,6 +27,10 @@ class MicrosoftGslConan(ConanFile): "on_contract_violation": "terminate" } + @property + def _minimum_cpp_standard(self): + return 14 + @property def _contract_map(self): return { @@ -52,7 +56,7 @@ def package_id(self): def validate(self): if self.settings.compiler.cppstd: - check_min_cppstd(self, 14) + check_min_cppstd(self, self._minimum_cpp_standard) check_min_vs(self, "190") @@ -60,15 +64,18 @@ def validate(self): minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version: if Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("ms-gsl requires C++14, which your compiler does not fully support.") + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not fully support.") else: - self.output.warn("ms-gsl requires C++14. Your compiler is unknown. Assuming it supports C++14.") + self.output.warn(f"{self.ref} requires C++{self._minimum_cpp_standard}. " + "Your compiler is unknown. Assuming it supports C++{self._minimum_cpp_standard}.") def layout(self): basic_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def generate(self): pass diff --git a/recipes/ms-gsl/all/test_package/CMakeLists.txt b/recipes/ms-gsl/all/test_package/CMakeLists.txt index 5e9fb17a52268f..81fc0751a73bb9 100644 --- a/recipes/ms-gsl/all/test_package/CMakeLists.txt +++ b/recipes/ms-gsl/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.16) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Microsoft.GSL REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package Microsoft.GSL::GSL) -set_property(TARGET test_package PROPERTY CXX_STANDARD 14) +target_link_libraries(test_package PRIVATE Microsoft.GSL::GSL) +target_compile_features(test_package PRIVATE cxx_std_14) diff --git a/recipes/ms-gsl/all/test_package/conanfile.py b/recipes/ms-gsl/all/test_package/conanfile.py index 25e19fcddebcd1..074627225806df 100644 --- a/recipes/ms-gsl/all/test_package/conanfile.py +++ b/recipes/ms-gsl/all/test_package/conanfile.py @@ -8,6 +8,7 @@ class TestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/ms-gsl/all/test_v1_package/CMakeLists.txt b/recipes/ms-gsl/all/test_v1_package/CMakeLists.txt index b4d56a42650b66..925ecbe19e448d 100644 --- a/recipes/ms-gsl/all/test_v1_package/CMakeLists.txt +++ b/recipes/ms-gsl/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Microsoft.GSL REQUIRED CONFIG) - -add_executable(test_package ../test_package/test_package.cpp) -target_link_libraries(test_package Microsoft.GSL::GSL) -set_property(TARGET test_package PROPERTY CXX_STANDARD 14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/ms-gsl/config.yml b/recipes/ms-gsl/config.yml index 0434aa8fdb3bbd..b00b1020b4e160 100644 --- a/recipes/ms-gsl/config.yml +++ b/recipes/ms-gsl/config.yml @@ -1,11 +1,11 @@ versions: - "2.0.0": + "4.0.0": folder: all - "2.1.0": + "3.1.0": folder: all "3.0.1": folder: all - "3.1.0": + "2.1.0": folder: all - "4.0.0": + "2.0.0": folder: all From 58be5b4d68c4e9fbe0152f6d9bc7c718b71d337d Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Tue, 25 Oct 2022 08:54:12 -0500 Subject: [PATCH 181/300] (#13728) nlohmann_json: Define empty generate method and some minor clean up --- recipes/nlohmann_json/all/conandata.yml | 90 +++++++++---------- recipes/nlohmann_json/all/conanfile.py | 13 ++- .../all/test_package/test_package.cpp | 2 +- .../all/test_v1_package/CMakeLists.txt | 11 +-- recipes/nlohmann_json/config.yml | 32 +++---- 5 files changed, 76 insertions(+), 72 deletions(-) diff --git a/recipes/nlohmann_json/all/conandata.yml b/recipes/nlohmann_json/all/conandata.yml index d61287998ab12d..6d20bef200f0e4 100644 --- a/recipes/nlohmann_json/all/conandata.yml +++ b/recipes/nlohmann_json/all/conandata.yml @@ -1,49 +1,49 @@ sources: - "3.1.1": - sha256: 9f3549824af3ca7e9707a2503959886362801fb4926b869789d6929098a79e47 - url: https://github.com/nlohmann/json/archive/v3.1.1.tar.gz - "3.2.0": - sha256: 2de558ff3b3b32eebfb51cf2ceb835a0fa5170e6b8712b02be9c2c07fcfe52a1 - url: https://github.com/nlohmann/json/archive/v3.2.0.tar.gz - "3.4.0": - sha256: C377963A95989270C943D522BFEFE7B889EF5ED0E1E15D535FD6F6F16ED70732 - url: https://github.com/nlohmann/json/archive/v3.4.0.tar.gz - "3.7.0": - sha256: D51A3A8D3EFBB1139D7608E28782EA9EFEA7E7933157E8FF8184901EFD8EE760 - url: https://github.com/nlohmann/json/archive/v3.7.0.tar.gz - "3.7.3": - sha256: 249548F4867417D66AE46B338DFE0A2805F3323E81C9E9B83C89F3ADBFDE6F31 - url: https://github.com/nlohmann/json/archive/v3.7.3.tar.gz - "3.8.0": - sha256: 7d0edf65f2ac7390af5e5a0b323b31202a6c11d744a74b588dc30f5a8c9865ba - url: https://github.com/nlohmann/json/archive/v3.8.0.tar.gz - "3.9.0": - sha256: 9943db11eeaa5b23e58a88fbc26c453faccef7b546e55063ad00e7caaaf76d0b - url: https://github.com/nlohmann/json/archive/v3.9.0.tar.gz - "3.9.1": - sha256: 4cf0df69731494668bdd6460ed8cb269b68de9c19ad8c27abc24cd72605b2d5b - url: https://github.com/nlohmann/json/archive/v3.9.1.tar.gz - "3.10.0": - sha256: eb8b07806efa5f95b349766ccc7a8ec2348f3b2ee9975ad879259a371aea8084 - url: https://github.com/nlohmann/json/archive/v3.10.0.tar.gz - "3.10.2": - sha256: 081ed0f9f89805c2d96335c3acfa993b39a0a5b4b4cef7edb68dd2210a13458c - url: https://github.com/nlohmann/json/archive/v3.10.2.tar.gz - "3.10.3": - url: "https://github.com/nlohmann/json/archive/v3.10.3.tar.gz" - sha256: "e0d7c1b120cac47fa7f14a41d10a5d390f67d423d8e97b9d6834887285d6873c" - "3.10.4": - url: "https://github.com/nlohmann/json/archive/v3.10.4.tar.gz" - sha256: "1155fd1a83049767360e9a120c43c578145db3204d2b309eba49fbbedd0f4ed3" - "3.10.5": - url: "https://github.com/nlohmann/json/archive/v3.10.5.tar.gz" - sha256: "5daca6ca216495edf89d167f808d1d03c4a4d929cef7da5e10f135ae1540c7e4" - "3.11.0": - url: "https://github.com/nlohmann/json/archive/v3.11.0.tar.gz" - sha256: "e0c4fbd03c0bb7e99b40791e0276be61e5f531106e1486e8f0d771a7ed6d754a" - "3.11.1": - url: "https://github.com/nlohmann/json/archive/v3.11.1.tar.gz" - sha256: "598becb62ee0e01cf32795073c8ae09b6e95335cd43a4417b785d93ce105b0d0" "3.11.2": url: "https://github.com/nlohmann/json/archive/v3.11.2.tar.gz" sha256: "d69f9deb6a75e2580465c6c4c5111b89c4dc2fa94e3a85fcd2ffcd9a143d9273" + "3.11.1": + url: "https://github.com/nlohmann/json/archive/v3.11.1.tar.gz" + sha256: "598becb62ee0e01cf32795073c8ae09b6e95335cd43a4417b785d93ce105b0d0" + "3.11.0": + url: "https://github.com/nlohmann/json/archive/v3.11.0.tar.gz" + sha256: "e0c4fbd03c0bb7e99b40791e0276be61e5f531106e1486e8f0d771a7ed6d754a" + "3.10.5": + url: "https://github.com/nlohmann/json/archive/v3.10.5.tar.gz" + sha256: "5daca6ca216495edf89d167f808d1d03c4a4d929cef7da5e10f135ae1540c7e4" + "3.10.4": + url: "https://github.com/nlohmann/json/archive/v3.10.4.tar.gz" + sha256: "1155fd1a83049767360e9a120c43c578145db3204d2b309eba49fbbedd0f4ed3" + "3.10.3": + url: "https://github.com/nlohmann/json/archive/v3.10.3.tar.gz" + sha256: "e0d7c1b120cac47fa7f14a41d10a5d390f67d423d8e97b9d6834887285d6873c" + "3.10.2": + sha256: 081ed0f9f89805c2d96335c3acfa993b39a0a5b4b4cef7edb68dd2210a13458c + url: https://github.com/nlohmann/json/archive/v3.10.2.tar.gz + "3.10.0": + sha256: eb8b07806efa5f95b349766ccc7a8ec2348f3b2ee9975ad879259a371aea8084 + url: https://github.com/nlohmann/json/archive/v3.10.0.tar.gz + "3.9.1": + sha256: 4cf0df69731494668bdd6460ed8cb269b68de9c19ad8c27abc24cd72605b2d5b + url: https://github.com/nlohmann/json/archive/v3.9.1.tar.gz + "3.9.0": + sha256: 9943db11eeaa5b23e58a88fbc26c453faccef7b546e55063ad00e7caaaf76d0b + url: https://github.com/nlohmann/json/archive/v3.9.0.tar.gz + "3.8.0": + sha256: 7d0edf65f2ac7390af5e5a0b323b31202a6c11d744a74b588dc30f5a8c9865ba + url: https://github.com/nlohmann/json/archive/v3.8.0.tar.gz + "3.7.3": + sha256: 249548F4867417D66AE46B338DFE0A2805F3323E81C9E9B83C89F3ADBFDE6F31 + url: https://github.com/nlohmann/json/archive/v3.7.3.tar.gz + "3.7.0": + sha256: D51A3A8D3EFBB1139D7608E28782EA9EFEA7E7933157E8FF8184901EFD8EE760 + url: https://github.com/nlohmann/json/archive/v3.7.0.tar.gz + "3.4.0": + sha256: C377963A95989270C943D522BFEFE7B889EF5ED0E1E15D535FD6F6F16ED70732 + url: https://github.com/nlohmann/json/archive/v3.4.0.tar.gz + "3.2.0": + sha256: 2de558ff3b3b32eebfb51cf2ceb835a0fa5170e6b8712b02be9c2c07fcfe52a1 + url: https://github.com/nlohmann/json/archive/v3.2.0.tar.gz + "3.1.1": + sha256: 9f3549824af3ca7e9707a2503959886362801fb4926b869789d6929098a79e47 + url: https://github.com/nlohmann/json/archive/v3.1.1.tar.gz diff --git a/recipes/nlohmann_json/all/conanfile.py b/recipes/nlohmann_json/all/conanfile.py index 09b5607e0454d3..83bc77059e036f 100644 --- a/recipes/nlohmann_json/all/conanfile.py +++ b/recipes/nlohmann_json/all/conanfile.py @@ -11,12 +11,16 @@ class NlohmannJsonConan(ConanFile): name = "nlohmann_json" homepage = "https://github.com/nlohmann/json" description = "JSON for Modern C++ parser and generator." - topics = ("jsonformoderncpp", "nlohmann_json", "json", "header-only") + topics = "json", "header-only" url = "https://github.com/conan-io/conan-center-index" license = "MIT" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _minimum_cpp_standard(self): + return 11 + def layout(self): basic_layout(self, src_folder="src") @@ -24,13 +28,16 @@ def package_id(self): self.info.clear() def validate(self): - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + def generate(self): + pass + def build(self): pass diff --git a/recipes/nlohmann_json/all/test_package/test_package.cpp b/recipes/nlohmann_json/all/test_package/test_package.cpp index 6b38ea7a2e1452..1289a2fa9f10df 100644 --- a/recipes/nlohmann_json/all/test_package/test_package.cpp +++ b/recipes/nlohmann_json/all/test_package/test_package.cpp @@ -25,6 +25,6 @@ int main() { #else auto f = data["pi"].get(); #endif - std::cout << data.dump(4) << std::endl; + std::cout << data.dump(4) << "\n"; return 0; } diff --git a/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt b/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt index 611fe4322eb549..925ecbe19e448d 100644 --- a/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt +++ b/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(nlohmann_json REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/nlohmann_json/config.yml b/recipes/nlohmann_json/config.yml index d35466e33f93f9..f26a7154dd392d 100644 --- a/recipes/nlohmann_json/config.yml +++ b/recipes/nlohmann_json/config.yml @@ -1,33 +1,33 @@ versions: - "3.1.1": - folder: all - "3.2.0": + "3.11.2": folder: all - "3.4.0": + "3.11.1": folder: all - "3.7.0": + "3.11.0": folder: all - "3.7.3": + "3.10.5": folder: all - "3.8.0": + "3.10.4": folder: all - "3.9.0": + "3.10.3": folder: all - "3.9.1": + "3.10.2": folder: all "3.10.0": folder: all - "3.10.2": + "3.9.1": folder: all - "3.10.3": + "3.9.0": folder: all - "3.10.4": + "3.8.0": folder: all - "3.10.5": + "3.7.3": folder: all - "3.11.0": + "3.7.0": folder: all - "3.11.1": + "3.4.0": folder: all - "3.11.2": + "3.2.0": + folder: all + "3.1.1": folder: all From 0ea488f6b5536a99e38eff6f0d0ed91d9c988c25 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Tue, 25 Oct 2022 09:31:48 -0500 Subject: [PATCH 182/300] (#13727) fmt: Safely delete options in configure plus clean up --- recipes/fmt/all/conandata.yml | 36 +++++++++---------- recipes/fmt/all/conanfile.py | 27 +++++++++----- recipes/fmt/all/test_package/CMakeLists.txt | 20 +++++------ recipes/fmt/all/test_package/conanfile.py | 2 -- .../fmt/all/test_v1_package/CMakeLists.txt | 25 +++---------- recipes/fmt/config.yml | 12 +++---- 6 files changed, 55 insertions(+), 67 deletions(-) diff --git a/recipes/fmt/all/conandata.yml b/recipes/fmt/all/conandata.yml index 62a5ea09608951..226084f79cbb04 100644 --- a/recipes/fmt/all/conandata.yml +++ b/recipes/fmt/all/conandata.yml @@ -1,25 +1,25 @@ sources: - "5.3.0": - sha256: defa24a9af4c622a7134076602070b45721a43c51598c8456ec6f2c4dbb51c89 - url: https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz - "6.2.1": - sha256: 5edf8b0f32135ad5fafb3064de26d063571e95e8ae46829c2f4f4b52696bbff0 - url: https://github.com/fmtlib/fmt/archive/6.2.1.tar.gz - "7.1.3": - sha256: 5cae7072042b3043e12d53d50ef404bbb76949dad1de368d7f993a15c8c05ecc - url: https://github.com/fmtlib/fmt/archive/7.1.3.tar.gz - "8.0.1": - url: "https://github.com/fmtlib/fmt/archive/8.0.1.tar.gz" - sha256: "b06ca3130158c625848f3fb7418f235155a4d389b2abc3a6245fb01cb0eb1e01" - "8.1.1": - url: "https://github.com/fmtlib/fmt/archive/8.1.1.tar.gz" - sha256: "3d794d3cf67633b34b2771eb9f073bde87e846e0d395d254df7b211ef1ec7346" - "9.0.0": - url: "https://github.com/fmtlib/fmt/archive/9.0.0.tar.gz" - sha256: "9a1e0e9e843a356d65c7604e2c8bf9402b50fe294c355de0095ebd42fb9bd2c5" "9.1.0": url: "https://github.com/fmtlib/fmt/archive/9.1.0.tar.gz" sha256: "5dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2" + "9.0.0": + url: "https://github.com/fmtlib/fmt/archive/9.0.0.tar.gz" + sha256: "9a1e0e9e843a356d65c7604e2c8bf9402b50fe294c355de0095ebd42fb9bd2c5" + "8.1.1": + url: "https://github.com/fmtlib/fmt/archive/8.1.1.tar.gz" + sha256: "3d794d3cf67633b34b2771eb9f073bde87e846e0d395d254df7b211ef1ec7346" + "8.0.1": + url: "https://github.com/fmtlib/fmt/archive/8.0.1.tar.gz" + sha256: "b06ca3130158c625848f3fb7418f235155a4d389b2abc3a6245fb01cb0eb1e01" + "7.1.3": + sha256: 5cae7072042b3043e12d53d50ef404bbb76949dad1de368d7f993a15c8c05ecc + url: https://github.com/fmtlib/fmt/archive/7.1.3.tar.gz + "6.2.1": + sha256: 5edf8b0f32135ad5fafb3064de26d063571e95e8ae46829c2f4f4b52696bbff0 + url: https://github.com/fmtlib/fmt/archive/6.2.1.tar.gz + "5.3.0": + sha256: defa24a9af4c622a7134076602070b45721a43c51598c8456ec6f2c4dbb51c89 + url: https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz patches: "5.3.0": - patch_file: "patches/fix-install-5.3.0.patch" diff --git a/recipes/fmt/all/conanfile.py b/recipes/fmt/all/conanfile.py index af95895649da5c..ede2e264b4b158 100644 --- a/recipes/fmt/all/conanfile.py +++ b/recipes/fmt/all/conanfile.py @@ -1,10 +1,10 @@ import os from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.layout import basic_layout, cmake_layout from conan.tools.scm import Version -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import get, apply_conandata_patches, copy, rmdir, export_conandata_patches -from conan.tools.layout import basic_layout required_conan_version = ">=1.52.0" @@ -13,7 +13,7 @@ class FmtConan(ConanFile): name = "fmt" homepage = "https://github.com/fmtlib/fmt" description = "A safe and fast alternative to printf and IOStreams." - topics = ("fmt", "format", "iostream", "printf") + topics = ("format", "iostream", "printf") url = "https://github.com/conan-io/conan-center-index" license = "MIT" settings = "os", "arch", "compiler", "build_type" @@ -34,7 +34,7 @@ class FmtConan(ConanFile): @property def _has_with_os_api_option(self): - return Version(str(self.version)) >= "7.0.0" + return Version(self.version) >= "7.0.0" def export_sources(self): export_conandata_patches(self) @@ -66,11 +66,20 @@ def config_options(self): def configure(self): if self.options.header_only: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass del self.options.shared - del self.options.with_os_api + try: + del self.options.with_os_api + except Exception: + pass elif self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def package_id(self): if self.info.options.header_only: @@ -79,7 +88,7 @@ def package_id(self): del self.info.options.with_fmt_alias def source(self): - get(self, **self.conan_data["sources"][str(self.version)], + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def build(self): diff --git a/recipes/fmt/all/test_package/CMakeLists.txt b/recipes/fmt/all/test_package/CMakeLists.txt index 66300c1349564f..a71cd67f135ecc 100644 --- a/recipes/fmt/all/test_package/CMakeLists.txt +++ b/recipes/fmt/all/test_package/CMakeLists.txt @@ -1,22 +1,20 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(fmt REQUIRED CONFIG) -# TEST_PACKAGE ################################################################# -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +add_executable(test_package test_package.cpp) +target_compile_features(test_package PRIVATE cxx_std_14) if(FMT_HEADER_ONLY) - target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt-header-only) + target_link_libraries(test_package PRIVATE fmt::fmt-header-only) else() - target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt) + target_link_libraries(test_package PRIVATE fmt::fmt) endif() -# TEST_RANGES ################################################################## add_executable(test_ranges test_ranges.cpp) -set_property(TARGET test_ranges PROPERTY CXX_STANDARD 14) +target_compile_features(test_ranges PRIVATE cxx_std_14) if(FMT_HEADER_ONLY) - target_link_libraries(test_ranges fmt::fmt-header-only) + target_link_libraries(test_ranges PRIVATE fmt::fmt-header-only) else() - target_link_libraries(test_ranges fmt::fmt) + target_link_libraries(test_ranges PRIVATE fmt::fmt) endif() diff --git a/recipes/fmt/all/test_package/conanfile.py b/recipes/fmt/all/test_package/conanfile.py index b896898544c19e..5fe5679b8d954d 100644 --- a/recipes/fmt/all/test_package/conanfile.py +++ b/recipes/fmt/all/test_package/conanfile.py @@ -4,8 +4,6 @@ from conan.tools.build import can_run from conan.tools.cmake import cmake_layout -required_conan_version = ">=1.50.0" - class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "VirtualRunEnv" diff --git a/recipes/fmt/all/test_v1_package/CMakeLists.txt b/recipes/fmt/all/test_v1_package/CMakeLists.txt index cd856e0aa456ab..925ecbe19e448d 100644 --- a/recipes/fmt/all/test_v1_package/CMakeLists.txt +++ b/recipes/fmt/all/test_v1_package/CMakeLists.txt @@ -1,25 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(fmt REQUIRED CONFIG) - -# TEST_PACKAGE ################################################################# -add_executable(${CMAKE_PROJECT_NAME} ../test_package/test_package.cpp) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) -if(FMT_HEADER_ONLY) - target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt-header-only) -else() - target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt) -endif() - -# TEST_RANGES ################################################################## -add_executable(test_ranges ../test_package/test_ranges.cpp) -set_property(TARGET test_ranges PROPERTY CXX_STANDARD 14) -if(FMT_HEADER_ONLY) - target_link_libraries(test_ranges fmt::fmt-header-only) -else() - target_link_libraries(test_ranges fmt::fmt) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/fmt/config.yml b/recipes/fmt/config.yml index 5da590b43a6cd0..7251dde3fac9f4 100644 --- a/recipes/fmt/config.yml +++ b/recipes/fmt/config.yml @@ -1,15 +1,15 @@ versions: - "5.3.0": + "9.1.0": folder: all - "6.2.1": + "9.0.0": folder: all - "7.1.3": + "8.1.1": folder: all "8.0.1": folder: all - "8.1.1": + "7.1.3": folder: all - "9.0.0": + "6.2.1": folder: all - "9.1.0": + "5.3.0": folder: all From bdc7ba2fcc9440167f522ac7fcce24d2f59bd511 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 25 Oct 2022 17:25:40 +0200 Subject: [PATCH 183/300] (#13733) Bump vulkan-headers/1.3.231.0 --- recipes/vulkan-headers/all/conandata.yml | 3 +++ recipes/vulkan-headers/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/vulkan-headers/all/conandata.yml b/recipes/vulkan-headers/all/conandata.yml index d7718cb9466ca7..71dca94c6e1de0 100644 --- a/recipes/vulkan-headers/all/conandata.yml +++ b/recipes/vulkan-headers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.231.0.tar.gz" + sha256: "f7c185dedf7753d58e7b59913dd4b77006a6ed91fae598c5961f77d85b183da0" "1.3.231": url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.3.231.tar.gz" sha256: "4cb1c0aeb858e1a4955a736b86b0da8511ca8701222e9a252adcf093d40a8d28" diff --git a/recipes/vulkan-headers/config.yml b/recipes/vulkan-headers/config.yml index 8dff9a04482258..d565ec93efc887 100644 --- a/recipes/vulkan-headers/config.yml +++ b/recipes/vulkan-headers/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231.0": + folder: all "1.3.231": folder: all "1.3.224.1": From 13e9588758ea1a4eb50dade04a4e7fbedabdb0f2 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 26 Oct 2022 00:45:26 +0900 Subject: [PATCH 184/300] (#13660) lief: add version 0.12.2 * lief: add version 0.12.2 * dirty fix for gcc 5 * fix condition expression for gcc 5 * remove lib/pkgconfig * create patch to support older gcc --- recipes/lief/all/conandata.yml | 23 +++++ recipes/lief/all/conanfile.py | 23 +++++ .../patches/0.12.2-001_link_to_conan.patch | 96 +++++++++++++++++++ .../0.12.2-002_support_older_gcc.patch | 13 +++ recipes/lief/all/test_package/CMakeLists.txt | 3 + .../lief/all/test_v1_package/CMakeLists.txt | 3 + recipes/lief/config.yml | 2 + 7 files changed, 163 insertions(+) create mode 100644 recipes/lief/all/patches/0.12.2-001_link_to_conan.patch create mode 100644 recipes/lief/all/patches/0.12.2-002_support_older_gcc.patch diff --git a/recipes/lief/all/conandata.yml b/recipes/lief/all/conandata.yml index 6bb6d4a4c6bc48..5ce51601d9a310 100644 --- a/recipes/lief/all/conandata.yml +++ b/recipes/lief/all/conandata.yml @@ -1,12 +1,35 @@ sources: + "0.12.2": + url: "https://github.com/lief-project/LIEF/archive/0.12.2.tar.gz" + sha256: "d779c802ba1f80d0e93765e038e0a198fb5ffe4662afe467e33102cb44a06e99" "0.10.1": url: "https://github.com/lief-project/LIEF/archive/0.10.1.tar.gz" sha256: "6f30c98a559f137e08b25bcbb376c0259914b33c307b8b901e01ca952241d00a" patches: + "0.12.2": + - patch_file: "patches/0.12.2-001_link_to_conan.patch" + patch_description: "find conan package and link these" + patch_type: "conan" + - patch_file: "patches/0.12.2-002_support_older_gcc.patch" + patch_description: "find conan package and link these" + patch_type: "portability" + patch_source: "https://github.com/lief-project/LIEF/pull/815" "0.10.1": - patch_file: "patches/001_link_to_conan.patch" + patch_description: "find conan package and link these" + patch_type: "conan" - patch_file: "patches/002_fix_resources_manager.patch" + patch_description: "use rang for colorizing" + patch_type: "backport" - patch_file: "patches/003_fix_json_include_path.patch" + patch_description: "fix include path for conan package" + patch_type: "conan" - patch_file: "patches/004_fix_elf_parser.patch" + patch_description: "remove LIEF_API" + patch_type: "backport" - patch_file: "patches/005_fix_compiler_detection.patch" + patch_description: "fix check logic for compiler C++17 support" + patch_type: "backport" - patch_file: "patches/006_fix_binary_cpp.patch" + patch_description: "include cctype" + patch_type: "backport" diff --git a/recipes/lief/all/conanfile.py b/recipes/lief/all/conanfile.py index 626cc2d07f9f0b..eed55b5ff591b7 100644 --- a/recipes/lief/all/conanfile.py +++ b/recipes/lief/all/conanfile.py @@ -89,6 +89,19 @@ def requirements(self): if self.options.with_frozen: self.requires("frozen/1.1.1") + if Version(self.version) < "0.12.2": + self.requires("rang/3.2") + self.requires("mbedtls/3.2.1") + if self.options.with_json: + self.requires("nlohmann_json/3.11.2") + if self.options.with_frozen: + self.requires("frozen/1.1.1") + if Version(self.version) >= "0.12.2": + self.requires("utfcpp/3.2.1") + self.requires("spdlog/1.10.0") + self.requires("boost/1.80.0") + self.requires("tcb-span/cci.20220616") + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -109,6 +122,15 @@ def generate(self): tc.variables["LIEF_DOC"] = False tc.variables["LIEF_LOGGING"] = False tc.variables["LIEF_PYTHON_API"] = False + if Version(self.version) >= "0.12.2": + tc.variables["LIEF_USE_CCACHE"] = False + tc.variables["LIEF_OPT_MBEDTLS_EXTERNAL"] = True + tc.variables["LIEF_OPT_NLOHMANN_JSON_EXTERNAL"] = True + tc.variables["LIEF_OPT_FROZEN_EXTERNAL"] = True + tc.variables["LIEF_OPT_UTFCPP_EXTERNAL"] = True + tc.variables["LIEF_EXTERNAL_SPDLOG"] = True + tc.variables["LIEF_OPT_EXTERNAL_LEAF"] = True + tc.variables["LIEF_OPT_EXTERNAL_SPAN"] = True tc.generate() deps = CMakeDeps(self) @@ -125,6 +147,7 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.libs = ["LIEF"] diff --git a/recipes/lief/all/patches/0.12.2-001_link_to_conan.patch b/recipes/lief/all/patches/0.12.2-001_link_to_conan.patch new file mode 100644 index 00000000000000..f5fad544a589a9 --- /dev/null +++ b/recipes/lief/all/patches/0.12.2-001_link_to_conan.patch @@ -0,0 +1,96 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7d59f14..9fdfe43 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,7 +12,6 @@ endif() + + + if(WIN32 OR ${IS_WIN_CROSS_COMPILE}) +- include(ChooseMSVCCRT) + endif() + include(CheckCXXCompilerFlag) + include(CheckCCompilerFlag) +@@ -70,7 +69,6 @@ endif() + + # Dependencies + # ============ +-set(THIRD_PARTY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/third-party/") + include(LIEFDependencies) + + # iOS specific config +@@ -376,12 +374,14 @@ endif() + # Leaf + # ======================================= + if(LIEF_EXTERNAL_LEAF) ++ find_package(Boost REQUIRED CONFIG) + message(STATUS "Using external LEAF version") + if(LIEF_EXTERNAL_LEAF_DIR) + message(STATUS "External LEAF include dir: ${LIEF_EXTERNAL_LEAF_DIR}") + target_include_directories(LIB_LIEF SYSTEM PUBLIC + "$") + endif() ++ target_link_libraries(LIB_LIEF PRIVATE Boost::headers) + else() + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/leaf.hpp + COMMAND +@@ -425,6 +425,8 @@ if(LIEF_EXTERNAL_SPAN) + target_include_directories(LIB_LIEF SYSTEM PUBLIC + "$") + endif() ++ find_package(tcb-span REQUIRED CONFIG) ++ target_link_libraries(LIB_LIEF PRIVATE tcb-span::tcb-span) + else() + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/span.hpp + COMMAND +@@ -439,7 +441,6 @@ else() + endif() + + +- + target_link_libraries(LIB_LIEF PRIVATE lief_spdlog) + + # Flags definition +@@ -448,8 +449,7 @@ target_link_libraries(LIB_LIEF PRIVATE lief_spdlog) + # cmake-format: off + set_target_properties( + LIB_LIEF +- PROPERTIES POSITION_INDEPENDENT_CODE ON +- CXX_STANDARD 11 ++ PROPERTIES CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_VISIBILITY_PRESET hidden + C_VISIBILITY_PRESET hidden) +@@ -667,8 +667,9 @@ endif() + # Installation + # ====================== + ++include(GNUInstallDirs) ++if(0) + if(UNIX) +- include(GNUInstallDirs) + set(CMAKE_INSTALL_LIBDIR "lib") + else() + if(WIN32) +@@ -682,13 +683,14 @@ else() + message(FATAL_ERROR "System not UNIX nor WIN32 - not implemented yet") + endif() + endif() ++endif() + + install( + TARGETS LIB_LIEF lief_spdlog + EXPORT LIEFExport + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + install( +@@ -727,6 +729,3 @@ export( + NAMESPACE LIEF:: + FILE LIEFExport-${lib_type}.cmake) + +-# Package +-# ====================== +-add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/package") diff --git a/recipes/lief/all/patches/0.12.2-002_support_older_gcc.patch b/recipes/lief/all/patches/0.12.2-002_support_older_gcc.patch new file mode 100644 index 00000000000000..2ab323a4fbd5cf --- /dev/null +++ b/recipes/lief/all/patches/0.12.2-002_support_older_gcc.patch @@ -0,0 +1,13 @@ +diff --git a/src/PE/Binary.cpp b/src/PE/Binary.cpp +index 0e032c3..d2eaae9 100644 +--- a/src/PE/Binary.cpp ++++ b/src/PE/Binary.cpp +@@ -1732,7 +1732,7 @@ std::ostream& Binary::print(std::ostream& os) const { + if (has_debug()) { + os << "Debug" << std::endl; + os << "=====" << std::endl; +- for (const Debug& debug : debug()) { ++ for (const Debug& debug : this->debug()) { + os << debug << std::endl; + } + os << std::endl; diff --git a/recipes/lief/all/test_package/CMakeLists.txt b/recipes/lief/all/test_package/CMakeLists.txt index 6f9bbaa261abb4..21ece2b1f32cbb 100644 --- a/recipes/lief/all/test_package/CMakeLists.txt +++ b/recipes/lief/all/test_package/CMakeLists.txt @@ -6,3 +6,6 @@ find_package(LIEF REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE LIEF::LIEF) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +# It is required for gcc 5 +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/lief/all/test_v1_package/CMakeLists.txt b/recipes/lief/all/test_v1_package/CMakeLists.txt index 7778f7e7ac904a..6b1097615e03a8 100644 --- a/recipes/lief/all/test_v1_package/CMakeLists.txt +++ b/recipes/lief/all/test_v1_package/CMakeLists.txt @@ -9,3 +9,6 @@ find_package(LIEF REQUIRED CONFIG) add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE LIEF::LIEF) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +# It is required for gcc 5 +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/lief/config.yml b/recipes/lief/config.yml index c1d72c1a28d683..72c91c7491238e 100644 --- a/recipes/lief/config.yml +++ b/recipes/lief/config.yml @@ -1,3 +1,5 @@ versions: + "0.12.2": + folder: "all" "0.10.1": folder: "all" From 1d92326d55d54f26f143e8729ffab35561755aa6 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Tue, 25 Oct 2022 11:05:26 -0500 Subject: [PATCH 185/300] (#13645) glib: Fix libdir for PkgConfigDeps --- recipes/glib/all/conanfile.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/recipes/glib/all/conanfile.py b/recipes/glib/all/conanfile.py index 6008731a1870d8..a2a7ecce95c56e 100644 --- a/recipes/glib/all/conanfile.py +++ b/recipes/glib/all/conanfile.py @@ -17,11 +17,10 @@ class GLibConan(ConanFile): name = "glib" description = "GLib provides the core application building blocks for libraries and applications written in C" - topics = ("glib", "gobject", "gio", "gmodule") + topics = ("gobject", "gio", "gmodule") url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.gnome.org/GNOME/glib" license = "LGPL-2.1" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,7 +38,6 @@ class GLibConan(ConanFile): "with_mount": True, "with_selinux": True, } - short_paths = True @property @@ -324,7 +322,7 @@ def package_info(self): 'datadir': '${prefix}/res', 'schemasdir': '${datadir}/glib-2.0/schemas', 'bindir': '${prefix}/bin', - 'giomoduledir': '${libdir}/gio/modules', + 'giomoduledir': '${prefix}/lib/gio/modules', 'gio': '${bindir}/gio', 'gio_querymodules': '${bindir}/gio-querymodules', 'glib_compile_schemas': '${bindir}/glib-compile-schemas', From c3bce1a3fa208509fe9e6b1babb1287b86a7ca08 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 26 Oct 2022 01:45:48 +0900 Subject: [PATCH 186/300] (#13738) bzip3: add version 1.1.7 --- recipes/bzip3/all/CMakeLists.txt | 10 +++++++--- recipes/bzip3/all/conandata.yml | 3 +++ recipes/bzip3/all/conanfile.py | 2 +- recipes/bzip3/config.yml | 2 ++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/recipes/bzip3/all/CMakeLists.txt b/recipes/bzip3/all/CMakeLists.txt index 62b301abbb58e6..f58db5b429ac9e 100644 --- a/recipes/bzip3/all/CMakeLists.txt +++ b/recipes/bzip3/all/CMakeLists.txt @@ -10,7 +10,7 @@ set(BZIP3_INC add_library(bzip3) -if (VERSION VERSION_GREATER_EQUAL "1.1.5") +if (BZIP3_VERSION VERSION_GREATER_EQUAL "1.1.5") target_sources(bzip3 PRIVATE ${BZIP3_SRC_DIR}/src/libbz3.c ) @@ -30,10 +30,14 @@ set_target_properties(bzip3 PROPERTIES C_VISIBILITY_PRESET hidden C_EXTENSIONS OFF ) -if (VERSION VERSION_GREATER_EQUAL "1.1.6" AND (MSVC OR MSVC90 OR MSVC10) AND BUILD_SHARED_LIBS) +if (BZIP3_VERSION VERSION_GREATER_EQUAL "1.1.6" AND (MSVC OR MSVC90 OR MSVC10) AND BUILD_SHARED_LIBS) target_compile_definitions(bzip3 PRIVATE "BZIP3_DLL_EXPORT=1") endif() +if (BZIP3_VERSION VERSION_GREATER_EQUAL "1.1.7") + target_compile_definitions(bzip3 PRIVATE "VERSION=\"${BZIP3_VERSION}\"") +endif() + if (BZIP3_WITH_THREAD) find_package(Threads REQUIRED) target_link_libraries(bzip3 PRIVATE Threads::Threads) @@ -43,7 +47,7 @@ endif() if (BZIP3_WITH_UTIL) add_executable(bzip3_cmd ${BZIP3_SRC_DIR}/src/main.c) target_link_libraries(bzip3_cmd bzip3) - target_compile_definitions(bzip3_cmd PRIVATE "VERSION=\"${VERSION}\"") + target_compile_definitions(bzip3_cmd PRIVATE "VERSION=\"${BZIP3_VERSION}\"") set_target_properties(bzip3_cmd PROPERTIES OUTPUT_NAME "bzip3") endif() diff --git a/recipes/bzip3/all/conandata.yml b/recipes/bzip3/all/conandata.yml index 87478fcf26ffd4..205a2576d24de9 100644 --- a/recipes/bzip3/all/conandata.yml +++ b/recipes/bzip3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.7": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.7/bzip3-1.1.7.tar.bz2" + sha256: "1f74768dd1a76c45417f84779cc04d8d8b1f595ac564a2ea2aeb0248defca803" "1.1.6": url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.6/bzip3-1.1.6.tar.bz2" sha256: "2bfd35dd57ab80b35b25e3ad628e0ff8f1f5e6dea02a8d472914823ea2e07e96" diff --git a/recipes/bzip3/all/conanfile.py b/recipes/bzip3/all/conanfile.py index 2d6313f87447bf..83556101068ce4 100644 --- a/recipes/bzip3/all/conanfile.py +++ b/recipes/bzip3/all/conanfile.py @@ -67,7 +67,7 @@ def generate(self): tc.variables["BZIP3_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.variables["BZIP3_WITH_PTHREAD"] = self.options.get_safe("with_thread", False) tc.variables["BZIP3_WITH_UTIL"] = self.options.with_util - tc.variables["VERSION"] = self.version + tc.variables["BZIP3_VERSION"] = self.version tc.generate() def build(self): diff --git a/recipes/bzip3/config.yml b/recipes/bzip3/config.yml index fa8612a6d0ffa2..62bae9d00b79af 100644 --- a/recipes/bzip3/config.yml +++ b/recipes/bzip3/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.7": + folder: all "1.1.6": folder: all "1.1.5": From d7b0e41b351cf9489a0e85c96de071d55255d3a1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 25 Oct 2022 19:06:44 +0200 Subject: [PATCH 187/300] (#13746) [docs] Regenerate tables of contents Co-authored-by: conan-center-bot --- docs/conandata_yml_format.md | 8 ++------ docs/developing_recipes_locally.md | 3 +++ docs/linters.md | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/conandata_yml_format.md b/docs/conandata_yml_format.md index df72a653e73f76..edb3951d85a86d 100644 --- a/docs/conandata_yml_format.md +++ b/docs/conandata_yml_format.md @@ -12,15 +12,11 @@ In the context of ConanCenterIndex, this file is mandatory and consists of two m * [sources](#sources) * [Mirrors](#mirrors) + * [Multiple Assets](#multiple-assets) + * [Different source archives per configuration](#different-source-archives-per-configuration) * [Sources fields](#sources-fields) * [url](#url) * [sha256](#sha256) - * [sha1](#sha1) - * [md5](#md5) - * [Other cases](#other-cases) - * [Source code & license](#source-code--license) - * [Several source code archives](#several-source-code-archives) - * [Different source code archives per configuration](#different-source-code-archives-per-configuration) * [patches](#patches) * [Patches fields](#patches-fields) * [patch_file](#patch_file) diff --git a/docs/developing_recipes_locally.md b/docs/developing_recipes_locally.md index 4700687fa8c8c6..dadc00f40f4c7b 100644 --- a/docs/developing_recipes_locally.md +++ b/docs/developing_recipes_locally.md @@ -15,6 +15,9 @@ This file is intended to provide all the commands you need to run in order to be * [Try it yourself](#try-it-yourself) * [Debugging Failed Builds](#debugging-failed-builds) * [Running the Python Linters](#running-the-python-linters) + * [Running the YAML Linters](#running-the-yaml-linters) + * [Yamllint](#yamllint) + * [Yamlschema](#yamlschema) * [Testing the different `test__package`](#testing-the-different-test__package) * [Testing more environments](#testing-more-environments) * [Using Conan 2.0](#using-conan-20) diff --git a/docs/linters.md b/docs/linters.md index ac6c1ce8fc4a64..b93f645337264a 100644 --- a/docs/linters.md +++ b/docs/linters.md @@ -12,7 +12,8 @@ to configure plugins, warnings and errors which should be enabled or disabled. ## Contents - * [Running the linter locally](#running-the-linter-locally) + * [Understanding the different linters](#understanding-the-different-linters) + * [Running the linters locally](#running-the-linters-locally) * [Pylint configuration files](#pylint-configuration-files) * [Linter Warning and Errors](#linter-warning-and-errors) * [E9006 - conan-import-conanfile: ConanFile should be imported from conan](#e9006---conan-import-conanfile-conanfile-should-be-imported-from-conan) From f6cfa4ed81f98221490de5a0036e74c02705ab87 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 26 Oct 2022 06:06:53 +0900 Subject: [PATCH 188/300] (#13638) watcher: add recipe * watcher: add recipe * add end line * rename self.info.settings to self.settings * update compiler version check * use subprocess to run test_package * remove env_vars * update test_package.cpp using thread * link Threads library * add patch for support some compilers * remove commented code Co-authored-by: Chris Mc * use `self.ref` Co-authored-by: Chris Mc * add url of upstream PR Co-authored-by: Chris Mc --- recipes/watcher/all/conandata.yml | 11 +++ recipes/watcher/all/conanfile.py | 82 +++++++++++++++++++ .../all/patches/0.3.1-fix-include.patch | 12 +++ .../watcher/all/test_package/CMakeLists.txt | 10 +++ recipes/watcher/all/test_package/conanfile.py | 26 ++++++ .../watcher/all/test_package/test_package.cpp | 32 ++++++++ .../all/test_v1_package/CMakeLists.txt | 13 +++ .../watcher/all/test_v1_package/conanfile.py | 17 ++++ recipes/watcher/config.yml | 3 + 9 files changed, 206 insertions(+) create mode 100644 recipes/watcher/all/conandata.yml create mode 100644 recipes/watcher/all/conanfile.py create mode 100644 recipes/watcher/all/patches/0.3.1-fix-include.patch create mode 100644 recipes/watcher/all/test_package/CMakeLists.txt create mode 100644 recipes/watcher/all/test_package/conanfile.py create mode 100644 recipes/watcher/all/test_package/test_package.cpp create mode 100644 recipes/watcher/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/watcher/all/test_v1_package/conanfile.py create mode 100644 recipes/watcher/config.yml diff --git a/recipes/watcher/all/conandata.yml b/recipes/watcher/all/conandata.yml new file mode 100644 index 00000000000000..deeeea7472760a --- /dev/null +++ b/recipes/watcher/all/conandata.yml @@ -0,0 +1,11 @@ +sources: + "0.3.1": + url: "https://github.com/e-dant/watcher/archive/refs/tags/release/0.3.1.tar.gz" + sha256: "0fa79d21ac16c96b7ca50f2563aed9d8841e5b8f139af27d0b2cf199d0d281dc" + +patches: + "0.3.1": + - patch_file: "patches/0.3.1-fix-include.patch" + patch_description: "add missing include headers for some compilers" + patch_type: "portability" + patch_source: "https://github.com/e-dant/watcher/pull/18" diff --git a/recipes/watcher/all/conanfile.py b/recipes/watcher/all/conanfile.py new file mode 100644 index 00000000000000..583d57f7ba78b5 --- /dev/null +++ b/recipes/watcher/all/conanfile.py @@ -0,0 +1,82 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.apple import is_apple_os +from conan.tools.microsoft import check_min_vs +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.49.0" + +class WatcherConan(ConanFile): + name = "watcher" + description = "Filesystem watcher. Works anywhere. Simple, efficient and friendly." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/e-dant/watcher/" + topics = ("watch", "filesystem", "event", "header-only") + settings = "os", "arch", "compiler", "build_type" + + @property + def _minimum_cpp_standard(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "13", + "apple-clang": "13.1", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 192) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + if is_apple_os(self): + self.cpp_info.frameworks = ["CoreFoundation", "CoreServices"] diff --git a/recipes/watcher/all/patches/0.3.1-fix-include.patch b/recipes/watcher/all/patches/0.3.1-fix-include.patch new file mode 100644 index 00000000000000..1c3d12d2130dea --- /dev/null +++ b/recipes/watcher/all/patches/0.3.1-fix-include.patch @@ -0,0 +1,12 @@ +diff --git a/include/watcher/adapter/linux/watch.hpp b/include/watcher/adapter/linux/watch.hpp +index 1b6b61a..a3e6aa9 100644 +--- a/include/watcher/adapter/linux/watch.hpp ++++ b/include/watcher/adapter/linux/watch.hpp +@@ -11,6 +11,7 @@ + + #include + #include ++#include + #include + #include + #include diff --git a/recipes/watcher/all/test_package/CMakeLists.txt b/recipes/watcher/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..0abe99ac0774e6 --- /dev/null +++ b/recipes/watcher/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package LANGUAGES CXX) + +find_package(watcher REQUIRED CONFIG) +find_package(Threads REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE watcher::watcher Threads::Threads) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/watcher/all/test_package/conanfile.py b/recipes/watcher/all/test_package/conanfile.py new file mode 100644 index 00000000000000..2704a5edd07d6c --- /dev/null +++ b/recipes/watcher/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.build import can_run + +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/watcher/all/test_package/test_package.cpp b/recipes/watcher/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..f0f43edad4ad8f --- /dev/null +++ b/recipes/watcher/all/test_package/test_package.cpp @@ -0,0 +1,32 @@ +#include +#include +#include + +#include "watcher/watcher.hpp" + +int main(int argc, char** argv) { + std::cout << R"({ + "water.watcher.stream":{ +)"; + + auto const show_event_json = [](const water::watcher::event::event& this_event) { + std::cout << " " << this_event; + if (this_event.kind != water::watcher::event::kind::watcher) { + std::cout << ","; + } + std::cout << "\n"; + }; + + std::thread([&]() { water::watcher::watch(".", show_event_json); }).detach(); + auto const time_until_death = std::chrono::seconds(3); + std::this_thread::sleep_for(time_until_death); + auto const is_watch_dead = water::watcher::die(show_event_json); + + std::cout << " },\n" + << R"( "milliseconds":)" << time_until_death.count() << "," << std::endl + << R"( "expired":)" << std::boolalpha << is_watch_dead << "\n" + << "}" + << std::endl; + + return 0; +} diff --git a/recipes/watcher/all/test_v1_package/CMakeLists.txt b/recipes/watcher/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..3e92aa19bad1c4 --- /dev/null +++ b/recipes/watcher/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(watcher REQUIRED CONFIG) +find_package(Threads REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE watcher::watcher Threads::Threads) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/watcher/all/test_v1_package/conanfile.py b/recipes/watcher/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..20d4d2e28d57e0 --- /dev/null +++ b/recipes/watcher/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/watcher/config.yml b/recipes/watcher/config.yml new file mode 100644 index 00000000000000..b9005978dcd6cb --- /dev/null +++ b/recipes/watcher/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.1": + folder: all From 0f5b579a7f0bc1ec500a1f41bba630641a77aa03 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 26 Oct 2022 06:27:25 +0900 Subject: [PATCH 189/300] (#13687) libdeflate: add version 1.14 * libdeflate: add version 1.14 * fix license path * revert _build_msvc() * update required_conan_version Co-authored-by: Jordan Williams * make patch_type `conan` Co-authored-by: Chris Mc * make patch_type `conan` Co-authored-by: Chris Mc * make patch_type `conan` Co-authored-by: Chris Mc * make patch_type `conan` Co-authored-by: Chris Mc * make patch_type `conan` Co-authored-by: Chris Mc * make patch_type `conan` Co-authored-by: Chris Mc Co-authored-by: Jordan Williams Co-authored-by: Chris Mc --- recipes/libdeflate/all/conandata.yml | 18 +++++ recipes/libdeflate/all/conanfile.py | 69 +++++++++++-------- .../all/patches/1.14-0001-fix-makefiles.patch | 40 +++++++++++ .../all/test_package/CMakeLists.txt | 2 +- recipes/libdeflate/config.yml | 2 + 5 files changed, 100 insertions(+), 31 deletions(-) create mode 100644 recipes/libdeflate/all/patches/1.14-0001-fix-makefiles.patch diff --git a/recipes/libdeflate/all/conandata.yml b/recipes/libdeflate/all/conandata.yml index 3cde5f3099a8c5..61586a615d8076 100644 --- a/recipes/libdeflate/all/conandata.yml +++ b/recipes/libdeflate/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.14": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.14.tar.gz" + sha256: "89e7df898c37c3427b0f39aadcf733731321a278771d20fc553f92da8d4808ac" "1.12": url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.12.tar.gz" sha256: "ba89fb167a5ab6bbdfa6ee3b1a71636e8140fa8471cce8a311697584948e4d06" @@ -15,18 +18,33 @@ sources: url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.7.tar.gz" sha256: "a5e6a0a9ab69f40f0f59332106532ca76918977a974e7004977a9498e3f11350" patches: + "1.14": + - patch_file: "patches/1.14-0001-fix-makefiles.patch" + base_path: "source_subfolder" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" "1.12": - patch_file: "patches/1.12-0001-fix-makefiles.patch" base_path: "source_subfolder" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" "1.10": - patch_file: "patches/1.9-0001-fix-makefiles.patch" base_path: "source_subfolder" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" "1.9": - patch_file: "patches/1.9-0001-fix-makefiles.patch" base_path: "source_subfolder" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" "1.8": - patch_file: "patches/1.7-0001-fix-makefiles.patch" base_path: "source_subfolder" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" "1.7": - patch_file: "patches/1.7-0001-fix-makefiles.patch" base_path: "source_subfolder" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" diff --git a/recipes/libdeflate/all/conanfile.py b/recipes/libdeflate/all/conanfile.py index 2added39f9f2ed..efb08d8979a199 100644 --- a/recipes/libdeflate/all/conanfile.py +++ b/recipes/libdeflate/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools +from conan import ConanFile from conan.tools.microsoft import is_msvc +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, chdir, rmdir, copy, rm +from conan.tools.env import Environment +from conans import MSBuild, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment +from conans.tools import vcvars, environment_append import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class LibdeflateConan(ConanFile): @@ -35,8 +39,7 @@ def _settings_build(self): return getattr(self, "settings_build", self.settings) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,34 +47,40 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def build_requirements(self): - if self._settings_build.os == "Windows" and not is_msvc(self) and \ - not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows" and not is_msvc(self): + if "CONAN_BASH_PATH" not in Environment().vars(self, scope="build").keys(): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _build_msvc(self): - with tools.chdir(self._source_subfolder): - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - target = "libdeflate.dll" if self.options.shared else "libdeflatestatic.lib" - self.run("nmake /f Makefile.msc {}".format(target)) + with chdir(self, self._source_subfolder): + with vcvars(self), environment_append(VisualStudioBuildEnvironment(self).vars): + target = "libdeflate.dll" if self.options.shared else "libdeflatestatic.lib" + self.run("nmake /f Makefile.msc {}".format(target)) def _build_make(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with tools.chdir(self._source_subfolder): + autotools = AutoToolsBuildEnvironment(self, win_bash=(self._settings_build.os == "Windows")) + with chdir(self, self._source_subfolder): autotools.make() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if is_msvc(self) or self._is_clangcl: self._build_msvc() else: @@ -86,18 +95,18 @@ def _package_windows(self): self.copy("*deflatestatic.lib", dst="lib", src=self._source_subfolder) def _package_make(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with tools.chdir(self._source_subfolder): + autotools = AutoToolsBuildEnvironment(self, win_bash=(self._settings_build.os == "Windows")) + with chdir(self, self._source_subfolder): autotools.install(args=["PREFIX={}".format(self.package_folder)]) - tools.rmdir(os.path.join(self.package_folder, "bin")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask( - os.path.join(self.package_folder, "lib"), - "*.a" if self.options.shared else "*.[so|dylib]*", - ) + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.a" if self.options.shared else "*.[so|dylib]*", os.path.join(self.package_folder, "lib") ) def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") + copy(self, "COPYING", + src=os.path.join(self.source_folder, self._source_subfolder), + dst=os.path.join(self.package_folder, "licenses" + )) if self.settings.os == "Windows": self._package_windows() else: diff --git a/recipes/libdeflate/all/patches/1.14-0001-fix-makefiles.patch b/recipes/libdeflate/all/patches/1.14-0001-fix-makefiles.patch new file mode 100644 index 00000000000000..6f2656728ddc66 --- /dev/null +++ b/recipes/libdeflate/all/patches/1.14-0001-fix-makefiles.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile b/Makefile +index a08c945..36876b5 100644 +--- a/Makefile ++++ b/Makefile +@@ -54,7 +54,7 @@ cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null \ + 1>&2 2>/dev/null; then echo $(1); fi) + + override CFLAGS := \ +- -O2 -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ ++ -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ + $(call cc-option,-Wdeclaration-after-statement) \ + $(call cc-option,-Wimplicit-fallthrough) \ + $(call cc-option,-Wmissing-prototypes) \ +@@ -120,7 +120,7 @@ else ifneq ($(findstring -darwin,$(TARGET_MACHINE)),) + SHARED_LIB := libdeflate.$(SOVERSION).dylib + SHARED_LIB_SYMLINK := libdeflate.dylib + SHARED_LIB_CFLAGS := -fPIC +- SHARED_LIB_LDFLAGS := -install_name $(LIBDIR)/$(SHARED_LIB) ++ SHARED_LIB_LDFLAGS := -install_name @rpath/$(SHARED_LIB) + + # Compiling for Android? + else ifneq ($(findstring -android,$(TARGET_MACHINE)),) +diff --git a/Makefile.msc b/Makefile.msc +index 1449618..a61c034 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -7,11 +7,10 @@ + + .SUFFIXES: .c .obj .dllobj + +-CC = cl ++CC = $(CC) + LD = link + AR = lib +-CFLAGS = /MD /O2 -I. +-LDFLAGS = ++CFLAGS = /nologo $(CFLAGS) -I. + + STATIC_LIB = libdeflatestatic.lib + SHARED_LIB = libdeflate.dll diff --git a/recipes/libdeflate/all/test_package/CMakeLists.txt b/recipes/libdeflate/all/test_package/CMakeLists.txt index dcdf023d7a1031..7605a460c5f4b0 100644 --- a/recipes/libdeflate/all/test_package/CMakeLists.txt +++ b/recipes/libdeflate/all/test_package/CMakeLists.txt @@ -7,4 +7,4 @@ conan_basic_setup(TARGETS) find_package(libdeflate REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package libdeflate::libdeflate) +target_link_libraries(test_package PRIVATE libdeflate::libdeflate) diff --git a/recipes/libdeflate/config.yml b/recipes/libdeflate/config.yml index df147b016e77bb..4a96e3e23227b1 100644 --- a/recipes/libdeflate/config.yml +++ b/recipes/libdeflate/config.yml @@ -1,4 +1,6 @@ versions: + "1.14": + folder: all "1.12": folder: all "1.10": From 522614a82d554f73c548e73352002d9e0195aa34 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 26 Oct 2022 00:04:27 +0200 Subject: [PATCH 190/300] (#12804) add reactiveplusplus/0.1.2 * add reactiveplusplus/0.1.2 * try clang 12 --- recipes/reactiveplusplus/all/conandata.yml | 4 + recipes/reactiveplusplus/all/conanfile.py | 87 +++++++++++++++++++ .../all/test_package/CMakeLists.txt | 8 ++ .../all/test_package/conanfile.py | 26 ++++++ .../all/test_package/test_package.cpp | 14 +++ .../all/test_v1_package/CMakeLists.txt | 8 ++ .../all/test_v1_package/conanfile.py | 17 ++++ recipes/reactiveplusplus/config.yml | 3 + 8 files changed, 167 insertions(+) create mode 100644 recipes/reactiveplusplus/all/conandata.yml create mode 100644 recipes/reactiveplusplus/all/conanfile.py create mode 100644 recipes/reactiveplusplus/all/test_package/CMakeLists.txt create mode 100644 recipes/reactiveplusplus/all/test_package/conanfile.py create mode 100644 recipes/reactiveplusplus/all/test_package/test_package.cpp create mode 100644 recipes/reactiveplusplus/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/reactiveplusplus/all/test_v1_package/conanfile.py create mode 100644 recipes/reactiveplusplus/config.yml diff --git a/recipes/reactiveplusplus/all/conandata.yml b/recipes/reactiveplusplus/all/conandata.yml new file mode 100644 index 00000000000000..c59e0ceafbbd79 --- /dev/null +++ b/recipes/reactiveplusplus/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.2": + url: "https://github.com/victimsnino/ReactivePlusPlus/archive/refs/tags/v0.1.2.tar.gz" + sha256: "daa16d8258d811bfc6848829ea1afa6f4a72b68ad8978d55ea4e1cf809ae6d52" diff --git a/recipes/reactiveplusplus/all/conanfile.py b/recipes/reactiveplusplus/all/conanfile.py new file mode 100644 index 00000000000000..d8d1eb5567b3d5 --- /dev/null +++ b/recipes/reactiveplusplus/all/conanfile.py @@ -0,0 +1,87 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class ReactivePlusPlusConan(ConanFile): + name = "reactiveplusplus" + description = ( + "ReactivePlusPlus is library for building asynchronous event-driven " + "streams of data with help of sequences of primitive operators in the " + "declarative form." + ) + license = "BSL-1.0" + topics = ("reactivex", "asynchronous", "event", "observable", "values-distributed-in-time") + homepage = "https://github.com/victimsnino/ReactivePlusPlus" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return "20" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16.10", + "msvc": "192", + "gcc": "10", + "clang": "12", + "apple-clang": "14", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", + src=os.path.join(self.source_folder, "src", "rpp", "rpp"), + dst=os.path.join(self.package_folder, "include", "rpp")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "RPP") + self.cpp_info.set_property("cmake_target_name", "RPP::rpp") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.names["cmake_find_package"] = "RPP" + self.cpp_info.names["cmake_find_package_multi"] = "RPP" + self.cpp_info.components["_reactiveplusplus"].names["cmake_find_package"] = "rpp" + self.cpp_info.components["_reactiveplusplus"].names["cmake_find_package_multi"] = "rpp" + self.cpp_info.components["_reactiveplusplus"].set_property("cmake_target_name", "RPP::rpp") + self.cpp_info.components["_reactiveplusplus"].bindirs = [] + self.cpp_info.components["_reactiveplusplus"].libdirs = [] diff --git a/recipes/reactiveplusplus/all/test_package/CMakeLists.txt b/recipes/reactiveplusplus/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..96e89147f81a9c --- /dev/null +++ b/recipes/reactiveplusplus/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(RPP REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE RPP::rpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/reactiveplusplus/all/test_package/conanfile.py b/recipes/reactiveplusplus/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0a6bc68712d901 --- /dev/null +++ b/recipes/reactiveplusplus/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/reactiveplusplus/all/test_package/test_package.cpp b/recipes/reactiveplusplus/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..cbca58fc39109c --- /dev/null +++ b/recipes/reactiveplusplus/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +#include +#include + +int main() +{ + auto observable = rpp::source::from_callable(&::getchar) + .repeat() + .take_while([](char v) { return v != '0'; }) + .filter(std::not_fn(&::isdigit)) + .map(&::toupper); + return 0; +} diff --git a/recipes/reactiveplusplus/all/test_v1_package/CMakeLists.txt b/recipes/reactiveplusplus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/reactiveplusplus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/reactiveplusplus/all/test_v1_package/conanfile.py b/recipes/reactiveplusplus/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/reactiveplusplus/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/reactiveplusplus/config.yml b/recipes/reactiveplusplus/config.yml new file mode 100644 index 00000000000000..b3c71bd313abc6 --- /dev/null +++ b/recipes/reactiveplusplus/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.2": + folder: all From ce8016f1034fc05f405c3447c2fc42c648e62fc1 Mon Sep 17 00:00:00 2001 From: Martin Delille Date: Wed, 26 Oct 2022 00:25:43 +0200 Subject: [PATCH 191/300] (#13691) Add openapi-generator/6.0.1 * Add openapi-generator/6.0.1 * Add execution permission * Add 6.1.0 and 6.2.0 * Delete settings.arch from package_id * Fix lint issues * Add openjdk requirement --- recipes/openapi-generator/all/conandata.yml | 10 +++ recipes/openapi-generator/all/conanfile.py | 76 +++++++++++++++++++ .../all/test_package/conanfile.py | 16 ++++ .../all/test_v1_package/conanfile.py | 10 +++ recipes/openapi-generator/config.yml | 7 ++ 5 files changed, 119 insertions(+) create mode 100644 recipes/openapi-generator/all/conandata.yml create mode 100644 recipes/openapi-generator/all/conanfile.py create mode 100644 recipes/openapi-generator/all/test_package/conanfile.py create mode 100644 recipes/openapi-generator/all/test_v1_package/conanfile.py create mode 100644 recipes/openapi-generator/config.yml diff --git a/recipes/openapi-generator/all/conandata.yml b/recipes/openapi-generator/all/conandata.yml new file mode 100644 index 00000000000000..d738fb6bd4efad --- /dev/null +++ b/recipes/openapi-generator/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "6.2.0": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.0/openapi-generator-cli-6.2.0.jar" + sha256: "60707e2c8938a94278f6216081d7067d0f1beced8c8eb1277e625e9a59ccd2da" + "6.1.0": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.1.0/openapi-generator-cli-6.1.0.jar" + sha256: "3bcbff776072e4e5161307f837d34ab4713a13ed9edc20e4983c2321791ea037" + "6.0.1": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.0.1/openapi-generator-cli-6.0.1.jar" + sha256: "ba9279900d1fefc9f0b977264b709f7d481c278d6780090b36673b65cb1a9122" diff --git a/recipes/openapi-generator/all/conanfile.py b/recipes/openapi-generator/all/conanfile.py new file mode 100644 index 00000000000000..a754dcb24fe109 --- /dev/null +++ b/recipes/openapi-generator/all/conanfile.py @@ -0,0 +1,76 @@ +from conan import ConanFile +from conan.tools.files import copy, download, save +import os +import stat + + +required_conan_version = ">=1.47.0" + + +class OpenApiGeneratorConan(ConanFile): + name = "openapi-generator" + description = "Generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://openapi-generator.tech" + topics = ("api", "sdk", "generator", "openapi") + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + pass + + def requirements(self): + self.requires("openjdk/16.0.1") + + def package_id(self): + del self.info.settings.arch + del self.info.settings.compiler + del self.info.settings.build_type + + def source(self): + pass + + def build(self): + v = self.conan_data["sources"][self.version] + download( + self, + url=v["url"], + filename=os.path.join(self.source_folder, "openapi-generator.jar"), + sha256=v["sha256"], + ) + download( + self, + url="https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/LICENSE", + filename=os.path.join(self.source_folder, "LICENSE"), + sha256="91a2fcdfc23cbd1188a22cc3b76647bf6eb05c87889e376a19fe478f0398ff02", + ) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="openapi-generator.jar", dst=os.path.join(self.package_folder, "res"), src=self.source_folder) + jar = os.path.join(self.package_folder, "res", "openapi-generator.jar") + if self.info.settings.os == "Windows": + save(self, + path=os.path.join(self.package_folder, "bin", "openapi-generator.bat"), + content=f"""\ + java -jar {jar} %* + """ + ) + else: + bin_path = os.path.join(self.package_folder, "bin", "openapi-generator") + save(self, + path=bin_path, + content=f"""\ + #!/bin/bash + java -jar {jar} $@ + """ + ) + st = os.stat(bin_path) + os.chmod(bin_path, st.st_mode | stat.S_IEXEC) + + def package_info(self): + # folders not used for pre-built binaries + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] diff --git a/recipes/openapi-generator/all/test_package/conanfile.py b/recipes/openapi-generator/all/test_package/conanfile.py new file mode 100644 index 00000000000000..3065918ed1fdff --- /dev/null +++ b/recipes/openapi-generator/all/test_package/conanfile.py @@ -0,0 +1,16 @@ +from conan import ConanFile +from conan.tools.build import can_run + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + if can_run(self): + self.run("openapi-generator --version") diff --git a/recipes/openapi-generator/all/test_v1_package/conanfile.py b/recipes/openapi-generator/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..a481f4b62ad170 --- /dev/null +++ b/recipes/openapi-generator/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +from conans import ConanFile +from conan.tools.build import can_run + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if can_run(self): + self.run("openapi-generator --version", run_environment=True) diff --git a/recipes/openapi-generator/config.yml b/recipes/openapi-generator/config.yml new file mode 100644 index 00000000000000..047977764bcbf5 --- /dev/null +++ b/recipes/openapi-generator/config.yml @@ -0,0 +1,7 @@ +versions: + "6.2.0": + folder: all + "6.1.0": + folder: all + "6.0.1": + folder: all From 2d9893ab9b25d2c8bebf3d3e0453fa9e93e2b71e Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 26 Oct 2022 00:45:31 +0200 Subject: [PATCH 192/300] (#13697) opencl-icd-loader: add 2022.05.18 + conan v2 support * conan v2 support * add opencl-icd-loader/2022.05.18 * fix conandata fields * add opencl-icd-loader/2022.09.30 * remove conan_version branching * remove pdb files --- recipes/opencl-icd-loader/all/CMakeLists.txt | 7 -- recipes/opencl-icd-loader/all/conandata.yml | 15 ++- recipes/opencl-icd-loader/all/conanfile.py | 108 +++++++++++------- .../all/test_package/CMakeLists.txt | 7 +- .../all/test_package/conanfile.py | 19 ++- .../all/test_v1_package/CMakeLists.txt | 8 ++ .../all/test_v1_package/conanfile.py | 17 +++ recipes/opencl-icd-loader/config.yml | 4 + 8 files changed, 122 insertions(+), 63 deletions(-) delete mode 100644 recipes/opencl-icd-loader/all/CMakeLists.txt create mode 100644 recipes/opencl-icd-loader/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/opencl-icd-loader/all/test_v1_package/conanfile.py diff --git a/recipes/opencl-icd-loader/all/CMakeLists.txt b/recipes/opencl-icd-loader/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb93..00000000000000 --- a/recipes/opencl-icd-loader/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/opencl-icd-loader/all/conandata.yml b/recipes/opencl-icd-loader/all/conandata.yml index a3f89d19bb81ab..398c17f249549e 100644 --- a/recipes/opencl-icd-loader/all/conandata.yml +++ b/recipes/opencl-icd-loader/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2022.09.30": + url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2022.09.30.tar.gz" + sha256: "e9522fb736627dd4feae2a9c467a864e7d25bb715f808de8a04eea5a7d394b74" + "2022.05.18": + url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2022.05.18.tar.gz" + sha256: "71f70bba797a501b13b6b0905dc852f3fd6e264d74ce294f2df98d29914c4303" "2022.01.04": url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/v2022.01.04.tar.gz" sha256: "9f21d958af68c1b625a03c2befddd79da95d610614ddab6c291f26f01a947dd8" @@ -10,8 +16,7 @@ sources: sha256: "e7a0c161376bfb46b869e292d4593a64f4ff7b358837494a5f2d765d9a2af683" patches: "2020.06.16": - - base_path: "source_subfolder" - patch_file: "patches/2020.06.16/0001-xcode-missing-includes.patch" - # patch_type: portability - # source: https://github.com/KhronosGroup/OpenCL-ICD-Loader/pull/131 - # description: Add missing includes (needed for new Xcode versions) + - patch_file: "patches/2020.06.16/0001-xcode-missing-includes.patch" + patch_description: "Add missing includes (needed for new Xcode versions)" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/pull/131" diff --git a/recipes/opencl-icd-loader/all/conanfile.py b/recipes/opencl-icd-loader/all/conanfile.py index 6328f43b1ab665..58940f83c77c30 100644 --- a/recipes/opencl-icd-loader/all/conanfile.py +++ b/recipes/opencl-icd-loader/all/conanfile.py @@ -1,31 +1,34 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class OpenclIcdLoaderConan(ConanFile): name = "opencl-icd-loader" description = "OpenCL ICD Loader." license = "Apache-2.0" - topics = ("opencl-icd-loader", "opencl", "khronos", "parallel", "icd-loader") + topics = ("opencl", "khronos", "parallel", "icd-loader") homepage = "https://github.com/KhronosGroup/OpenCL-ICD-Loader" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False], "disable_openclon12": [True, False]} - default_options = {"shared": False, "fPIC": True, "disable_openclon12": False} - - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + options = { + "shared": [True, False], + "fPIC": [True, False], + "disable_openclon12": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "disable_openclon12": False, + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,49 +38,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("opencl-headers/{}".format(self.version)) + self.requires(f"opencl-headers/{self.version}", transitive_headers=True) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OPENCL_ICD_LOADER_HEADERS_DIR"] = ";".join(self.deps_cpp_info["opencl-headers"].include_paths) - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["USE_DYNAMIC_VCXX_RUNTIME"] = str(self.settings.compiler.runtime).startswith("MD") - self._cmake.definitions["OPENCL_ICD_LOADER_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["OPENCL_ICD_LOADER_BUILD_TESTING"] = False + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["OPENCL_ICD_LOADER_HEADERS_DIR"] = ";".join(self.deps_cpp_info["opencl-headers"].include_paths) + if is_msvc(self): + tc.variables["USE_DYNAMIC_VCXX_RUNTIME"] = not is_msvc_static_runtime(self) + tc.variables["OPENCL_ICD_LOADER_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["OPENCL_ICD_LOADER_BUILD_TESTING"] = False if self.settings.os == "Windows": - self._cmake.definitions["OPENCL_ICD_LOADER_DISABLE_OPENCLON12"] = self.options.disable_openclon12 - self._cmake.configure() - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tc.variables["OPENCL_ICD_LOADER_DISABLE_OPENCLON12"] = self.options.disable_openclon12 + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_module_file_name", "OpenCL") + self.cpp_info.set_property("cmake_file_name", "OpenCLICDLoader") + self.cpp_info.set_property("cmake_target_name", "OpenCL::OpenCL") self.cpp_info.includedirs = [] self.cpp_info.libs = ["OpenCL"] if not self.options.shared: - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["dl", "pthread"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["cfgmgr32", "runtimeobject"] + + # TODO: to remove in conan v2 + self.cpp_info.filenames["cmake_find_package"] = "OpenCL" + self.cpp_info.filenames["cmake_find_package_multi"] = "OpenCLICDLoader" + self.cpp_info.names["cmake_find_package"] = "OpenCL" + self.cpp_info.names["cmake_find_package_multi"] = "OpenCL" diff --git a/recipes/opencl-icd-loader/all/test_package/CMakeLists.txt b/recipes/opencl-icd-loader/all/test_package/CMakeLists.txt index 7b9b613cbb24a3..d33ec860598705 100644 --- a/recipes/opencl-icd-loader/all/test_package/CMakeLists.txt +++ b/recipes/opencl-icd-loader/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(OpenCLICDLoader REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenCL::OpenCL) diff --git a/recipes/opencl-icd-loader/all/test_package/conanfile.py b/recipes/opencl-icd-loader/all/test_package/conanfile.py index 5c09494bc67c01..0a6bc68712d901 100644 --- a/recipes/opencl-icd-loader/all/test_package/conanfile.py +++ b/recipes/opencl-icd-loader/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opencl-icd-loader/all/test_v1_package/CMakeLists.txt b/recipes/opencl-icd-loader/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/opencl-icd-loader/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencl-icd-loader/all/test_v1_package/conanfile.py b/recipes/opencl-icd-loader/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/opencl-icd-loader/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opencl-icd-loader/config.yml b/recipes/opencl-icd-loader/config.yml index 16434eecdd52e4..ee1b6d54f979ed 100644 --- a/recipes/opencl-icd-loader/config.yml +++ b/recipes/opencl-icd-loader/config.yml @@ -1,4 +1,8 @@ versions: + "2022.09.30": + folder: all + "2022.05.18": + folder: all "2022.01.04": folder: all "2021.04.29": From 11de64d24f81b047c6e9d3e92b9c0415b2d12e51 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 26 Oct 2022 08:49:55 +0900 Subject: [PATCH 193/300] (#13749) libslz: add version 1.2.1 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/libslz/all/conandata.yml | 3 +++ recipes/libslz/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/libslz/all/conandata.yml b/recipes/libslz/all/conandata.yml index cbdc865b700d37..8f01e85db189d2 100644 --- a/recipes/libslz/all/conandata.yml +++ b/recipes/libslz/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.1": + url: "https://github.com/wtarreau/libslz/archive/v1.2.1.tar.gz" + sha256: "c1fa88556e97541a550e59fd1f0fc8f6b4c02444b14c13eb553c9827123122c5" "1.2.0": url: "https://github.com/wtarreau/libslz/archive/refs/tags/v1.2.0.tar.gz" sha256: "723a8ef648ac5b30e5074c013ff61a5e5f54a5aafc9496f7dab9f6b02030bf24" diff --git a/recipes/libslz/config.yml b/recipes/libslz/config.yml index 7ed1f1b6fc6958..9f174d514c33f6 100644 --- a/recipes/libslz/config.yml +++ b/recipes/libslz/config.yml @@ -1,3 +1,5 @@ versions: + "1.2.1": + folder: all "1.2.0": folder: all From 4803483f0194639a0efe02b2d45e6707c0927a76 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 26 Oct 2022 07:07:13 +0200 Subject: [PATCH 194/300] (#13745) libjpeg-turbo: conan v2 support * conan v2 support * add VirtualBuildEnv --- recipes/libjpeg-turbo/all/CMakeLists.txt | 9 +- recipes/libjpeg-turbo/all/conandata.yml | 3 - recipes/libjpeg-turbo/all/conanfile.py | 160 ++++++++++-------- .../all/test_package/CMakeLists.txt | 13 +- .../all/test_package/conanfile.py | 21 ++- .../all/test_package_module/CMakeLists.txt | 8 + .../all/test_package_module/conanfile.py | 27 +++ .../all/test_v1_package/CMakeLists.txt | 8 + .../all/test_v1_package/conanfile.py | 18 ++ .../all/test_v1_package_module/CMakeLists.txt | 8 + .../all/test_v1_package_module/conanfile.py | 18 ++ 11 files changed, 197 insertions(+), 96 deletions(-) create mode 100644 recipes/libjpeg-turbo/all/test_package_module/CMakeLists.txt create mode 100644 recipes/libjpeg-turbo/all/test_package_module/conanfile.py create mode 100644 recipes/libjpeg-turbo/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libjpeg-turbo/all/test_v1_package/conanfile.py create mode 100644 recipes/libjpeg-turbo/all/test_v1_package_module/CMakeLists.txt create mode 100644 recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py diff --git a/recipes/libjpeg-turbo/all/CMakeLists.txt b/recipes/libjpeg-turbo/all/CMakeLists.txt index 09495a3ab6e928..5ab4bc9f0265e1 100644 --- a/recipes/libjpeg-turbo/all/CMakeLists.txt +++ b/recipes/libjpeg-turbo/all/CMakeLists.txt @@ -1,13 +1,8 @@ cmake_minimum_required(VERSION 3.1) - project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup(NO_OUTPUT_DIRS) - if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_LIBJPEG_SYSTEM_PROCESSOR}) + set(CMAKE_SYSTEM_PROCESSOR ${CONAN_LIBJPEG_TURBO_SYSTEM_PROCESSOR}) endif() - -add_subdirectory("source_subfolder") +add_subdirectory("src") diff --git a/recipes/libjpeg-turbo/all/conandata.yml b/recipes/libjpeg-turbo/all/conandata.yml index 60485970620b8b..dd61b3782fc38d 100644 --- a/recipes/libjpeg-turbo/all/conandata.yml +++ b/recipes/libjpeg-turbo/all/conandata.yml @@ -20,11 +20,8 @@ sources: "2.0.5": url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.5.tar.gz" sha256: "b3090cd37b5a8b3e4dbd30a1311b3989a894e5d3c668f14cbc6739d77c9402b7" - patches: "2.1.4": - patch_file: "patches/2.1.3-0001-fix-cmake.patch" - base_path: "source_subfolder" "2.1.3": - patch_file: "patches/2.1.3-0001-fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/libjpeg-turbo/all/conanfile.py b/recipes/libjpeg-turbo/all/conanfile.py index 2ad62b1340bf79..86caf639f776a5 100644 --- a/recipes/libjpeg-turbo/all/conanfile.py +++ b/recipes/libjpeg-turbo/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.52.0" class LibjpegTurboConan(ConanFile): @@ -42,26 +46,29 @@ class LibjpegTurboConan(ConanFile): "java": False, "enable12bit": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass if self.options.enable12bit: del self.options.java @@ -74,13 +81,24 @@ def configure(self): if self.options.libjpeg8_compatibility: del self.options.mem_src_dst + def layout(self): + cmake_layout(self, src_folder="src") + def validate(self): - if self.options.enable12bit and (self.options.libjpeg7_compatibility or self.options.libjpeg8_compatibility): + if self.info.options.enable12bit and (self.info.options.libjpeg7_compatibility or self.info.options.libjpeg8_compatibility): raise ConanInvalidConfiguration("12-bit samples is not allowed with libjpeg v7/v8 API/ABI") - if self.options.get_safe("java", False) and not self.options.shared: + if self.info.options.get_safe("java") and not self.info.options.shared: raise ConanInvalidConfiguration("java wrapper requires shared libjpeg-turbo") - if is_msvc(self) and self.options.shared and str(self.settings.compiler.runtime).startswith("MT"): - raise ConanInvalidConfiguration("shared libjpeg-turbo can't be built with MT or MTd") + if self.info.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.ref} shared can't be built with static vc runtime") + + def build_requirements(self): + if self.options.get_safe("SIMD") and self.settings.arch in ["x86", "x86_64"]: + self.tool_requires("nasm/2.15.05") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) @property def _is_arithmetic_encoding_enabled(self): @@ -92,91 +110,89 @@ def _is_arithmetic_decoding_enabled(self): return self.options.get_safe("arithmetic_decoder", False) or \ self.options.libjpeg7_compatibility or self.options.libjpeg8_compatibility - def build_requirements(self): - if self.options.get_safe("SIMD") and self.settings.arch in ["x86", "x86_64"]: - self.build_requires("nasm/2.14") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self, set_cmake_flags=True) - cmake.definitions["ENABLE_STATIC"] = not self.options.shared - cmake.definitions["ENABLE_SHARED"] = self.options.shared - cmake.definitions["WITH_SIMD"] = self.options.get_safe("SIMD", False) - cmake.definitions["WITH_ARITH_ENC"] = self._is_arithmetic_encoding_enabled - cmake.definitions["WITH_ARITH_DEC"] = self._is_arithmetic_decoding_enabled - cmake.definitions["WITH_JPEG7"] = self.options.libjpeg7_compatibility - cmake.definitions["WITH_JPEG8"] = self.options.libjpeg8_compatibility - cmake.definitions["WITH_MEM_SRCDST"] = self.options.get_safe("mem_src_dst", False) - cmake.definitions["WITH_TURBOJPEG"] = self.options.get_safe("turbojpeg", False) - cmake.definitions["WITH_JAVA"] = self.options.get_safe("java", False) - cmake.definitions["WITH_12BIT"] = self.options.enable12bit + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = CMakeToolchain(self) + tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["WITH_SIMD"] = self.options.get_safe("SIMD", False) + tc.variables["WITH_ARITH_ENC"] = self._is_arithmetic_encoding_enabled + tc.variables["WITH_ARITH_DEC"] = self._is_arithmetic_decoding_enabled + tc.variables["WITH_JPEG7"] = self.options.libjpeg7_compatibility + tc.variables["WITH_JPEG8"] = self.options.libjpeg8_compatibility + tc.variables["WITH_MEM_SRCDST"] = self.options.get_safe("mem_src_dst", False) + tc.variables["WITH_TURBOJPEG"] = self.options.get_safe("turbojpeg", False) + tc.variables["WITH_JAVA"] = self.options.get_safe("java", False) + tc.variables["WITH_12BIT"] = self.options.enable12bit if is_msvc(self): - cmake.definitions["WITH_CRT_DLL"] = True # avoid replacing /MD by /MT in compiler flags - - if tools.Version(self.version) <= "2.1.0": - cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False # avoid configuration error if building for iOS/tvOS/watchOS - - if tools.cross_building(self): + tc.variables["WITH_CRT_DLL"] = True # avoid replacing /MD by /MT in compiler flags + if Version(self.version) <= "2.1.0": + tc.variables["CMAKE_MACOSX_BUNDLE"] = False # avoid configuration error if building for iOS/tvOS/watchOS + if cross_building(self): # TODO: too specific and error prone, should be delegated to a conan helper function cmake_system_processor = { "armv8": "aarch64", "armv8.3": "aarch64", }.get(str(self.settings.arch), str(self.settings.arch)) - cmake.definitions["CONAN_LIBJPEG_SYSTEM_PROCESSOR"] = cmake_system_processor - - cmake.configure() - return cmake + tc.variables["CONAN_LIBJPEG_TURBO_SYSTEM_PROCESSOR"] = cmake_system_processor + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # use standard GNUInstallDirs.cmake - custom one is broken - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "include(cmakescripts/GNUInstallDirs.cmake)", "include(GNUInstallDirs)") # do not override /MT by /MD if shared - tools.replace_in_file(os.path.join(self._source_subfolder, "sharedlib", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "sharedlib", "CMakeLists.txt"), """string(REGEX REPLACE "/MT" "/MD" ${var} "${${var}}")""", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() # remove unneeded directories - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "doc")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "doc")) # remove binaries and pdb files for pattern_to_remove in ["cjpeg*", "djpeg*", "jpegtran*", "tjbench*", "wrjpgcom*", "rdjpgcom*", "*.pdb"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), pattern_to_remove) + rm(self, pattern_to_remove, os.path.join(self.package_folder, "bin")) def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_module_file_name", "JPEG") self.cpp_info.set_property("cmake_file_name", "libjpeg-turbo") cmake_target_suffix = "-static" if not self.options.shared else "" lib_suffix = "-static" if is_msvc(self) and not self.options.shared else "" - self.cpp_info.components["jpeg"].set_property("cmake_target_name", "libjpeg-turbo::jpeg{}".format(cmake_target_suffix)) + self.cpp_info.components["jpeg"].set_property("cmake_module_target_name", "JPEG::JPEG") + self.cpp_info.components["jpeg"].set_property("cmake_target_name", f"libjpeg-turbo::jpeg{cmake_target_suffix}") self.cpp_info.components["jpeg"].set_property("pkg_config_name", "libjpeg") - self.cpp_info.components["jpeg"].names["cmake_find_package"] = "jpeg" + cmake_target_suffix - self.cpp_info.components["jpeg"].names["cmake_find_package_multi"] = "jpeg" + cmake_target_suffix - self.cpp_info.components["jpeg"].libs = ["jpeg" + lib_suffix] + self.cpp_info.components["jpeg"].libs = [f"jpeg{lib_suffix}"] if self.options.get_safe("turbojpeg"): - self.cpp_info.components["turbojpeg"].set_property("cmake_target_name", "libjpeg-turbo::turbojpeg{}".format(cmake_target_suffix)) + self.cpp_info.components["turbojpeg"].set_property("cmake_target_name", f"libjpeg-turbo::turbojpeg{cmake_target_suffix}") self.cpp_info.components["turbojpeg"].set_property("pkg_config_name", "libturbojpeg") - self.cpp_info.components["turbojpeg"].names["cmake_find_package"] = "turbojpeg" + cmake_target_suffix - self.cpp_info.components["turbojpeg"].names["cmake_find_package_multi"] = "turbojpeg" + cmake_target_suffix - self.cpp_info.components["turbojpeg"].libs = ["turbojpeg" + lib_suffix] + self.cpp_info.components["turbojpeg"].libs = [f"turbojpeg{lib_suffix}"] + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "JPEG" + self.cpp_info.names["cmake_find_package_multi"] = "libjpeg-turbo" + self.cpp_info.components["jpeg"].names["cmake_find_package"] = "JPEG" + self.cpp_info.components["jpeg"].names["cmake_find_package_multi"] = f"jpeg{cmake_target_suffix}" + if self.options.get_safe("turbojpeg"): + self.cpp_info.components["turbojpeg"].names["cmake_find_package"] = f"turbojpeg{cmake_target_suffix}" + self.cpp_info.components["turbojpeg"].names["cmake_find_package_multi"] = f"turbojpeg{cmake_target_suffix}" diff --git a/recipes/libjpeg-turbo/all/test_package/CMakeLists.txt b/recipes/libjpeg-turbo/all/test_package/CMakeLists.txt index df694d56d4d0eb..8715b08bc7f766 100644 --- a/recipes/libjpeg-turbo/all/test_package/CMakeLists.txt +++ b/recipes/libjpeg-turbo/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(libjpeg-turbo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET libjpeg-turbo::jpeg) - target_link_libraries(${PROJECT_NAME} PRIVATE libjpeg-turbo::jpeg) + target_link_libraries(${PROJECT_NAME} PRIVATE libjpeg-turbo::jpeg) else() - target_link_libraries(${PROJECT_NAME} PRIVATE libjpeg-turbo::jpeg-static) + target_link_libraries(${PROJECT_NAME} PRIVATE libjpeg-turbo::jpeg-static) endif() -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libjpeg-turbo/all/test_package/conanfile.py b/recipes/libjpeg-turbo/all/test_package/conanfile.py index d5c6b828b775bc..fb5d85902cc520 100644 --- a/recipes/libjpeg-turbo/all/test_package/conanfile.py +++ b/recipes/libjpeg-turbo/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") img_name = os.path.join(self.source_folder, "testimg.jpg") - bin_path = os.path.join("bin", "test_package") - self.run('%s %s' % (bin_path, img_name), run_environment=True) + self.run(f"{bin_path} {img_name}", env="conanrun") diff --git a/recipes/libjpeg-turbo/all/test_package_module/CMakeLists.txt b/recipes/libjpeg-turbo/all/test_package_module/CMakeLists.txt new file mode 100644 index 00000000000000..b78c6fc513d77a --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_package_module/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(JPEG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libjpeg-turbo/all/test_package_module/conanfile.py b/recipes/libjpeg-turbo/all/test_package_module/conanfile.py new file mode 100644 index 00000000000000..fd19bb14250572 --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_package_module/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", env="conanrun") diff --git a/recipes/libjpeg-turbo/all/test_v1_package/CMakeLists.txt b/recipes/libjpeg-turbo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py b/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..a2b04c499e0acf --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", run_environment=True) diff --git a/recipes/libjpeg-turbo/all/test_v1_package_module/CMakeLists.txt b/recipes/libjpeg-turbo/all/test_v1_package_module/CMakeLists.txt new file mode 100644 index 00000000000000..27f7a57e7a0b3e --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_v1_package_module/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package_module + ${CMAKE_CURRENT_BINARY_DIR}/test_package_module) diff --git a/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py b/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py new file mode 100644 index 00000000000000..b6600e428515ca --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", run_environment=True) From b1670e1e14751ccd815a0bba5d7c094511543006 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 26 Oct 2022 17:05:23 +0900 Subject: [PATCH 195/300] (#13762) glaze: add version 0.1.0 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/glaze/all/conandata.yml | 3 +++ recipes/glaze/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/glaze/all/conandata.yml b/recipes/glaze/all/conandata.yml index 3c9390d824cd89..3d4f2f48f098bb 100644 --- a/recipes/glaze/all/conandata.yml +++ b/recipes/glaze/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.0": + url: "https://github.com/stephenberry/glaze/archive/v0.1.0.tar.gz" + sha256: "bb709637217b68c835c5c17d49d6e1d10682a9fb5d3899b4452f737f64961a67" "0.0.7": url: "https://github.com/stephenberry/glaze/archive/refs/tags/v0.0.7.tar.gz" sha256: "124f7e8fea58c012b548ba1b643684fe428c7dbfeb8d8a5f701eb7db4356a759" diff --git a/recipes/glaze/config.yml b/recipes/glaze/config.yml index 3b1adbf0ba92f5..43d3b0291396c1 100644 --- a/recipes/glaze/config.yml +++ b/recipes/glaze/config.yml @@ -1,3 +1,5 @@ versions: + "0.1.0": + folder: all "0.0.7": folder: all From bd4cd7b299ea4b89664c5b6192ef3aaea794fef0 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 26 Oct 2022 17:35:00 +0900 Subject: [PATCH 196/300] (#13763) watcher: add version 0.3.2 --- recipes/watcher/all/conandata.yml | 3 +++ recipes/watcher/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/watcher/all/conandata.yml b/recipes/watcher/all/conandata.yml index deeeea7472760a..3568e962cc45ca 100644 --- a/recipes/watcher/all/conandata.yml +++ b/recipes/watcher/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.3.2": + url: "https://github.com/e-dant/watcher/archive/refs/tags/release/0.3.2.tar.gz" + sha256: "f00247ad8ee492cb70143917bd19f80056227f4ebd4263015727f02750e4fbd5" "0.3.1": url: "https://github.com/e-dant/watcher/archive/refs/tags/release/0.3.1.tar.gz" sha256: "0fa79d21ac16c96b7ca50f2563aed9d8841e5b8f139af27d0b2cf199d0d281dc" diff --git a/recipes/watcher/config.yml b/recipes/watcher/config.yml index b9005978dcd6cb..8c5374f11cf763 100644 --- a/recipes/watcher/config.yml +++ b/recipes/watcher/config.yml @@ -1,3 +1,5 @@ versions: + "0.3.2": + folder: all "0.3.1": folder: all From 720a0a9d41a8a7aef23512990c0e84f6aabb48ec Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Wed, 26 Oct 2022 21:09:48 +0800 Subject: [PATCH 197/300] (#13485) nasm - upgrade to conan v2, based on prior work done by @czoido * nasm - upgrade to conan v2, based on prior work done by @czoido * nasm - fix for linter * nasm - fixup cflags * nasm - guess what to do with tools.get_env() * nasm - don't require replace to be successful * nasm - try removing autotools.autoreconf() as the CI wasn't building * nasm - reenable autoreconf() * Update recipes/nasm/all/conanfile.py Co-authored-by: Carlos Zoido * Update recipes/nasm/all/conanfile.py Co-authored-by: Carlos Zoido * Update recipes/nasm/all/conanfile.py Co-authored-by: Carlos Zoido * nasm - remove share dir * nasm - fix test_v1_package * Fixes from uilianries review * Fixes from @prince-chrismc review * Moved the (conan < 2) check to a diff spot * Replace shutil.copy() with shutil.copy2() * Apply suggestions from code review Co-authored-by: Chris Mc Co-authored-by: Carlos Zoido Co-authored-by: Chris Mc --- recipes/nasm/all/conandata.yml | 1 - recipes/nasm/all/conanfile.py | 120 ++++++++++-------- recipes/nasm/all/test_package/conanfile.py | 21 ++- recipes/nasm/all/test_v1_package/conanfile.py | 18 +++ .../nasm/all/test_v1_package/hello_linux.asm | 16 +++ 5 files changed, 114 insertions(+), 62 deletions(-) create mode 100644 recipes/nasm/all/test_v1_package/conanfile.py create mode 100644 recipes/nasm/all/test_v1_package/hello_linux.asm diff --git a/recipes/nasm/all/conandata.yml b/recipes/nasm/all/conandata.yml index 6cd038086b3e96..c97415979c9f2b 100644 --- a/recipes/nasm/all/conandata.yml +++ b/recipes/nasm/all/conandata.yml @@ -14,4 +14,3 @@ sources: patches: "2.15.05": - patch_file: "patches/2.15.05-0001-disable-newly-integrated-dependency-tracking.patch" - base_path: "source_subfolder" diff --git a/recipes/nasm/all/conanfile.py b/recipes/nasm/all/conanfile.py index fd394629da6567..3ae5789bf6256a 100644 --- a/recipes/nasm/all/conanfile.py +++ b/recipes/nasm/all/conanfile.py @@ -1,8 +1,15 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools import os import shutil -required_conan_version = ">=1.33.0" +from conan import ConanFile, conan_version +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, copy, get, rmdir, apply_conandata_patches, export_conandata_patches, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import VCVars, is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class NASMConan(ConanFile): @@ -11,85 +18,90 @@ class NASMConan(ConanFile): homepage = "http://www.nasm.us" description = "The Netwide Assembler, NASM, is an 80x86 and x86-64 assembler" license = "BSD-2-Clause" - settings = "os", "arch", "compiler", "build_type" topics = ("nasm", "installer", "assembler") - exports_sources = "patches/*" - _autotools = None + settings = "os", "arch", "compiler", "build_type" + - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self._settings_build.os == "Windows": - self.build_requires("strawberryperl/5.30.0.1") + if self.info.settings.os == "Windows": + self.tool_requires("strawberryperl/5.32.1.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package_id(self): del self.info.settings.compiler - def _build_vs(self): - with tools.chdir(self._source_subfolder): - with tools.vcvars(self): - autotools = AutoToolsBuildEnvironment(self) - autotools.flags.append("-nologo") - self.run("nmake /f {} {}".format(os.path.join("Mkfiles", "msvc.mak"), " ".join("{}=\"{}\"".format(k, v) for k, v in autotools.vars.items()))) - shutil.copy("nasm.exe", "nasmw.exe") - shutil.copy("ndisasm.exe", "ndisasmw.exe") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=(self._settings_build.os == "Windows")) + def generate(self): + tc = AutotoolsToolchain(self) + if is_msvc(self): + VCVars(self).generate() + tc.configure_args.append("-nologo") if self.settings.arch == "x86": - self._autotools.flags.append("-m32") + tc.extra_cflags.append("-m32") elif self.settings.arch == "x86_64": - self._autotools.flags.append("-m64") - self._autotools.configure(configure_dir=self._source_subfolder) + tc.extra_cflags.append("-m64") + tc.generate() - # GCC9 - "pure" attribute on function returning "void" - tools.replace_in_file("Makefile", "-Werror=attributes", "") + env = VirtualBuildEnv(self) + env.generate() - # Need "-arch" flag for the linker when cross-compiling. - # FIXME: Revisit after https://github.com/conan-io/conan/issues/9069, using new Autotools integration - if str(self.version).startswith("2.13"): - tools.replace_in_file("Makefile", "$(CC) $(LDFLAGS) -o", "$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o") - - return self._autotools def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self.settings.compiler == "Visual Studio": - self._build_vs() + apply_conandata_patches(self) + + if is_msvc(self): + with chdir(self, self.source_folder): + self.run("nmake /f {}".format(os.path.join("Mkfiles", "msvc.mak"))) else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() + + # GCC9 - "pure" attribute on function returning "void" + replace_in_file(self, "Makefile", "-Werror=attributes", "") + + # Need "-arch" flag for the linker when cross-compiling. + # FIXME: Revisit after https://github.com/conan-io/conan/issues/9069, using new Autotools integration + # TODO it is time to revisit, not sure what to do here though... + if str(self.version).startswith("2.13"): + replace_in_file(self, "Makefile", "$(CC) $(LDFLAGS) -o", "$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o") + replace_in_file(self, "Makefile", "$(INSTALLROOT)", "$(DESTDIR)") autotools.make() + def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - if self.settings.compiler == "Visual Studio": - self.copy(pattern="*.exe", src=self._source_subfolder, dst="bin", keep_path=False) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if is_msvc(self): + copy(self, pattern="*.exe", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + with chdir(self, os.path.join(self.package_folder, "bin")): + shutil.copy2("nasm.exe", "nasmw.exe") + shutil.copy2("ndisasm.exe", "ndisasmw.exe") else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] diff --git a/recipes/nasm/all/test_package/conanfile.py b/recipes/nasm/all/test_package/conanfile.py index 116e500b7291de..95d517d9ebe3be 100644 --- a/recipes/nasm/all/test_package/conanfile.py +++ b/recipes/nasm/all/test_package/conanfile.py @@ -1,18 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run import os -from conans import ConanFile, tools class TestPackageConan(ConanFile): - settings = "os", "arch", + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - self.run("nasm --version", run_environment=True) + if can_run(self): + self.run("nasm --version", env="conanbuild") asm_file = os.path.join(self.source_folder, "hello_linux.asm") out_file = os.path.join(self.build_folder, "hello_linux.o") bin_file = os.path.join(self.build_folder, "hello_linux") - self.run("nasm -felf64 {} -o {}".format(asm_file, out_file), run_environment=True) + self.run(f"nasm -felf64 {asm_file} -o {out_file}", env="conanbuild") if self.settings.os == "Linux" and self.settings.arch == "x86_64": - ld = tools.get_env("LD", "ld") - self.run("{} hello_linux.o -o {}".format(ld, bin_file), run_environment=True) + # TODO was tools.get_env, what should it be? + ld = os.getenv("LD", "ld") + self.run(f"{ld} hello_linux.o -o {bin_file}", env="conanbuild") self.run(bin_file) diff --git a/recipes/nasm/all/test_v1_package/conanfile.py b/recipes/nasm/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..e044b0e4f83c5b --- /dev/null +++ b/recipes/nasm/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os +from conans import ConanFile, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + self.run("nasm --version", run_environment=True) + asm_file = os.path.join(self.source_folder, "hello_linux.asm") + out_file = os.path.join(self.build_folder, "hello_linux.o") + bin_file = os.path.join(self.build_folder, "hello_linux") + self.run(f"nasm -felf64 {asm_file} -o {out_file}", run_environment=True) + if self.settings.os == "Linux" and self.settings.arch == "x86_64": + ld = tools.get_env("LD", "ld") + self.run(f"{ld} hello_linux.o -o {bin_file}", run_environment=True) + self.run(bin_file) diff --git a/recipes/nasm/all/test_v1_package/hello_linux.asm b/recipes/nasm/all/test_v1_package/hello_linux.asm new file mode 100644 index 00000000000000..c219477df732ca --- /dev/null +++ b/recipes/nasm/all/test_v1_package/hello_linux.asm @@ -0,0 +1,16 @@ +; Print "Hello, Conan" + + global _start + + section .text +_start: mov rax, 1 ; system call for write + mov rdi, 1 ; file handle 1 is stdout + mov rsi, message ; address of string to output + mov rdx, 13 ; number of bytes + syscall ; invoke operating system to do the write + mov rax, 60 ; system call for exit + xor rdi, rdi ; exit code 0 + syscall ; invoke operating system to exit + + section .data +message: db "Hello, Conan", 10 ; note the newline at the end \ No newline at end of file From b357d34d75b2337235d779ed1c62b734767d3d03 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 27 Oct 2022 06:34:08 +0200 Subject: [PATCH 198/300] (#13767) spectra: conan v2 support --- recipes/spectra/all/conanfile.py | 38 +++++++++++-------- .../spectra/all/test_package/CMakeLists.txt | 11 ++---- recipes/spectra/all/test_package/conanfile.py | 19 +++++++--- .../all/test_v1_package/CMakeLists.txt | 8 ++++ .../spectra/all/test_v1_package/conanfile.py | 17 +++++++++ 5 files changed, 66 insertions(+), 27 deletions(-) create mode 100644 recipes/spectra/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/spectra/all/test_v1_package/conanfile.py diff --git a/recipes/spectra/all/conanfile.py b/recipes/spectra/all/conanfile.py index e12330a0bf9d04..084f85d8c49505 100644 --- a/recipes/spectra/all/conanfile.py +++ b/recipes/spectra/all/conanfile.py @@ -1,45 +1,53 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" class SpectraConan(ConanFile): name = "spectra" description = "A header-only C++ library for large scale eigenvalue problems." license = "MPL-2.0" - topics = ("spectra", "eigenvalue", "header-only") + topics = ("eigenvalue", "header-only") homepage = "https://spectralib.org" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("eigen/3.4.0") + def package_id(self): + self.info.clear() + def validate(self): - if tools.Version(self.version) >= "1.0.0": + if Version(self.version) >= "1.0.0": if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "spectra") self.cpp_info.set_property("cmake_target_name", "Spectra::Spectra") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/spectra/all/test_package/CMakeLists.txt b/recipes/spectra/all/test_package/CMakeLists.txt index 9bd0484914641c..c68917e8a8c648 100644 --- a/recipes/spectra/all/test_package/CMakeLists.txt +++ b/recipes/spectra/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(spectra REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Spectra::Spectra) +target_link_libraries(${PROJECT_NAME} PRIVATE Spectra::Spectra) if(spectra_VERSION VERSION_LESS "1.0.0") target_compile_definitions(${PROJECT_NAME} PRIVATE "SPECTRA_LESS_1_0_0") else() - set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) endif() diff --git a/recipes/spectra/all/test_package/conanfile.py b/recipes/spectra/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/spectra/all/test_package/conanfile.py +++ b/recipes/spectra/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/spectra/all/test_v1_package/CMakeLists.txt b/recipes/spectra/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/spectra/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/spectra/all/test_v1_package/conanfile.py b/recipes/spectra/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/spectra/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From ce63b0edc7ba49f16da88f13a245f4e9b9c113e1 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Thu, 27 Oct 2022 08:31:34 +0200 Subject: [PATCH 199/300] (#13779) Fix conandata_yaml_linter * Fix conandata_yaml_linter * Update conandata_yaml_linter.py --- linter/conandata_yaml_linter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linter/conandata_yaml_linter.py b/linter/conandata_yaml_linter.py index 0ac34bdb2e90e7..e965e88b26d6e4 100644 --- a/linter/conandata_yaml_linter.py +++ b/linter/conandata_yaml_linter.py @@ -62,18 +62,18 @@ def main(): ): print( f"::warning file={args.path},line={type.start_line},endline={type.end_line}," - f"title='patch_type' should have 'patch_source'" - "::As per https://github.com/conan-io/conan-center-index/blob/master/docs/conandata_yml_format.md#patches-fields" + f"title=conandata.yml schema warning" + "::'patch_type' should have 'patch_source' as per https://github.com/conan-io/conan-center-index/blob/master/docs/conandata_yml_format.md#patches-fields" " it is expected to have a source (e.g. a URL) to where it originates from to help with reviewing and consumers to evaluate patches\n" ) except YAMLValidationError as error: e = error.__str__().replace("\n", "%0A") print( f"::error file={args.path},line={error.context_mark.line},endline={error.problem_mark.line}," - f"title=config.yml schema error" + f"title=conandata.yml schema error" f"::{e}\n" ) - except error: + except BaseException as error: e = error.__str__().replace("\n", "%0A") print(f"::error ::{e}") From b7ebc4b6ee60746657de722970ae7f9756d4920e Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Thu, 27 Oct 2022 22:28:29 +0800 Subject: [PATCH 200/300] (#13452) [theora] - upgrade to conan 2 and support RelWithDebInfo * Attempting to upgrade for conan v2. Problems with MSVC * theora - switch to cmake-style recipe, still a few things to do * theora - Add CMakeLists.txt, support x86/64 asm optimisations option Note that asm optimisations haven't been tested at the time of this commit, because I'm building with MSVC on 64, and inline assembly isn't supported for that platform by the compiler. * theora - Duplicated test_package to test_v1_package * theora - dont use rm_safe() yet * theora - fixup ogg --> Ogg dependency * theora - Ogg -> ogg for requires * theora - fixup files in each lib * theora - more tweaks to align with template example. * theora - ensure dll is generated as libtheora.dll * theora - disable enc/dec libraries, just build the main one * theora - more fixes from review * theora - minor fix to export_sources * theora - narrow exception to catch * Update recipes/theora/all/conanfile.py Co-authored-by: Jordan Williams * Update recipes/theora/all/CMakeLists.txt Co-authored-by: Chris Mc * Update recipes/theora/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/theora/all/test_v1_package/conanfile.py Co-authored-by: Chris Mc * theora - build enc+dec, fixup test_v1_package * theora - fix up test_v1_package * theora - download def file, same as original recipe * Update recipes/theora/all/conandata.yml Co-authored-by: Jordan Williams * Sorry, https link failing (old TLS version), have to use http * Apply suggestions from code review Co-authored-by: Chris Mc * Apply suggestions from code review Co-authored-by: Chris Mc * Drop unneeded test_v1_package build_requirement * Removed need for theora.def file Co-authored-by: Jordan Williams Co-authored-by: Chris Mc --- recipes/theora/all/CMakeLists.txt | 122 +++++++++++ recipes/theora/all/conandata.yml | 6 +- recipes/theora/all/conanfile.py | 198 +++++------------- .../theora/all/test_package/CMakeLists.txt | 13 +- recipes/theora/all/test_package/conanfile.py | 28 +-- .../theora/all/test_v1_package/CMakeLists.txt | 10 + .../theora/all/test_v1_package/conanfile.py | 17 ++ 7 files changed, 223 insertions(+), 171 deletions(-) create mode 100644 recipes/theora/all/CMakeLists.txt create mode 100644 recipes/theora/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/theora/all/test_v1_package/conanfile.py diff --git a/recipes/theora/all/CMakeLists.txt b/recipes/theora/all/CMakeLists.txt new file mode 100644 index 00000000000000..d51dd8c636707e --- /dev/null +++ b/recipes/theora/all/CMakeLists.txt @@ -0,0 +1,122 @@ +cmake_minimum_required(VERSION 3.15) +project(theora C) + +# Note that I wrote this cmake file because: +# - the old msvc sln was very old and required upgrades each time it was built +# - the old msvc did not support RelWithDebInfo +# - the recipe needed to be upgraded for conan-v2, so a simpler recipe was desired + +find_package(Ogg CONFIG REQUIRED) + +set (HEADERS + "include/theora/codec.h" + "include/theora/theora.h" + "include/theora/theoradec.h" + "include/theora/theoraenc.h" +) + +set(LIBTHEORA_COMMON + "lib/apiwrapper.c" + "lib/bitpack.c" # was not in enc in SConstruct + "lib/dequant.c" + "lib/fragment.c" + "lib/idct.c" + "lib/info.c" # was not in enc in SConstruct + "lib/internal.c" + "lib/state.c" + "lib/quant.c" + ) + +set(LIBTHEORA_ENC + "lib/analyze.c" + "lib/encapiwrapper.c" + "lib/encfrag.c" + "lib/encinfo.c" + "lib/encode.c" + "lib/enquant.c" + "lib/fdct.c" + "lib/huffenc.c" + "lib/mathops.c" + "lib/mcenc.c" + "lib/rate.c" + "lib/tokenize.c" + ) + + +set(LIBTHEORA_DEC + "lib/decapiwrapper.c" + "lib/decinfo.c" + "lib/decode.c" + "lib/huffdec.c" + ) + + +option(USE_X86_32 "Use x86-32 optimization" OFF) +option(USE_X86_64 "Use x86-64 optimization" OFF) +if (USE_X86_32) + message("Enabling x86-32 assembly optimizations") + add_definitions(-DOC_X86_ASM) + + list (APPEND LIBTHEORA_COMMON + "lib/x86/mmxidct.c" + "lib/x86/mmxfrag.c" + "lib/x86/mmxstate.c" + "lib/x86/x86state.c" + ) + + list (APPEND LIBTHEORA_ENC + "lib/x86/mmxencfrag.c" + "lib/x86/mmxfdct.c" + "lib/x86/x86enc.c" + "lib/x86/mmxfrag.c" + "lib/x86/mmxidct.c" + "lib/x86/mmxstate.c" + "lib/x86/x86state.c" + ) +elseif (USE_X86_64) + message("Enabling x86-64 assembly optimizations") + add_definitions(-DOC_X86_ASM) + add_definitions(-DOC_X86_64_ASM) + + list (APPEND LIBTHEORA_COMMON + "lib/x86/mmxidct.c" + "lib/x86/mmxfrag.c" + "lib/x86/mmxstate.c" + "lib/x86/x86state.c" + ) + + list (APPEND LIBTHEORA_ENC + "lib/x86/mmxencfrag.c" + "lib/x86/mmxfdct.c" + "lib/x86/x86enc.c" + "lib/x86/sse2fdct.c" + ) +else() + message("Not enabling any assembly optimizations (x86 and x86_64 asm optimizations are available)") +endif() + + +if (MSVC AND BUILD_SHARED_LIBS) + set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif () + +add_library(theora ${LIBTHEORA_COMMON} ${LIBTHEORA_ENC} ${LIBTHEORA_DEC}) +add_library(theoraenc ${LIBTHEORA_COMMON} ${LIBTHEORA_ENC}) +add_library(theoradec ${LIBTHEORA_COMMON} ${LIBTHEORA_DEC}) + +if (BUILD_SHARED_LIBS) + target_compile_definitions(theora PRIVATE LIBTHEORA_EXPORTS) + target_compile_definitions(theoraenc PRIVATE LIBTHEORA_EXPORTS) + target_compile_definitions(theoradec PRIVATE LIBTHEORA_EXPORTS) +endif() + +target_link_libraries(theora PUBLIC Ogg::ogg) +target_link_libraries(theoraenc PUBLIC Ogg::ogg) +target_link_libraries(theoradec PUBLIC Ogg::ogg) + +target_include_directories(theora PUBLIC include) +target_include_directories(theoraenc PUBLIC include) +target_include_directories(theoradec PUBLIC include) + +install(FILES ${HEADERS} DESTINATION include/theora) +install(TARGETS theora theoraenc theoradec) diff --git a/recipes/theora/all/conandata.yml b/recipes/theora/all/conandata.yml index 74e7aaff46cc5a..b2963c4be74a95 100644 --- a/recipes/theora/all/conandata.yml +++ b/recipes/theora/all/conandata.yml @@ -1,6 +1,4 @@ sources: "1.1.1": - - url: "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.zip" - sha256: "f644fef154f7a80e7258c8baec5c510f594d720835855cddce322b924934ba36" - - url: "https://raw.githubusercontent.com/xiph/theora/v1.1.1/lib/theora.def" - sha256: "56362ca0cc73172c06b53866ba52fad941d02fc72084d292c705a1134913e806" + url: "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.zip" + sha256: "f644fef154f7a80e7258c8baec5c510f594d720835855cddce322b924934ba36" diff --git a/recipes/theora/all/conanfile.py b/recipes/theora/all/conanfile.py index 0734e7d3d36708..ca4711add6a906 100644 --- a/recipes/theora/all/conanfile.py +++ b/recipes/theora/all/conanfile.py @@ -1,47 +1,26 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, MSBuild, AutoToolsBuildEnvironment, tools -import functools +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.files import copy, download, get, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.errors import ConanException import os -import re -import shutil -import stat - -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.52.0" class TheoraConan(ConanFile): name = "theora" - description = "Theora is a free and open video compression format from the Xiph.org Foundation" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xiph/theora" - topics = ("theora", "video", "video-compressor", "video-format") - license = "BSD-3-Clause" - - settings = "os", "arch", "compiler", "build_type" - options = { - "shared": [True, False], - "fPIC": [True, False], - } - default_options = { - "shared": False, - "fPIC": True, - } - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + description = "Theora is a free and open video compression format from the Xiph.org Foundation" + topics = "video", "video-compressor", "video-format" - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder,"src")) def config_options(self): if self.settings.os == "Windows": @@ -49,134 +28,63 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except ConanException: + pass + try: + del self.settings.compiler.libcxx + except ConanException: + pass + try: + del self.settings.compiler.cppstd + except ConanException: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("ogg/1.3.5") - def build_requirements(self): - if not self._is_msvc: - self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - def source(self): - tools.get(**self.conan_data["sources"][self.version][0], strip_root=True, destination=self._source_subfolder) - - source = self.conan_data["sources"][self.version][1] - url = source["url"] - filename = url[url.rfind("/") + 1:] - tools.download(url, filename) - tools.check_sha256(filename, source["sha256"]) - - shutil.move(filename, os.path.join(self._source_subfolder, "lib", filename)) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _build_msvc(self): - def format_libs(libs): - return " ".join([l + ".lib" for l in libs]) - - project = "libtheora" - config = "dynamic" if self.options.shared else "static" - sln_dir = os.path.join(self._source_subfolder, "win32", "VS2008") - vcproj_path = os.path.join(sln_dir, project, "{}_{}.vcproj".format(project, config)) - - # fix hard-coded ogg names - if self.options.shared: - tools.replace_in_file(vcproj_path, - "libogg.lib", - format_libs(self.deps_cpp_info["ogg"].libs)) - - # Honor vc runtime from profile - if "MT" in msvc_runtime_flag(self): - tools.replace_in_file(vcproj_path, 'RuntimeLibrary="2"', 'RuntimeLibrary="0"') - tools.replace_in_file(vcproj_path, 'RuntimeLibrary="3"', 'RuntimeLibrary="1"') - - sln = "{}_{}.sln".format(project, config) - targets = ["libtheora" if self.options.shared else "libtheora_static"] - properties = { - # Enable LTO when CFLAGS contains -GL - "WholeProgramOptimization": "true" if any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))) else "false", - } - - with tools.chdir(sln_dir): - msbuild = MSBuild(self) - msbuild.build(sln, targets=targets, platforms={"x86": "Win32", "x86_64": "x64"}, properties=properties) - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--disable-examples", - ] - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_X86_32"] = (self.settings.arch == "x86") + # note: MSVC does not support inline assembly for 64 bit builds + tc.variables["USE_X86_64"] = (self.settings.arch == "x86_64" and not is_msvc(self)) + tc.generate() + cd = CMakeDeps(self) + cd.generate() def build(self): - if self._is_msvc: - self._build_msvc() - else: - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - configure = os.path.join(self._source_subfolder, "configure") - permission = stat.S_IMODE(os.lstat(configure).st_mode) - os.chmod(configure, (permission | stat.S_IEXEC)) - # relocatable shared libs on macOS - tools.replace_in_file(configure, "-install_name \\$rpath/", "-install_name @rpath/") - # avoid SIP issues on macOS when dependencies are shared - if tools.is_apple_os(self.settings.os): - libpaths = ":".join(self.deps_cpp_info.lib_paths) - tools.replace_in_file( - configure, - "#! /bin/sh\n", - "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), - ) - autotools = self._configure_autotools() - autotools.make() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="*.h", dst="include", src=include_folder) - self.copy(pattern="*.dll", dst="bin", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) - else: - autotools = self._configure_autotools() - autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() def package_info(self): - self.cpp_info.set_property("pkg_config_name", "theora_full_package") # to avoid conflicts with _theora component + self.cpp_info.set_property("pkg_config_name", "theora_full_package_do_not_use") # to avoid conflicts with theora component - self.cpp_info.components["_theora"].set_property("pkg_config_name", "theora") - prefix = "lib" if self._is_msvc else "" - suffix = "_static" if self._is_msvc and not self.options.shared else "" - self.cpp_info.components["_theora"].libs = [f"{prefix}theora{suffix}"] - self.cpp_info.components["_theora"].requires = ["ogg::ogg"] + self.cpp_info.components["theora"].set_property("pkg_config_name", "theora") + self.cpp_info.components["theora"].libs = ["theora"] + self.cpp_info.components["theora"].requires = ["ogg::ogg"] self.cpp_info.components["theoradec"].set_property("pkg_config_name", "theoradec") + self.cpp_info.components["theoradec"].libs = ["theoradec"] self.cpp_info.components["theoradec"].requires = ["ogg::ogg"] - if self._is_msvc: - self.cpp_info.components["theoradec"].requires.append("_theora") - else: - self.cpp_info.components["theoradec"].libs = ["theoradec"] self.cpp_info.components["theoraenc"].set_property("pkg_config_name", "theoraenc") - self.cpp_info.components["theoraenc"].requires = ["theoradec", "ogg::ogg"] - if self._is_msvc: - self.cpp_info.components["theoradec"].requires.append("_theora") - else: - self.cpp_info.components["theoraenc"].libs = ["theoraenc"] + self.cpp_info.components["theoraenc"].libs = ["theoraenc"] + self.cpp_info.components["theoraenc"].requires = ["ogg::ogg"] + # TODO: to remove in conan v2 once pkg_config generator removed self.cpp_info.names["pkg_config"] = "theora_full_package" diff --git a/recipes/theora/all/test_package/CMakeLists.txt b/recipes/theora/all/test_package/CMakeLists.txt index 019f47403d1ff4..73fb77db6077cf 100644 --- a/recipes/theora/all/test_package/CMakeLists.txt +++ b/recipes/theora/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.15) +project(PackageTest C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(theora CONFIG REQUIRED) -find_package(theora REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} theora::theora) +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE theora::theora) diff --git a/recipes/theora/all/test_package/conanfile.py b/recipes/theora/all/test_package/conanfile.py index ab912e4e61df1a..f5759f27e0ef59 100644 --- a/recipes/theora/all/test_package/conanfile.py +++ b/recipes/theora/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -class TestPackageConan(ConanFile): +class TheoraTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/theora/all/test_v1_package/CMakeLists.txt b/recipes/theora/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..2e5ac93f43d5b7 --- /dev/null +++ b/recipes/theora/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(theora CONFIG REQUIRED) + +add_executable(test_package ../test_package/test_package.c) +target_link_libraries(test_package PRIVATE theora::theora) diff --git a/recipes/theora/all/test_v1_package/conanfile.py b/recipes/theora/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..49a3a66ea5bad4 --- /dev/null +++ b/recipes/theora/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 50b09bab8413a6287de2fe6eae524a5699681c5e Mon Sep 17 00:00:00 2001 From: "Kevin A. Mitchell" Date: Thu, 27 Oct 2022 10:05:46 -0500 Subject: [PATCH 201/300] (#13586) innoextract: requirements version bump * innoextract: Bump requirement versions * innoextract: There are no include directories - Silence hook error. * Support Conan 2.0 Signed-off-by: Uilian Ries Signed-off-by: Uilian Ries Co-authored-by: Uilian Ries --- recipes/innoextract/all/CMakeLists.txt | 7 -- recipes/innoextract/all/conandata.yml | 2 - recipes/innoextract/all/conanfile.py | 87 ++++++++++--------- .../all/patches/0001-cmake-fix-module.patch | 6 +- .../innoextract/all/test_package/conanfile.py | 23 ++--- .../all/test_v1_package/conanfile.py | 19 ++++ 6 files changed, 75 insertions(+), 69 deletions(-) delete mode 100644 recipes/innoextract/all/CMakeLists.txt create mode 100644 recipes/innoextract/all/test_v1_package/conanfile.py diff --git a/recipes/innoextract/all/CMakeLists.txt b/recipes/innoextract/all/CMakeLists.txt deleted file mode 100644 index 70869870556c65..00000000000000 --- a/recipes/innoextract/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATH) - -add_subdirectory("source_subfolder") diff --git a/recipes/innoextract/all/conandata.yml b/recipes/innoextract/all/conandata.yml index 93262a96d6979e..a280c970476d11 100644 --- a/recipes/innoextract/all/conandata.yml +++ b/recipes/innoextract/all/conandata.yml @@ -7,6 +7,4 @@ sources: patches: "1.9.0": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-remove-custom-cmake-find-modules.patch" - base_path: "source_subfolder" diff --git a/recipes/innoextract/all/conanfile.py b/recipes/innoextract/all/conanfile.py index 2d0098f3d9b939..c21ccf578684a2 100644 --- a/recipes/innoextract/all/conanfile.py +++ b/recipes/innoextract/all/conanfile.py @@ -1,70 +1,71 @@ +from conan import ConanFile +from conan.tools.files import get, rmdir, copy, apply_conandata_patches, export_conandata_patches +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualBuildEnv import os -import functools -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.52.0" class InnoextractConan(ConanFile): name = "innoextract" description = "Extract contents of Inno Setup installers" - license = "innoextract License" + license = "LicenseRef-LICENSE" topics = ("inno-setup", "decompression") - homepage = "https://constexpr.org/innoextract/" + homepage = "https://constexpr.org/innoextract" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*"] - requires = ( - "boost/1.78.0", - "xz_utils/5.2.5", - "libiconv/1.16" - ) - generators = "cmake", "cmake_find_package" settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + def requirements(self): + self.requires("boost/1.80.0") + self.requires("xz_utils/5.2.5") + self.requires("libiconv/1.17") - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - os.remove(os.path.join(self._source_subfolder, 'cmake', 'FindLZMA.cmake')) - os.remove(os.path.join(self._source_subfolder, 'cmake', 'Findiconv.cmake')) - cmake = self._configure_cmake() - cmake.build() + def package_id(self): + del self.info.settings.compiler + self.info.requires.clear() - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=self.source_folder) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) # Turn off static library detection, which is on by default on Windows. # This keeps the CMakeLists.txt from trying to detect static Boost # libraries and use Boost components for zlib and BZip2. Getting the # libraries via Conan does the correct thing without other assistance. - cmake.definitions["USE_STATIC_LIBS"] = False - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["USE_STATIC_LIBS"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + os.remove(os.path.join(self.source_folder, 'cmake', 'FindLZMA.cmake')) + os.remove(os.path.join(self.source_folder, 'cmake', 'Findiconv.cmake')) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - - def package_id(self): - del self.info.settings.compiler - self.info.requires.clear() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}" - .format(bindir)) + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) diff --git a/recipes/innoextract/all/patches/0001-cmake-fix-module.patch b/recipes/innoextract/all/patches/0001-cmake-fix-module.patch index 6c34cbad3eda26..2997e1cb0a3a57 100644 --- a/recipes/innoextract/all/patches/0001-cmake-fix-module.patch +++ b/recipes/innoextract/all/patches/0001-cmake-fix-module.patch @@ -3,11 +3,11 @@ index dbb64f1..a8a67e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,7 @@ endif() - + include(CheckSymbolExists) - + -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # For custom cmake modules -+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # For custom cmake modules ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # For custom cmake modules include(BuildType) include(CompileCheck) include(CreateSourceGroups) diff --git a/recipes/innoextract/all/test_package/conanfile.py b/recipes/innoextract/all/test_package/conanfile.py index dc77b21f20519e..6a4e652eac5434 100644 --- a/recipes/innoextract/all/test_package/conanfile.py +++ b/recipes/innoextract/all/test_package/conanfile.py @@ -1,19 +1,14 @@ -from six import StringIO -from conans import ConanFile, tools - +from conan import ConanFile +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "arch", "build_type", "compiler" + generators = "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - output = StringIO() - self.run("innoextract --version", output=output, - run_environment=True) - output_str = str(output.getvalue()) - self.output.info("Installed version: {}".format(output_str)) - require_version = str(self.deps_cpp_info["innoextract"].version) - require_version = ".".join(require_version.split(".")[:2]) - self.output.info("Expected version: {}".format(require_version)) - assert_innoextract_version = "innoextract %s" % require_version - assert(assert_innoextract_version in output_str) + if can_run(self): + self.run("innoextract --version", env="conanrun") diff --git a/recipes/innoextract/all/test_v1_package/conanfile.py b/recipes/innoextract/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..dc77b21f20519e --- /dev/null +++ b/recipes/innoextract/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from six import StringIO +from conans import ConanFile, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "build_type", "compiler" + + def test(self): + if not tools.cross_building(self): + output = StringIO() + self.run("innoextract --version", output=output, + run_environment=True) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + require_version = str(self.deps_cpp_info["innoextract"].version) + require_version = ".".join(require_version.split(".")[:2]) + self.output.info("Expected version: {}".format(require_version)) + assert_innoextract_version = "innoextract %s" % require_version + assert(assert_innoextract_version in output_str) From 37982866f1ba0f1be2688621a16385c65d6a20e0 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 27 Oct 2022 17:25:46 +0200 Subject: [PATCH 202/300] (#13696) angelscript: add 2.36.0 + conan v2 support * conan v2 support * fix build on Apple arm64 * add angelscript/2.36.0 * add missing stdint.h include * change patch_type Co-authored-by: Chris Mc * change patch_type Co-authored-by: Chris Mc * add sha256 of patche files Co-authored-by: Chris Mc --- recipes/angelscript/all/CMakeLists.txt | 12 ---- recipes/angelscript/all/conandata.yml | 27 ++++++- recipes/angelscript/all/conanfile.py | 71 ++++++++++--------- ...0-0001-fix-compatibility-apple-clang.patch | 30 ++++++++ ...1-0001-fix-compatibility-apple-clang.patch | 18 +++++ .../2.36.0-0001-missing-include-stdint.patch | 10 +++ .../all/test_package/CMakeLists.txt | 5 +- .../angelscript/all/test_package/conanfile.py | 21 ++++-- .../all/test_v1_package/CMakeLists.txt | 8 +++ .../all/test_v1_package/conanfile.py | 17 +++++ recipes/angelscript/config.yml | 4 +- 11 files changed, 162 insertions(+), 61 deletions(-) delete mode 100644 recipes/angelscript/all/CMakeLists.txt create mode 100644 recipes/angelscript/all/patches/2.35.0-0001-fix-compatibility-apple-clang.patch create mode 100644 recipes/angelscript/all/patches/2.35.1-0001-fix-compatibility-apple-clang.patch create mode 100644 recipes/angelscript/all/patches/2.36.0-0001-missing-include-stdint.patch create mode 100644 recipes/angelscript/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/angelscript/all/test_v1_package/conanfile.py diff --git a/recipes/angelscript/all/CMakeLists.txt b/recipes/angelscript/all/CMakeLists.txt deleted file mode 100644 index d93e1400caafb8..00000000000000 --- a/recipes/angelscript/all/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(NOT "${CMAKE_CXX_STANDARD}") - set(CMAKE_CXX_STANDARD 11) -endif() -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_subdirectory(source_subfolder/angelscript/projects/cmake) diff --git a/recipes/angelscript/all/conandata.yml b/recipes/angelscript/all/conandata.yml index cfde1084109f4e..1dec7ac1d3e717 100644 --- a/recipes/angelscript/all/conandata.yml +++ b/recipes/angelscript/all/conandata.yml @@ -1,7 +1,28 @@ sources: + "2.36.0": + url: "https://www.angelcode.com/angelscript/sdk/files/angelscript_2.36.0.zip" + sha256: "33f95f7597bc0d88b097d35e7b1320d15419ffc5779851d9d2a6cccec57811b3" + "2.35.1": + url: "https://www.angelcode.com/angelscript/sdk/files/angelscript_2.35.1.zip" + sha256: "5c1096b6d6cf50c7e77ae93c736d35b69b07b1e5047161c7816bca25b413a18b" "2.35.0": - url: "http://www.angelcode.com/angelscript/sdk/files/angelscript_2.35.0.zip" + url: "https://www.angelcode.com/angelscript/sdk/files/angelscript_2.35.0.zip" sha256: "010dd45e23e734d46f5891d70e268607a12cb9ab12503dda42f842d9db7e8857" +patches: + "2.36.0": + - patch_file: "patches/2.36.0-0001-missing-include-stdint.patch" + patch_description: "Add missing stdint.h include" + patch_type: "portability" + sha256: "16d08c43a871a2ab4695e63829e9c07f9fab4237515185c1921e55c0b76483d3" "2.35.1": - url: "http://www.angelcode.com/angelscript/sdk/files/angelscript_2.35.1.zip" - sha256: "5c1096b6d6cf50c7e77ae93c736d35b69b07b1e5047161c7816bca25b413a18b" + - patch_file: "patches/2.35.1-0001-fix-compatibility-apple-clang.patch" + patch_description: "Fix apple-clang compatibility of ASM arm" + patch_type: "portability" + patch_source: "https://github.com/codecat/angelscript-mirror/commit/7ec10a763d9c078b57c413b552a2d05c2638878f" + sha256: "6cd39d941cc9e674f5ec2f94d2dc0d2eec04dfb348bbc8956eb2c6e6f5b2b895" + "2.35.0": + - patch_file: "patches/2.35.0-0001-fix-compatibility-apple-clang.patch" + patch_description: "Fix apple-clang compatibility of ASM arm" + patch_type: "portability" + patch_source: "https://github.com/codecat/angelscript-mirror/commit/7ec10a763d9c078b57c413b552a2d05c2638878f" + sha256: "03446786a60dbf53e0e69385ae918dbc4004bcf1a64c14960d11b856f3b0c64a" diff --git a/recipes/angelscript/all/conanfile.py b/recipes/angelscript/all/conanfile.py index 8c4d9752423d63..174e1d97323547 100644 --- a/recipes/angelscript/all/conanfile.py +++ b/recipes/angelscript/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.build import valid_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, get, export_conandata_patches, load, rmdir, save +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class AngelScriptConan(ConanFile): @@ -28,21 +32,9 @@ class AngelScriptConan(ConanFile): } short_paths = True - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,46 +42,55 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): # Website blocks default user agent string. - tools.get( + get( + self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, + destination=self.source_folder, headers={"User-Agent": "ConanCenter"}, strip_root=True, ) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["AS_NO_EXCEPTIONS"] = self.options.no_exceptions - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["AS_NO_EXCEPTIONS"] = self.options.no_exceptions + if not valid_min_cppstd(self, 11): + tc.variables["CMAKE_CXX_STANDARD"] = 11 + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "angelscript", "projects", "cmake")) cmake.build() def _extract_license(self): - header = tools.load(os.path.join(self._source_subfolder, "angelscript", "include", "angelscript.h")) - tools.save("LICENSE", header[header.find("/*", 1) + 3 : header.find("*/", 1)]) + header = load(self, os.path.join(self.source_folder, "angelscript", "include", "angelscript.h")) + return header[header.find("/*", 1) + 3 : header.find("*/", 1)] def package(self): - self._extract_license() - self.copy("LICENSE", dst="licenses") - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Angelscript") self.cpp_info.set_property("cmake_target_name", "Angelscript::angelscript") - postfix = "d" if self._is_msvc and self.settings.build_type == "Debug" else "" + postfix = "d" if is_msvc(self) and self.settings.build_type == "Debug" else "" # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["_angelscript"].libs = ["angelscript" + postfix] + self.cpp_info.components["_angelscript"].libs = [f"angelscript{postfix}"] if self.settings.os in ("Linux", "FreeBSD", "SunOS"): self.cpp_info.components["_angelscript"].system_libs.append("pthread") diff --git a/recipes/angelscript/all/patches/2.35.0-0001-fix-compatibility-apple-clang.patch b/recipes/angelscript/all/patches/2.35.0-0001-fix-compatibility-apple-clang.patch new file mode 100644 index 00000000000000..acf1d8b621bbf7 --- /dev/null +++ b/recipes/angelscript/all/patches/2.35.0-0001-fix-compatibility-apple-clang.patch @@ -0,0 +1,30 @@ +--- a/angelscript/projects/cmake/CMakeLists.txt ++++ b/angelscript/projects/cmake/CMakeLists.txt +@@ -110,7 +110,9 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm") + enable_language(ASM) + if(CMAKE_ASM_COMPILER_WORKS) + set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_arm.cpp ../../source/as_callfunc_arm_gcc.S) ++ if (NOT APPLE) + set_property(SOURCE ../../source/as_callfunc_arm_gcc.S APPEND PROPERTY COMPILE_FLAGS " -Wa,-mimplicit-it=always") ++ endif() + else() + message(FATAL ERROR "ARM target requires a working assembler") + endif() +--- a/angelscript/source/as_callfunc_arm64_gcc.S ++++ b/angelscript/source/as_callfunc_arm64_gcc.S +@@ -46,6 +46,7 @@ + .global CallARM64Float + .global CallARM64 + ++#if !defined(__MACH__) + .type GetHFAReturnDouble, %function + .type GetHFAReturnFloat, %function + .type CallARM64Ret128, %function +@@ -53,6 +54,7 @@ + .type CallARM64Double, %function + .type CallARM64Float, %function + .type CallARM64, %function ++#endif + + .align 2 + GetHFAReturnDouble: diff --git a/recipes/angelscript/all/patches/2.35.1-0001-fix-compatibility-apple-clang.patch b/recipes/angelscript/all/patches/2.35.1-0001-fix-compatibility-apple-clang.patch new file mode 100644 index 00000000000000..49ca65e890f7a9 --- /dev/null +++ b/recipes/angelscript/all/patches/2.35.1-0001-fix-compatibility-apple-clang.patch @@ -0,0 +1,18 @@ +--- a/angelscript/source/as_callfunc_arm64_gcc.S ++++ b/angelscript/source/as_callfunc_arm64_gcc.S +@@ -50,6 +50,7 @@ + .global CallARM64Float + .global CallARM64 + ++#if !defined(__MACH__) + .type GetHFAReturnDouble, %function + .type GetHFAReturnFloat, %function + .type CallARM64Ret128, %function +@@ -57,6 +58,7 @@ + .type CallARM64Double, %function + .type CallARM64Float, %function + .type CallARM64, %function ++#endif + + .align 2 + GetHFAReturnDouble: diff --git a/recipes/angelscript/all/patches/2.36.0-0001-missing-include-stdint.patch b/recipes/angelscript/all/patches/2.36.0-0001-missing-include-stdint.patch new file mode 100644 index 00000000000000..f2e883bacf543c --- /dev/null +++ b/recipes/angelscript/all/patches/2.36.0-0001-missing-include-stdint.patch @@ -0,0 +1,10 @@ +--- a/angelscript/source/as_context.cpp ++++ b/angelscript/source/as_context.cpp +@@ -36,6 +36,7 @@ + // + + #include // fmodf() pow() ++#include + + #include "as_config.h" + #include "as_context.h" diff --git a/recipes/angelscript/all/test_package/CMakeLists.txt b/recipes/angelscript/all/test_package/CMakeLists.txt index dfeca78c0bd3e7..ee85cb2f6cc3c3 100644 --- a/recipes/angelscript/all/test_package/CMakeLists.txt +++ b/recipes/angelscript/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Angelscript REQUIRED CONFIG) diff --git a/recipes/angelscript/all/test_package/conanfile.py b/recipes/angelscript/all/test_package/conanfile.py index a3b9c17e2ea298..0a6bc68712d901 100644 --- a/recipes/angelscript/all/test_package/conanfile.py +++ b/recipes/angelscript/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class AngelScriptTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/angelscript/all/test_v1_package/CMakeLists.txt b/recipes/angelscript/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/angelscript/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/angelscript/all/test_v1_package/conanfile.py b/recipes/angelscript/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..a3b9c17e2ea298 --- /dev/null +++ b/recipes/angelscript/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import CMake, ConanFile, tools +import os + + +class AngelScriptTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/angelscript/config.yml b/recipes/angelscript/config.yml index 75f0f388bd4d18..22190418b16a22 100644 --- a/recipes/angelscript/config.yml +++ b/recipes/angelscript/config.yml @@ -1,5 +1,7 @@ versions: - "2.35.0": + "2.36.0": folder: all "2.35.1": folder: all + "2.35.0": + folder: all From b2ca5ce122925d665bc10e41a17503fdc15bd76c Mon Sep 17 00:00:00 2001 From: Conan Center Index Bot <54393557+conan-center-bot@users.noreply.github.com> Date: Thu, 27 Oct 2022 17:56:12 +0200 Subject: [PATCH 203/300] (#13718) [bot] Add Access Request users (2022-10-24) --- .c3i/authorized_users.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index b82bcf03f12e7e..9bc560565c9434 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -960,3 +960,5 @@ authorized_users: - "mjimenofluendo" - "jiaoew1991" - "ramin-raeisi" + - "schoetbi" + - "psyinf" From 925e66cbf27fb3deccb14c31a682d2bcfeaa0a64 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 28 Oct 2022 01:28:09 +0900 Subject: [PATCH 204/300] (#13731) daw_json_link: support conan v2, update dependencies, remove older versions * daw_json_link: support conan v2, update dependencies, remove older versions * rename _minimum_cpp_standard Co-authored-by: Jordan Williams * rename _minimum_cpp_standard Co-authored-by: Jordan Williams * rename _minimum_cpp_standard Co-authored-by: Jordan Williams --- recipes/daw_json_link/all/conandata.yml | 9 -- recipes/daw_json_link/all/conanfile.py | 104 ++++++++++-------- .../all/test_package/CMakeLists.txt | 9 +- .../all/test_package/conanfile.py | 22 +++- .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 16 +++ recipes/daw_json_link/config.yml | 6 - 7 files changed, 106 insertions(+), 71 deletions(-) create mode 100644 recipes/daw_json_link/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/daw_json_link/all/test_v1_package/conanfile.py diff --git a/recipes/daw_json_link/all/conandata.yml b/recipes/daw_json_link/all/conandata.yml index 33e4220a0ef533..93243ede3fc684 100644 --- a/recipes/daw_json_link/all/conandata.yml +++ b/recipes/daw_json_link/all/conandata.yml @@ -20,15 +20,6 @@ sources: "2.15.3": url: "https://github.com/beached/daw_json_link/archive/v2.15.3.tar.gz" sha256: "ec0457a5682a76c5aec709f2d6959ef7bafa0b54c5e7740f911d97991188ee84" - "2.15.2": - url: "https://github.com/beached/daw_json_link/archive/v2.15.2.tar.gz" - sha256: "90a7b375b3c9ffd76541815b1b2107c3f6f7df3bae8d94fb7b64f4fcf8d60c0c" "2.14.0": url: "https://github.com/beached/daw_json_link/archive/v2.14.0.tar.gz" sha256: "811d0c5ab9ed9c79c84fc5837c8e7ef48f1f45177b7931bc849363c48a62261b" - "2.12.9": - url: "https://github.com/beached/daw_json_link/archive/v2.12.9.tar.gz" - sha256: "a55d1517ff785aed58ddf9e570cad5175231b5c356d7066c097bfca129d0b7c8" - "2.11.0": - url: "https://github.com/beached/daw_json_link/archive/v2.11.0.tar.gz" - sha256: "e0c616bb647c6fd1d91e614a3512779000689ba68ab9f88fa284e91b6066801e" diff --git a/recipes/daw_json_link/all/conanfile.py b/recipes/daw_json_link/all/conanfile.py index 78f23a579daae3..b69ebd0801b47f 100644 --- a/recipes/daw_json_link/all/conanfile.py +++ b/recipes/daw_json_link/all/conanfile.py @@ -1,8 +1,13 @@ -from conans.errors import ConanInvalidConfiguration -from conans import ConanFile, CMake, tools +from conan import ConanFile, conan_version +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class DawJsonLinkConan(ConanFile): name = "daw_json_link" @@ -12,70 +17,81 @@ class DawJsonLinkConan(ConanFile): homepage = "https://github.com/beached/daw_json_link" topics = ("json", "parse", "json-parser", "serialization", "constexpr", "header-only") settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" no_copy_source = True short_paths = True - _compiler_required_cpp17 = { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } + @property + def _minimum_cpp_standard(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - if tools.Version(self.version) < "2.11.0": - self.requires("daw_header_libraries/1.29.7") - elif tools.Version(self.version) < "2.12.0": - self.requires("daw_header_libraries/2.5.3") - else: - self.requires("daw_header_libraries/2.68.1") + self.requires("daw_header_libraries/2.72.0") self.requires("daw_utf_range/2.2.2") - def validate(self): - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") + def package_id(self): + self.info.clear() + + @property + def _info(self): + return self if Version(conan_version).major < 2 else self.info - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + def validate(self): + if self._info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self._info.settings.compiler), False) + if minimum_version and Version(self._info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DAW_USE_PACKAGE_MANAGEMENT"] = True + tc.generate() - def _configure_cmake(self): + deps = CMakeDeps(self) + deps.generate() + + def build(self): cmake = CMake(self) - cmake.definitions["DAW_USE_PACKAGE_MANAGEMENT"] = True - cmake.configure(source_folder=self._source_subfolder) - return cmake + cmake.configure() def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] - def package_id(self): - self.info.header_only() + self.cpp_info.set_property("cmake_file_name", "daw-json-link") + self.cpp_info.set_property("cmake_target_name", "daw::daw-json-link") + self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-json-link") + self.cpp_info.components["daw"].requires = ["daw_header_libraries::daw", "daw_utf_range::daw"] - def package_info(self): + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "daw-json-link" self.cpp_info.filenames["cmake_find_package_multi"] = "daw-json-link" - self.cpp_info.set_property("cmake_file_name", "daw-json-link") self.cpp_info.names["cmake_find_package"] = "daw" self.cpp_info.names["cmake_find_package_multi"] = "daw" - self.cpp_info.set_property("cmake_target_name", "daw::daw-json-link") self.cpp_info.components["daw"].names["cmake_find_package"] = "daw-json-link" self.cpp_info.components["daw"].names["cmake_find_package_multi"] = "daw-json-link" - self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-json-link") - self.cpp_info.components["daw"].requires = ["daw_header_libraries::daw", "daw_utf_range::daw"] diff --git a/recipes/daw_json_link/all/test_package/CMakeLists.txt b/recipes/daw_json_link/all/test_package/CMakeLists.txt index fb88deca223e69..5162d77931f1e3 100644 --- a/recipes/daw_json_link/all/test_package/CMakeLists.txt +++ b/recipes/daw_json_link/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(daw-json-link CONFIG REQUIRED) +find_package(daw-json-link REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} daw::daw-json-link) +target_link_libraries(${PROJECT_NAME} PRIVATE daw::daw-json-link) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/daw_json_link/all/test_package/conanfile.py b/recipes/daw_json_link/all/test_package/conanfile.py index 103e285f2d1a0d..e845ae751a3017 100644 --- a/recipes/daw_json_link/all/test_package/conanfile.py +++ b/recipes/daw_json_link/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -class DawJsonLinkTestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/daw_json_link/all/test_v1_package/CMakeLists.txt b/recipes/daw_json_link/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..20f081513f1d85 --- /dev/null +++ b/recipes/daw_json_link/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(daw-json-link REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE daw::daw-json-link) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/daw_json_link/all/test_v1_package/conanfile.py b/recipes/daw_json_link/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..103e285f2d1a0d --- /dev/null +++ b/recipes/daw_json_link/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class DawJsonLinkTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/daw_json_link/config.yml b/recipes/daw_json_link/config.yml index fd13a438a6f480..0be7e0765dcdbf 100644 --- a/recipes/daw_json_link/config.yml +++ b/recipes/daw_json_link/config.yml @@ -13,11 +13,5 @@ versions: folder: "all" "2.15.3": folder: "all" - "2.15.2": - folder: "all" "2.14.0": folder: "all" - "2.12.9": - folder: "all" - "2.11.0": - folder: "all" From 405b10a595d83f79d7e1601f62e8eafe16256933 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 28 Oct 2022 01:57:31 +0900 Subject: [PATCH 205/300] (#13766) bzip3: add version 1.1.8 * bzip3: add version 1.1.8 and add Apache-2.0 license * remove Apache-2.0 licenses * add libsais License --- recipes/bzip3/all/conandata.yml | 3 +++ recipes/bzip3/all/conanfile.py | 2 +- recipes/bzip3/config.yml | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/bzip3/all/conandata.yml b/recipes/bzip3/all/conandata.yml index 205a2576d24de9..41dc4a96c73a94 100644 --- a/recipes/bzip3/all/conandata.yml +++ b/recipes/bzip3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.8": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.8/bzip3-1.1.8.tar.bz2" + sha256: "bc15d0e4599aad18d9ed71ee0f7e859af89051bf5105b0751e8ca3a26117567d" "1.1.7": url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.7/bzip3-1.1.7.tar.bz2" sha256: "1f74768dd1a76c45417f84779cc04d8d8b1f595ac564a2ea2aeb0248defca803" diff --git a/recipes/bzip3/all/conanfile.py b/recipes/bzip3/all/conanfile.py index 83556101068ce4..118e5fbf34f0cb 100644 --- a/recipes/bzip3/all/conanfile.py +++ b/recipes/bzip3/all/conanfile.py @@ -77,7 +77,7 @@ def build(self): cmake.build() def package(self): - copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() diff --git a/recipes/bzip3/config.yml b/recipes/bzip3/config.yml index 62bae9d00b79af..c51e66db15fa7b 100644 --- a/recipes/bzip3/config.yml +++ b/recipes/bzip3/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.8": + folder: all "1.1.7": folder: all "1.1.6": From e0e52608ca74df708bcedafabbb2334612c106d2 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 27 Oct 2022 19:50:01 +0200 Subject: [PATCH 206/300] (#13768) toml11: conan v2 support --- recipes/toml11/all/conanfile.py | 35 +++++++++++-------- .../toml11/all/test_package/CMakeLists.txt | 11 +++--- recipes/toml11/all/test_package/conanfile.py | 19 +++++++--- .../toml11/all/test_v1_package/CMakeLists.txt | 8 +++++ .../toml11/all/test_v1_package/conanfile.py | 17 +++++++++ 5 files changed, 64 insertions(+), 26 deletions(-) create mode 100644 recipes/toml11/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/toml11/all/test_v1_package/conanfile.py diff --git a/recipes/toml11/all/conanfile.py b/recipes/toml11/all/conanfile.py index f0c21a1ef54b46..72284ac7310c26 100644 --- a/recipes/toml11/all/conanfile.py +++ b/recipes/toml11/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class Toml11Conan(ConanFile): @@ -14,27 +17,31 @@ class Toml11Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("toml.hpp", dst=os.path.join("include", "toml11"), src=self._source_subfolder) - self.copy("*.hpp", dst=os.path.join("include", "toml11", "toml"), src=os.path.join(self._source_subfolder, "toml")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "toml.hpp", src=self.source_folder, dst=os.path.join(self.package_folder, "include", "toml11")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "toml"), dst=os.path.join(self.package_folder, "include", "toml11", "toml")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "toml11") self.cpp_info.set_property("cmake_target_name", "toml11::toml11") + self.cpp_info.bindirs = [] self.cpp_info.includedirs.append(os.path.join("include", "toml11")) + self.cpp_info.libdirs = [] diff --git a/recipes/toml11/all/test_package/CMakeLists.txt b/recipes/toml11/all/test_package/CMakeLists.txt index 7c5e612554e37b..6fbc21219d46f6 100644 --- a/recipes/toml11/all/test_package/CMakeLists.txt +++ b/recipes/toml11/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(toml11 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} toml11::toml11) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE toml11::toml11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/toml11/all/test_package/conanfile.py b/recipes/toml11/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/toml11/all/test_package/conanfile.py +++ b/recipes/toml11/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/toml11/all/test_v1_package/CMakeLists.txt b/recipes/toml11/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/toml11/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/toml11/all/test_v1_package/conanfile.py b/recipes/toml11/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/toml11/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 82003308961f7ad09d73656c172fd95dc57faedd Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 27 Oct 2022 20:26:07 +0200 Subject: [PATCH 207/300] (#13747) highway: conan v2 support --- recipes/highway/all/CMakeLists.txt | 7 -- recipes/highway/all/conandata.yml | 2 - recipes/highway/all/conanfile.py | 116 +++++++++--------- .../highway/all/test_package/CMakeLists.txt | 7 +- recipes/highway/all/test_package/conanfile.py | 19 ++- .../all/test_v1_package/CMakeLists.txt | 8 ++ .../highway/all/test_v1_package/conanfile.py | 17 +++ 7 files changed, 100 insertions(+), 76 deletions(-) delete mode 100644 recipes/highway/all/CMakeLists.txt create mode 100644 recipes/highway/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/highway/all/test_v1_package/conanfile.py diff --git a/recipes/highway/all/CMakeLists.txt b/recipes/highway/all/CMakeLists.txt deleted file mode 100644 index 07ec7f05275cb3..00000000000000 --- a/recipes/highway/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/highway/all/conandata.yml b/recipes/highway/all/conandata.yml index c75bfd6cd5a4be..c9671c15c90e36 100644 --- a/recipes/highway/all/conandata.yml +++ b/recipes/highway/all/conandata.yml @@ -20,7 +20,5 @@ sources: patches: "0.16.0": - patch_file: "patches/0.16.0-0001-fix-sys-random-h.patch" - base_path: "source_subfolder" "0.11.1": - patch_file: "patches/0.11.1-0001-remove-contrib.patch" - base_path: "source_subfolder" diff --git a/recipes/highway/all/conanfile.py b/recipes/highway/all/conanfile.py index 2772a3559d5636..a659244ef92cdf 100644 --- a/recipes/highway/all/conanfile.py +++ b/recipes/highway/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" + class HighwayConan(ConanFile): name = "highway" @@ -22,11 +26,6 @@ class HighwayConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _minimum_cpp_standard(self): @@ -36,81 +35,84 @@ def _minimum_cpp_standard(self): def _minimum_compilers_version(self): return { "Visual Studio": "16", + "msvc": "192", "gcc": "8", "clang": "7", } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if tools.Version(self.version) < "0.16.0": + if Version(self.version) < "0.16.0": del self.options.shared elif self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) - minimum_version = self._minimum_compilers_version.get( - str(self.settings.compiler)) - if not minimum_version: - self.output.warn( - "{} recipe lacks information about the {} compiler support." - .format(self.name, self.settings.compiler)) - elif tools.Version(self.settings.compiler.version) < minimum_version: + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._minimum_compilers_version.get(str(self.info.settings.compiler)) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "{} requires a {} version >= {}" - .format(self.name, self.settings.compiler, - self.settings.compiler.version)) + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["HWY_ENABLE_EXAMPLES"] = False + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # Honor fPIC option - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, - "set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)", "") - tools.replace_in_file(cmakelists, - "set_property(TARGET hwy PROPERTY " - "POSITION_INDEPENDENT_CODE ON)", "") - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["HWY_ENABLE_EXAMPLES"] = False - cmake.configure() - return cmake + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)", "") + replace_in_file(self, cmakelists, + "set_property(TARGET hwy PROPERTY POSITION_INDEPENDENT_CODE ON)", + "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["pkg_config"] = "libhwy" - - self.cpp_info.libs = ["hwy"] - if tools.Version(self.version) >= "0.12.1": - self.cpp_info.libs.append("hwy_contrib") - if tools.Version(self.version) >= "0.15.0": - self.cpp_info.libs.append("hwy_test") - if tools.Version(self.version) >= "0.16.0": - self.cpp_info.defines.append("HWY_SHARED_DEFINE" if self.options.shared else "HWY_STATIC_DEFINE") + self.cpp_info.components["hwy"].set_property("pkg_config_name", "libhwy") + self.cpp_info.components["hwy"].libs = ["hwy"] + if Version(self.version) >= "0.16.0": + self.cpp_info.components["hwy"].defines.append( + "HWY_SHARED_DEFINE" if self.options.shared else "HWY_STATIC_DEFINE" + ) + if Version(self.version) >= "0.12.1": + self.cpp_info.components["hwy_contrib"].set_property("pkg_config_name", "libhwy-contrib") + self.cpp_info.components["hwy_contrib"].libs = ["hwy_contrib"] + self.cpp_info.components["hwy_contrib"].requires = ["hwy"] + if Version(self.version) >= "0.15.0": + self.cpp_info.components["hwy_test"].set_property("pkg_config_name", "libhwy-test") + self.cpp_info.components["hwy_test"].libs = ["hwy_test"] + self.cpp_info.components["hwy_test"].requires = ["hwy"] diff --git a/recipes/highway/all/test_package/CMakeLists.txt b/recipes/highway/all/test_package/CMakeLists.txt index bc7732ea3ac583..06e1e8678e6bde 100644 --- a/recipes/highway/all/test_package/CMakeLists.txt +++ b/recipes/highway/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(highway REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} highway::highway) +target_link_libraries(${PROJECT_NAME} PRIVATE highway::highway) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/highway/all/test_package/conanfile.py b/recipes/highway/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/highway/all/test_package/conanfile.py +++ b/recipes/highway/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/highway/all/test_v1_package/CMakeLists.txt b/recipes/highway/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/highway/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/highway/all/test_v1_package/conanfile.py b/recipes/highway/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/highway/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 0e4db1b31ded6ef1e91642cc4eb243b7f681fd85 Mon Sep 17 00:00:00 2001 From: Michael Keck Date: Thu, 27 Oct 2022 21:05:45 +0200 Subject: [PATCH 208/300] (#13771) m4: add download mirror * m4: add download mirror Fixes #13769 * m4: use new syntax to specify mirrors --- recipes/m4/all/conandata.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/recipes/m4/all/conandata.yml b/recipes/m4/all/conandata.yml index ce596798ca3a9a..3b25f4d23294d8 100644 --- a/recipes/m4/all/conandata.yml +++ b/recipes/m4/all/conandata.yml @@ -1,9 +1,13 @@ sources: "1.4.19": - url: "https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz" + url: + - "https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz" + - "https://ftpmirror.gnu.org/gnu/m4/m4-1.4.19.tar.gz" sha256: "3be4a26d825ffdfda52a56fc43246456989a3630093cced3fbddf4771ee58a70" "1.4.18": - url: "https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz" + url: + - "https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz" + - "https://ftpmirror.gnu.org/gnu/m4/m4-1.4.18.tar.gz" sha256: "ab2633921a5cd38e48797bf5521ad259bdc4b979078034a3b790d7fec5493fab" patches: "1.4.19": From bafb80eb2f8d5fd4586f19db439425c80c7f17a4 Mon Sep 17 00:00:00 2001 From: birgerbr Date: Thu, 27 Oct 2022 21:25:20 +0200 Subject: [PATCH 209/300] (#13773) Add version 2.3.0 of libe57format --- recipes/libe57format/all/conandata.yml | 5 +++++ .../libe57format/all/patches/2.3.0-0001-fix-pic.patch | 10 ++++++++++ recipes/libe57format/config.yml | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 recipes/libe57format/all/patches/2.3.0-0001-fix-pic.patch diff --git a/recipes/libe57format/all/conandata.yml b/recipes/libe57format/all/conandata.yml index ca42e36ed36ec9..857bfbb53a2a6f 100644 --- a/recipes/libe57format/all/conandata.yml +++ b/recipes/libe57format/all/conandata.yml @@ -2,7 +2,12 @@ sources: "2.2.0": sha256: "19df04af07925bf43e1793534b0c77cb1346a2bee7746859d2fe1714a24f1c7d" url: "https://github.com/asmaloney/libE57Format/archive/refs/tags/v2.2.0.tar.gz" + "2.3.0": + sha256: "124cc8f7dda84e8686ff2bcffc524ee4677eba3183631ec847a5f4a6ea60b254" + url: "https://github.com/asmaloney/libE57Format/archive/refs/tags/v2.3.0.tar.gz" patches: "2.2.0": - patch_file: "patches/0001-fix-pic.patch" - patch_file: "patches/0002-missing-include.patch" + "2.3.0": + - patch_file: "patches/2.3.0-0001-fix-pic.patch" diff --git a/recipes/libe57format/all/patches/2.3.0-0001-fix-pic.patch b/recipes/libe57format/all/patches/2.3.0-0001-fix-pic.patch new file mode 100644 index 00000000000000..a2ecc0de60e339 --- /dev/null +++ b/recipes/libe57format/all/patches/2.3.0-0001-fix-pic.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -127,7 +127,6 @@ + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS NO + DEBUG_POSTFIX "-d" +- POSITION_INDEPENDENT_CODE ON + ) + + # Target definitions diff --git a/recipes/libe57format/config.yml b/recipes/libe57format/config.yml index 1979b3114ab95d..137671316c0599 100644 --- a/recipes/libe57format/config.yml +++ b/recipes/libe57format/config.yml @@ -1,3 +1,5 @@ versions: "2.2.0": folder: all + "2.3.0": + folder: all From 25b29c17b87cf588757828c06cbf174ea3c175a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maro=C5=A1=20Matisko?= Date: Thu, 27 Oct 2022 21:50:42 +0200 Subject: [PATCH 210/300] (#13780) function2: add version 4.2.2 --- recipes/function2/all/conandata.yml | 3 +++ recipes/function2/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/function2/all/conandata.yml b/recipes/function2/all/conandata.yml index aac289a2373ad0..4a8c1d45eb5f55 100644 --- a/recipes/function2/all/conandata.yml +++ b/recipes/function2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.2.2": + url: "https://github.com/Naios/function2/archive/refs/tags/4.2.2.tar.gz" + sha256: "f755cb79712dfb9ceefcf7f7ff3225f7c99d22a164dae109044dbfad55d7111e" "4.2.1": url: "https://github.com/Naios/function2/archive/4.2.1.tar.gz" sha256: "dfaf12f6cc4dadc4fc7051af7ac57be220c823aaccfd2fecebcb45a0a03a6eb0" diff --git a/recipes/function2/config.yml b/recipes/function2/config.yml index 52fa67bcd41e8a..955cd0773fc58e 100644 --- a/recipes/function2/config.yml +++ b/recipes/function2/config.yml @@ -1,4 +1,6 @@ versions: + "4.2.2": + folder: all "4.2.1": folder: all "4.2.0": From 45915e771fe5421bac561cfb426c2e8ee6000a07 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 28 Oct 2022 05:05:24 +0900 Subject: [PATCH 211/300] (#13785) libpng: update zlib, use export_conandata_patches --- recipes/libpng/all/conanfile.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/recipes/libpng/all/conanfile.py b/recipes/libpng/all/conanfile.py index fab92b5657a56d..16462a0b3cc0ac 100644 --- a/recipes/libpng/all/conanfile.py +++ b/recipes/libpng/all/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout from conan.tools.scm import Version -from conan.tools.files import apply_conandata_patches, get, rmdir, replace_in_file, copy, rm +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, rmdir, replace_in_file, copy, rm from conan.tools.microsoft import is_msvc from conan.tools.build import cross_building from conan.tools.apple import is_apple_os @@ -9,7 +9,7 @@ import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class LibpngConan(ConanFile): @@ -56,8 +56,7 @@ def _has_vsx_support(self): return "ppc" in self.settings.arch def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -87,7 +86,7 @@ def configure(self): pass def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def source(self): get(self, **self.conan_data["sources"][self.version], From 7e411617ed3526105ad0009524d1db62f00a699d Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 27 Oct 2022 22:25:27 +0200 Subject: [PATCH 212/300] (#13788) Bump vulkan-headers/1.3.231.1 --- recipes/vulkan-headers/all/conandata.yml | 3 +++ recipes/vulkan-headers/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/vulkan-headers/all/conandata.yml b/recipes/vulkan-headers/all/conandata.yml index 71dca94c6e1de0..51438000285135 100644 --- a/recipes/vulkan-headers/all/conandata.yml +++ b/recipes/vulkan-headers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231.1": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "6e16051ccb28821b907a08025eedb82cc73e1056924b32f75880ecae2499f7f6" "1.3.231.0": url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.231.0.tar.gz" sha256: "f7c185dedf7753d58e7b59913dd4b77006a6ed91fae598c5961f77d85b183da0" diff --git a/recipes/vulkan-headers/config.yml b/recipes/vulkan-headers/config.yml index d565ec93efc887..e869bb8c10f234 100644 --- a/recipes/vulkan-headers/config.yml +++ b/recipes/vulkan-headers/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231.1": + folder: all "1.3.231.0": folder: all "1.3.231": From 8c751aec86c88eae82a709d921ff8854dd1f9b1e Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Fri, 28 Oct 2022 04:47:25 +0800 Subject: [PATCH 213/300] (#13798) libtiff - bump dep version for zlib --- recipes/libtiff/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libtiff/all/conanfile.py b/recipes/libtiff/all/conanfile.py index bb6e7d3f38d444..fe8c9d1fb525b5 100644 --- a/recipes/libtiff/all/conanfile.py +++ b/recipes/libtiff/all/conanfile.py @@ -89,7 +89,7 @@ def layout(self): def requirements(self): if self.options.zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.get_safe("libdeflate"): self.requires("libdeflate/1.12") if self.options.lzma: From 16b5f9edd21b18564f3eebb80120fc4cb760b484 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 27 Oct 2022 23:45:50 +0200 Subject: [PATCH 214/300] (#13819) Bump draco/1.5.4 --- recipes/draco/all/conandata.yml | 3 +++ recipes/draco/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/draco/all/conandata.yml b/recipes/draco/all/conandata.yml index 1870fef6caf186..e60ef8b61cbf0b 100644 --- a/recipes/draco/all/conandata.yml +++ b/recipes/draco/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5.4": + url: "https://github.com/google/draco/archive/refs/tags/1.5.4.tar.gz" + sha256: "7698cce91c24725562fb73811d24823f0f0a25e3ac0941e792993c5191d3baee" "1.5.3": url: "https://github.com/google/draco/archive/refs/tags/1.5.3.tar.gz" sha256: "7882a942a1da14a9ae9d557b1a3af7f44bdee7f5d42b745c4e474fb8b28d4e5e" diff --git a/recipes/draco/config.yml b/recipes/draco/config.yml index fca6d7abd23662..e0e89faa27b30a 100644 --- a/recipes/draco/config.yml +++ b/recipes/draco/config.yml @@ -1,4 +1,6 @@ versions: + "1.5.4": + folder: all "1.5.3": folder: all "1.5.2": From 64914b04956f5ba4cff87d4f6e1e9b0cb5dfacf2 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 28 Oct 2022 08:25:57 +0900 Subject: [PATCH 215/300] (#13824) watcher: add version 0.3.3 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/watcher/all/conandata.yml | 3 +++ recipes/watcher/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/watcher/all/conandata.yml b/recipes/watcher/all/conandata.yml index 3568e962cc45ca..83a88eb659ec74 100644 --- a/recipes/watcher/all/conandata.yml +++ b/recipes/watcher/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.3.3": + url: "https://github.com/e-dant/watcher/archive/release/0.3.3.tar.gz" + sha256: "1cb4a898741306bb9089bd24175bcbb2cb434531eac6bbcfe1a3679b8bf1f44c" "0.3.2": url: "https://github.com/e-dant/watcher/archive/refs/tags/release/0.3.2.tar.gz" sha256: "f00247ad8ee492cb70143917bd19f80056227f4ebd4263015727f02750e4fbd5" diff --git a/recipes/watcher/config.yml b/recipes/watcher/config.yml index 8c5374f11cf763..11d8c7d1ee55c8 100644 --- a/recipes/watcher/config.yml +++ b/recipes/watcher/config.yml @@ -1,4 +1,6 @@ versions: + "0.3.3": + folder: all "0.3.2": folder: all "0.3.1": From 00cf9fdbad47f1c3d12a63fe42331d60b0da7f7b Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 28 Oct 2022 08:45:44 +0900 Subject: [PATCH 216/300] (#13823) quill: add version 2.3.2 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/quill/all/conandata.yml | 3 +++ recipes/quill/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index 2ad5762a9d9e5d..cf7782fd50c7dc 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.2": + url: "https://github.com/odygrd/quill/archive/v2.3.2.tar.gz" + sha256: "41c3410ff0a6c0eac175dcd3f8c07d920c5a681fa6801fd3172926d8c3cbe0fc" "2.2.0": url: "https://github.com/odygrd/quill/archive/v2.2.0.tar.gz" sha256: "6b123b60b16d41009228d907851f025c8be974d5fcf41af0b6afbe48edebbf73" diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index 5687ce1413095e..2276b4c50c5b62 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.2": + folder: "all" "2.2.0": folder: "all" "2.1.0": From b657409eafca5ea89a0b4ff0bb16fe1123d08ce5 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 28 Oct 2022 03:26:08 +0200 Subject: [PATCH 217/300] (#13820) protobuf: bump zlib --- recipes/protobuf/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/protobuf/all/conanfile.py b/recipes/protobuf/all/conanfile.py index 7dc7627cb9068c..d23242627557db 100644 --- a/recipes/protobuf/all/conanfile.py +++ b/recipes/protobuf/all/conanfile.py @@ -80,7 +80,7 @@ def configure(self): def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.options.shared and str(self.settings.compiler.get_safe("runtime")) in ["MT", "MTd", "static"]: From 973af3d6c6eadd55686f14de4bcf891465473d5f Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Fri, 28 Oct 2022 10:09:28 +0800 Subject: [PATCH 218/300] (#13797) nasm: small recipe fix to un-break openssl - export PATH * nasm: small recipe fix to un-break openssl - export PATH * Add more bin paths based on the jom recipe * Update recipes/nasm/all/conanfile.py Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> * Remove unused imports Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/nasm/all/conanfile.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/recipes/nasm/all/conanfile.py b/recipes/nasm/all/conanfile.py index 3ae5789bf6256a..cb7c424310d735 100644 --- a/recipes/nasm/all/conanfile.py +++ b/recipes/nasm/all/conanfile.py @@ -1,13 +1,12 @@ import os import shutil -from conan import ConanFile, conan_version +from conan import ConanFile from conan.tools.env import VirtualBuildEnv from conan.tools.files import chdir, copy, get, rmdir, apply_conandata_patches, export_conandata_patches, replace_in_file from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.microsoft import VCVars, is_msvc -from conan.tools.scm import Version required_conan_version = ">=1.52.0" @@ -105,3 +104,7 @@ def package(self): def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] + + bin_folder = os.path.join(self.package_folder, "bin") + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.PATH.append(bin_folder) From e833f1868268090e5c6f22290b0bd782cd19e426 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 28 Oct 2022 11:25:45 +0900 Subject: [PATCH 219/300] (#13825) kuba-zip: add version 0.2.6 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/kuba-zip/all/conandata.yml | 3 +++ recipes/kuba-zip/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/kuba-zip/all/conandata.yml b/recipes/kuba-zip/all/conandata.yml index 871b86958fb94e..687b00ee7e2388 100644 --- a/recipes/kuba-zip/all/conandata.yml +++ b/recipes/kuba-zip/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.2.6": + url: "https://github.com/kuba--/zip/archive/v0.2.6.tar.gz" + sha256: "6a00e10dc5242f614f76f1bd1d814726a41ee6e3856ef3caf7c73de0b63acf0b" "0.2.5": url: "https://github.com/kuba--/zip/archive/v0.2.5.tar.gz" sha256: "e052f6cbe6713f69f8caec61214fda4e5ae5150d1fcba02c9e79f1a05d939305" diff --git a/recipes/kuba-zip/config.yml b/recipes/kuba-zip/config.yml index 0715c027886780..7244cf3b53ff72 100644 --- a/recipes/kuba-zip/config.yml +++ b/recipes/kuba-zip/config.yml @@ -1,4 +1,6 @@ versions: + "0.2.6": + folder: "all" "0.2.5": folder: "all" "0.2.4": From 448575ad3553c045349e31731b9390195fa46ca7 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 28 Oct 2022 06:26:00 +0200 Subject: [PATCH 220/300] (#13440) glib: several fixes & improvements * safe deletion of settings & options * use basic_layout * bump dependencies * set install_name to `@rpath` on macOS * add VirtualBuildEnv since there are tool requirements * properly handle renaming of libs for msvc * add CMakeDeps & PkgConfigDeps tests * version ordering convention * cleanup * simplify injection of meson options * bump zlib * cleanup * add res to resdirs * no pkgconfig if windows in test_package --- recipes/glib/all/conandata.yml | 54 ++++---- recipes/glib/all/conanfile.py | 116 +++++++++--------- recipes/glib/all/test_package/CMakeLists.txt | 9 +- recipes/glib/all/test_package/conanfile.py | 47 +++++-- .../glib/all/test_v1_package/CMakeLists.txt | 8 ++ recipes/glib/all/test_v1_package/conanfile.py | 26 ++++ recipes/glib/config.yml | 20 +-- 7 files changed, 171 insertions(+), 109 deletions(-) create mode 100644 recipes/glib/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/glib/all/test_v1_package/conanfile.py diff --git a/recipes/glib/all/conandata.yml b/recipes/glib/all/conandata.yml index d737b8773d1597..5eb5b3d461c8ee 100644 --- a/recipes/glib/all/conandata.yml +++ b/recipes/glib/all/conandata.yml @@ -1,34 +1,34 @@ sources: - "2.68.3": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.68.3/glib-2.68.3.tar.gz" - sha256: "465c0727dd5505e998ebb1dae7c38683440dc6d6beffbca6bbf3eaabdb4f6ac7" - "2.69.3": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.69.3/glib-2.69.3.tar.gz" - sha256: "290f05eb5affd1bac142010d6511c7a3de361e5f69addc677cf6b3c92a757b44" - "2.70.4": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.70.4/glib-2.70.4.tar.gz" - sha256: "23461c4e694b465fad32ea677b3abc9306fa8511d12e915aee09b53f362c7fff" - "2.71.3": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.71.3/glib-2.71.3.tar.gz" - sha256: "08e17cf608f5ac3462092bff13828c1c0aab37c5b4827d4e17b948215b4e40ea" - "2.72.1": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.72.1/glib-2.72.1.tar.gz" - sha256: "4a345987a9ee7709417f5a5c6f4eeec2497bc2a913f14c1b9bdc403409d5ffb7" - "2.73.0": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.73.0/glib-2.73.0.tar.gz" - sha256: "3f573319adbdf572d79255e8bae85c7e2902d1aa6177d2646605a00c0a607eca" - "2.73.1": - url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.1.tar.xz" - sha256: "77b21da5bd195a8e5f751206a2acab477636e3d02fe4f3796ede5788255382ae" - "2.73.2": - url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.2.tar.xz" - sha256: "5f3ee36e34f4aaab393c3e3dc46fb01b32f7ead6c88d41d7f20d88a49cdef1d9" - "2.73.3": - url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.3.tar.xz" - sha256: "df1a2b841667d6b48b2ef6969ebda4328243829f6e45866726f806f90f64eead" "2.74.0": url: "https://download.gnome.org/sources/glib/2.74/glib-2.74.0.tar.xz" sha256: "3652c7f072d7b031a6b5edd623f77ebc5dcd2ae698598abcc89ff39ca75add30" + "2.73.3": + url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.3.tar.xz" + sha256: "df1a2b841667d6b48b2ef6969ebda4328243829f6e45866726f806f90f64eead" + "2.73.2": + url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.2.tar.xz" + sha256: "5f3ee36e34f4aaab393c3e3dc46fb01b32f7ead6c88d41d7f20d88a49cdef1d9" + "2.73.1": + url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.1.tar.xz" + sha256: "77b21da5bd195a8e5f751206a2acab477636e3d02fe4f3796ede5788255382ae" + "2.73.0": + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.73.0/glib-2.73.0.tar.gz" + sha256: "3f573319adbdf572d79255e8bae85c7e2902d1aa6177d2646605a00c0a607eca" + "2.72.1": + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.72.1/glib-2.72.1.tar.gz" + sha256: "4a345987a9ee7709417f5a5c6f4eeec2497bc2a913f14c1b9bdc403409d5ffb7" + "2.71.3": + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.71.3/glib-2.71.3.tar.gz" + sha256: "08e17cf608f5ac3462092bff13828c1c0aab37c5b4827d4e17b948215b4e40ea" + "2.70.4": + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.70.4/glib-2.70.4.tar.gz" + sha256: "23461c4e694b465fad32ea677b3abc9306fa8511d12e915aee09b53f362c7fff" + "2.69.3": + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.69.3/glib-2.69.3.tar.gz" + sha256: "290f05eb5affd1bac142010d6511c7a3de361e5f69addc677cf6b3c92a757b44" + "2.68.3": + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.68.3/glib-2.68.3.tar.gz" + sha256: "465c0727dd5505e998ebb1dae7c38683440dc6d6beffbca6bbf3eaabdb4f6ac7" patches: "2.74.0": - patch_file: "patches/0001-2.74.0-clang-static-assert.patch" diff --git a/recipes/glib/all/conanfile.py b/recipes/glib/all/conanfile.py index a2a7ecce95c56e..7742c7227fde4a 100644 --- a/recipes/glib/all/conanfile.py +++ b/recipes/glib/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.scm import Version -from conan.tools.microsoft import is_msvc -from conan.tools.meson import Meson, MesonToolchain +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir from conan.tools.gnu import PkgConfigDeps, AutotoolsDeps -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, replace_in_file, rmdir, chdir, rm, copy -from conan.tools.apple import is_apple_os +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -import glob import shutil @@ -21,6 +22,7 @@ class GLibConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.gnome.org/GNOME/glib" license = "LGPL-2.1" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,18 +40,10 @@ class GLibConan(ConanFile): "with_mount": True, "with_selinux": True, } - short_paths = True - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + short_paths = True def export_sources(self): - copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) export_conandata_patches(self) def config_options(self): @@ -65,12 +59,24 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") self.requires("libffi/3.4.3") if self.options.with_pcre: if Version(self.version) >= "2.73.2": @@ -102,19 +108,16 @@ def validate(self): raise ConanInvalidConfiguration("libelf dependency can't be disabled in glib < 2.67.0") def build_requirements(self): - self.tool_requires("meson/0.63.2") + self.tool_requires("meson/0.63.3") self.tool_requires("pkgconf/1.9.3") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def layout(self): - self.folders.build = self._build_subfolder - self.folders.source = self._source_subfolder - def generate(self): - + env = VirtualBuildEnv(self) + env.generate() tc = PkgConfigDeps(self) tc.generate() tc = AutotoolsDeps(self) @@ -129,28 +132,20 @@ def generate(self): tc.generate() # it's needed so MesonToolchain reads from AutotoolsDeps, should it be automatic? self.buildenv.compose_env(tc.environment) - tc = MesonToolchain(self) - defs = dict() + tc = MesonToolchain(self) if is_apple_os(self): - defs["iconv"] = "external" # https://gitlab.gnome.org/GNOME/glib/issues/1557 - defs["selinux"] = "enabled" if self.options.get_safe("with_selinux") else "disabled" - defs["libmount"] = "enabled" if self.options.get_safe("with_mount") else "disabled" - + tc.project_options["iconv"] = "external" # https://gitlab.gnome.org/GNOME/glib/issues/1557 + tc.project_options["selinux"] = "enabled" if self.options.get_safe("with_selinux") else "disabled" + tc.project_options["libmount"] = "enabled" if self.options.get_safe("with_mount") else "disabled" if Version(self.version) < "2.69.0": - defs["internal_pcre"] = not self.options.with_pcre - + tc.project_options["internal_pcre"] = not self.options.with_pcre if self.settings.os == "FreeBSD": - defs["xattr"] = "false" + tc.project_options["xattr"] = "false" if Version(self.version) >= "2.67.2": - defs["tests"] = "false" - + tc.project_options["tests"] = "false" if Version(self.version) >= "2.67.0": - defs["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" - - for name, value in defs.items(): - tc.project_options[name] = value - tc.project_options["libdir"] = "lib" + tc.project_options["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" tc.generate() def _patch_sources(self): @@ -201,14 +196,6 @@ def build(self): meson.configure() meson.build() - def _fix_library_names(self): - if self.settings.compiler == "Visual Studio": - with chdir(self, os.path.join(self.package_folder, "lib")): - for filename_old in glob.glob("*.a"): - filename_new = filename_old[3:-2] + ".lib" - self.output.info(f"rename {filename_old} into {filename_new}") - shutil.move(filename_old, filename_new) - def package(self): if Version(self.version) < "2.73.0": copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) @@ -216,7 +203,6 @@ def package(self): copy(self, pattern="LGPL-2.1-or-later.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "LICENSES")) meson = Meson(self) meson.install() - self._fix_library_names() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "libexec")) shutil.move( @@ -224,8 +210,8 @@ def package(self): os.path.join(self.package_folder, "res"), ) rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) - rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) - rm(self, "*.pc", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): self.cpp_info.components["glib-2.0"].set_property("pkg_config_name", "glib-2.0") @@ -234,11 +220,11 @@ def package_info(self): os.path.join("include", "glib-2.0"), os.path.join("lib", "glib-2.0", "include") ] - self.cpp_info.components["glib-2.0"].libdirs = ["lib"] + self.cpp_info.components["glib-2.0"].resdirs = ["res"] self.cpp_info.components["gmodule-no-export-2.0"].set_property("pkg_config_name", "gmodule-no-export-2.0") self.cpp_info.components["gmodule-no-export-2.0"].libs = ["gmodule-2.0"] - self.cpp_info.components["gmodule-no-export-2.0"].libdirs = ["lib"] + self.cpp_info.components["gmodule-no-export-2.0"].resdirs = ["res"] self.cpp_info.components["gmodule-no-export-2.0"].requires.append("glib-2.0") self.cpp_info.components["gmodule-export-2.0"].set_property("pkg_config_name", "gmodule-export-2.0") @@ -249,17 +235,17 @@ def package_info(self): self.cpp_info.components["gobject-2.0"].set_property("pkg_config_name", "gobject-2.0") self.cpp_info.components["gobject-2.0"].libs = ["gobject-2.0"] - self.cpp_info.components["gobject-2.0"].libdirs = ["lib"] + self.cpp_info.components["gobject-2.0"].resdirs = ["res"] self.cpp_info.components["gobject-2.0"].requires += ["glib-2.0", "libffi::libffi"] self.cpp_info.components["gthread-2.0"].set_property("pkg_config_name", "gthread-2.0") self.cpp_info.components["gthread-2.0"].libs = ["gthread-2.0"] - self.cpp_info.components["gthread-2.0"].libdirs = ["lib"] + self.cpp_info.components["gthread-2.0"].resdirs = ["res"] self.cpp_info.components["gthread-2.0"].requires.append("glib-2.0") self.cpp_info.components["gio-2.0"].set_property("pkg_config_name", "gio-2.0") self.cpp_info.components["gio-2.0"].libs = ["gio-2.0"] - self.cpp_info.components["gio-2.0"].libdirs = ["lib"] + self.cpp_info.components["gio-2.0"].resdirs = ["res"] self.cpp_info.components["gio-2.0"].requires += ["glib-2.0", "gobject-2.0", "gmodule-2.0", "zlib::zlib"] self.cpp_info.components["gresource"].set_property("pkg_config_name", "gresource") @@ -345,3 +331,19 @@ def package_info(self): self.cpp_info.components["glib-2.0"].set_property( "pkg_config_custom_content", "\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items())) + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib""" + from conan.tools.files import rename + import glob + if not is_msvc(conanfile): + return + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/glib/all/test_package/CMakeLists.txt b/recipes/glib/all/test_package/CMakeLists.txt index 963dd3465174a1..701cfbcd53416f 100644 --- a/recipes/glib/all/test_package/CMakeLists.txt +++ b/recipes/glib/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) add_executable(${PROJECT_NAME} test_package.c) if (WIN32) find_package(glib CONFIG REQUIRED) - target_link_libraries(${PROJECT_NAME} glib::glib-2.0 glib::gio-2.0 glib::gmodule-2.0 glib::gobject-2.0 glib::gthread-2.0) + target_link_libraries(${PROJECT_NAME} PRIVATE glib::glib-2.0 glib::gio-2.0 glib::gmodule-2.0 glib::gobject-2.0 glib::gthread-2.0) else() find_package(PkgConfig REQUIRED) pkg_check_modules(glib-2.0 REQUIRED IMPORTED_TARGET glib-2.0) @@ -16,5 +13,5 @@ else() pkg_check_modules(gmodule-2.0 REQUIRED IMPORTED_TARGET gmodule-2.0) pkg_check_modules(gobject-2.0 REQUIRED IMPORTED_TARGET gobject-2.0) pkg_check_modules(gthread-2.0 REQUIRED IMPORTED_TARGET gthread-2.0) - target_link_libraries(${PROJECT_NAME} PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0) + target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0) endif() diff --git a/recipes/glib/all/test_package/conanfile.py b/recipes/glib/all/test_package/conanfile.py index e0bb16725b0500..3cff3b0d1d1304 100644 --- a/recipes/glib/all/test_package/conanfile.py +++ b/recipes/glib/all/test_package/conanfile.py @@ -1,22 +1,51 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, cmake_layout +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.gnu import PkgConfig, PkgConfigDeps import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi", "pkg_config" + generators = "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build(self): + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): if self.settings.os != "Windows": - with tools.environment_append({'PKG_CONFIG_PATH': "."}): - pkg_config = tools.PkgConfig("gio-2.0") - self.run("%s -h" % pkg_config.variables["gdbus_codegen"], run_environment=True) + self.tool_requires("pkgconf/1.9.3") + def generate(self): + if self.settings.os == "Windows": + deps = CMakeDeps(self) + deps.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + pkg = PkgConfigDeps(self) + pkg.generate() + # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuildenv_pkg_config_path") + + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + + if self.settings.os != "Windows": + pkg_config = PkgConfig(self, "gio-2.0", pkg_config_path=self.generators_folder) + gdbus_codegen = pkg_config.variables["gdbus_codegen"] + self.run(f"{gdbus_codegen} -h", env="conanrun") diff --git a/recipes/glib/all/test_v1_package/CMakeLists.txt b/recipes/glib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/glib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glib/all/test_v1_package/conanfile.py b/recipes/glib/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..d968f0377f778f --- /dev/null +++ b/recipes/glib/all/test_v1_package/conanfile.py @@ -0,0 +1,26 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi", "pkg_config" + + def build_requirements(self): + if self.settings.os != "Windows": + self.build_requires("pkgconf/1.9.3") + + def build(self): + if self.settings.os != "Windows": + with tools.environment_append({"PKG_CONFIG_PATH": "."}): + pkg_config = tools.PkgConfig("gio-2.0") + self.run(f"{pkg_config.variables['gdbus_codegen']} -h", run_environment=True) + + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/glib/config.yml b/recipes/glib/config.yml index 382622725e923b..e8494b97b4aa41 100644 --- a/recipes/glib/config.yml +++ b/recipes/glib/config.yml @@ -1,21 +1,21 @@ versions: - "2.68.3": - folder: all - "2.69.3": + "2.74.0": folder: all - "2.70.4": + "2.73.3": folder: all - "2.71.3": + "2.73.2": folder: all - "2.72.1": + "2.73.1": folder: all "2.73.0": folder: all - "2.73.1": + "2.72.1": folder: all - "2.73.2": + "2.71.3": folder: all - "2.73.3": + "2.70.4": folder: all - "2.74.0": + "2.69.3": + folder: all + "2.68.3": folder: all From 7f1385b1951fadea0b41c53b88d78b7ae06dc9cd Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Fri, 28 Oct 2022 00:04:39 -0500 Subject: [PATCH 221/300] (#13737) shapelib: Support Conan V2 * shapelib: Support Conan V2 * Set CMake policy CMP0077 * Only delete .exe files --- recipes/shapelib/all/CMakeLists.txt | 7 -- recipes/shapelib/all/conandata.yml | 10 +++ recipes/shapelib/all/conanfile.py | 78 ++++++++++--------- .../patches/0001-cmake-minimum-required.patch | 23 ++++++ .../all/patches/0002-build-testing.patch | 57 ++++++++++++++ .../shapelib/all/test_package/CMakeLists.txt | 7 +- .../shapelib/all/test_package/conanfile.py | 19 +++-- .../all/test_v1_package/CMakeLists.txt | 8 ++ .../shapelib/all/test_v1_package/conanfile.py | 17 ++++ 9 files changed, 173 insertions(+), 53 deletions(-) delete mode 100644 recipes/shapelib/all/CMakeLists.txt create mode 100644 recipes/shapelib/all/patches/0001-cmake-minimum-required.patch create mode 100644 recipes/shapelib/all/patches/0002-build-testing.patch create mode 100644 recipes/shapelib/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/shapelib/all/test_v1_package/conanfile.py diff --git a/recipes/shapelib/all/CMakeLists.txt b/recipes/shapelib/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d4..00000000000000 --- a/recipes/shapelib/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/shapelib/all/conandata.yml b/recipes/shapelib/all/conandata.yml index 8b9c86049a8b3d..5dde0cb6bfee12 100644 --- a/recipes/shapelib/all/conandata.yml +++ b/recipes/shapelib/all/conandata.yml @@ -2,3 +2,13 @@ sources: "1.5.0": url: "https://github.com/OSGeo/shapelib/archive/v1.5.0.zip" sha256: "673b00ef6caef254fe16d831b982e6bbed7397615c57b9ed92cf8b59017dd06b" +patches: + "1.5.0": + - patch_file: "patches/0001-cmake-minimum-required.patch" + patch_description: "Place the cmake_minimum_required call before the project command" + patch_source: "https://github.com/OSGeo/shapelib/pull/45" + patch_type: "portability" + - patch_file: "patches/0002-build-testing.patch" + patch_description: "Use the standard BUILD_TESTING variable to control building tests" + patch_source: "https://github.com/OSGeo/shapelib/pull/46" + patch_type: "portability" diff --git a/recipes/shapelib/all/conanfile.py b/recipes/shapelib/all/conanfile.py index 3ebe445bae662a..a8c64fe9fc8b7a 100644 --- a/recipes/shapelib/all/conanfile.py +++ b/recipes/shapelib/all/conanfile.py @@ -1,17 +1,20 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.43.0" +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.layout import cmake_layout + +required_conan_version = ">=1.52.0" class ShapelibConan(ConanFile): name = "shapelib" description = "C library for reading and writing ESRI Shapefiles" license = "LGPL-2.0-or-later" - topics = ("shapelib", "osgeo", "shapefile", "esri", "geospatial") + topics = ("osgeo", "shapefile", "esri", "geospatial") homepage = "https://github.com/OSGeo/shapelib" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,51 +25,54 @@ class ShapelibConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.variables["BUILD_TESTING"] = False + tc.variables["USE_RPATH"] = False + tc.generate() def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set(BUILD_TEST ON)", "") + apply_conandata_patches(self) cmake = CMake(self) - cmake.definitions["USE_RPATH"] = False - cmake.configure(build_folder=self._build_subfolder) - cmake.build(target="shp") + cmake.configure() + cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - - self.copy("shapefil.h", dst="include", src=self._source_subfolder) - - build_lib_dir = os.path.join(self._build_subfolder, "lib") - build_bin_dir = os.path.join(self._build_subfolder, "bin") - self.copy(pattern="*.a", dst="lib", src=build_lib_dir, keep_path=False) - self.copy(pattern="*.lib", dst="lib", src=build_lib_dir, keep_path=False) - self.copy(pattern="*.dylib", dst="lib", src=build_lib_dir, keep_path=False, symlinks=True) - self.copy(pattern="*.so*", dst="lib", src=build_lib_dir, keep_path=False, symlinks=True) - self.copy(pattern="*.dll", dst="bin", src=build_bin_dir, keep_path=False) + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rm(self, "*.exe", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "shapelib") diff --git a/recipes/shapelib/all/patches/0001-cmake-minimum-required.patch b/recipes/shapelib/all/patches/0001-cmake-minimum-required.patch new file mode 100644 index 00000000000000..6e8c1526181597 --- /dev/null +++ b/recipes/shapelib/all/patches/0001-cmake-minimum-required.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7ae7f5d..0a5662f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -20,14 +20,15 @@ + + # It is a fatal error if no working C compiler is available to build + # the shapelib library and utilities ++ ++# Version 3.7 or above of cmake is currently required for all platforms. ++cmake_minimum_required(VERSION 3.7) ++ + project(shapelib C) + + message(STATUS "CMake version = ${CMAKE_VERSION}") + message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}") + +-# Version 2.8.5 or above of cmake is currently required for all platforms. +-cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) +- + # libraries are all shared by default. + option(BUILD_SHARED_LIBS "Build shared libraries" ON) + diff --git a/recipes/shapelib/all/patches/0002-build-testing.patch b/recipes/shapelib/all/patches/0002-build-testing.patch new file mode 100644 index 00000000000000..b86e9d5682d904 --- /dev/null +++ b/recipes/shapelib/all/patches/0002-build-testing.patch @@ -0,0 +1,57 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0a5662f..6214dec 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -149,7 +149,7 @@ set(executables + find_program(BASH_EXECUTABLE bash) + find_program(SED_EXECUTABLE sed) + if(BASH_EXECUTABLE AND SED_EXECUTABLE) +- set(BUILD_TEST ON) ++ set(BUILD_TESTING ON CACHE BOOL "") + else(BASH_EXECUTABLE AND SED_EXECUTABLE) + message(STATUS "WARNING: sed or bash not available so disabling testing") + endif(BASH_EXECUTABLE AND SED_EXECUTABLE) +@@ -158,14 +158,14 @@ endif(BASH_EXECUTABLE AND SED_EXECUTABLE) + # from http://dl.maptools.org/dl/shapelib/shape_eg_data.zip, unpacked + # that file, and specified the location of that directory with + # the cmake option, -DEG_DATA:PATH=whatever +-if(BUILD_TEST) ++if(BUILD_TESTING) + if(EG_DATA) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/script.sed "s?/u/www/projects/shapelib/eg_data?${EG_DATA}?\n") + else(EG_DATA) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/script.sed "") + message(STATUS "WARNING: EG_DATA:PATH not set to point to downloaded eg_data directory so the eg_data part of testing will be ignored.") + endif(EG_DATA) +-endif(BUILD_TEST) ++endif() + + foreach(executable ${executables}) + add_executable(${executable} ${executable}.c) +@@ -176,17 +176,17 @@ foreach(executable ${executables}) + INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}" + ) + endif(USE_RPATH) +- if(BUILD_TEST) ++ if(BUILD_TESTING) + get_target_property(${executable}_LOC ${executable} LOCATION) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/script.sed "s?\\./${executable}?${${executable}_LOC}?\n") +- endif(BUILD_TEST) ++ endif() + install(TARGETS ${executable} DESTINATION ${CMAKE_INSTALL_BINDIR}) + endforeach(executable ${executables}) + + # Install header + install(FILES shapefil.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +-if(BUILD_TEST) ++if(BUILD_TESTING) + # Set up tests: + + enable_testing() +@@ -235,4 +235,4 @@ if(BUILD_TEST) + NAME test3 + COMMAND ${BASH_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/sed_scripted_test3.sh + ) +-endif(BUILD_TEST) ++endif() diff --git a/recipes/shapelib/all/test_package/CMakeLists.txt b/recipes/shapelib/all/test_package/CMakeLists.txt index 199ed9ec00c6d4..30289c1a8112b9 100644 --- a/recipes/shapelib/all/test_package/CMakeLists.txt +++ b/recipes/shapelib/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(shapelib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} shapelib::shp) +target_link_libraries(${PROJECT_NAME} PRIVATE shapelib::shp) diff --git a/recipes/shapelib/all/test_package/conanfile.py b/recipes/shapelib/all/test_package/conanfile.py index 38f4483872d47f..a9fb96656f2039 100644 --- a/recipes/shapelib/all/test_package/conanfile.py +++ b/recipes/shapelib/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/shapelib/all/test_v1_package/CMakeLists.txt b/recipes/shapelib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/shapelib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/shapelib/all/test_v1_package/conanfile.py b/recipes/shapelib/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/shapelib/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From c18e47a60aed44e7ef5268dcb04f39dd22886171 Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 28 Oct 2022 14:26:07 +0900 Subject: [PATCH 222/300] (#13782) libuv: add version 1.44.2, remove older versions --- recipes/libuv/all/conandata.yml | 35 +++++--- .../libuv/all/patches/1.34.2/fix-cmake.patch | 87 ------------------- .../libuv/all/patches/1.38.0/fix-cmake.patch | 80 ----------------- .../libuv/all/patches/1.44.2/fix-cmake.patch | 49 +++++++++++ recipes/libuv/config.yml | 6 +- 5 files changed, 76 insertions(+), 181 deletions(-) delete mode 100644 recipes/libuv/all/patches/1.34.2/fix-cmake.patch delete mode 100644 recipes/libuv/all/patches/1.38.0/fix-cmake.patch create mode 100644 recipes/libuv/all/patches/1.44.2/fix-cmake.patch diff --git a/recipes/libuv/all/conandata.yml b/recipes/libuv/all/conandata.yml index 77db7c637633e2..e251d497e772da 100644 --- a/recipes/libuv/all/conandata.yml +++ b/recipes/libuv/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.44.2": + url: "https://github.com/libuv/libuv/archive/v1.44.2.tar.gz" + sha256: "e6e2ba8b4c349a4182a33370bb9be5e23c51b32efb9b9e209d0e8556b73a48da" "1.44.1": url: "https://github.com/libuv/libuv/archive/v1.44.1.tar.gz" sha256: "e91614e6dc2dd0bfdd140ceace49438882206b7a6fb00b8750914e67a9ed6d6b" @@ -20,31 +23,43 @@ sources: "1.38.1": url: "https://github.com/libuv/libuv/archive/v1.38.1.zip" sha256: "0359369492742eb2a36312fffe26f80bcffe4cec981a4fd72d182b061ee14890" - "1.38.0": - url: "https://github.com/libuv/libuv/archive/v1.38.0.zip" - sha256: "6502ee75e1007325ba2e15e06d3d7b94ac911704793b2fe6f7bb933e1748db72" - "1.34.2": - url: "https://github.com/libuv/libuv/archive/v1.34.2.zip" - sha256: "e1a663bcbfbeb18e447f79a39645ca555db47153d29ed81a1cb289373f357035" patches: + "1.44.2": + - patch_file: "patches/1.44.2/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" "1.44.1": - patch_file: "patches/1.44.1/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" "1.43.0": - patch_file: "patches/1.43.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" "1.42.0": - patch_file: "patches/1.42.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" "1.41.1": - patch_file: "patches/1.41.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" - patch_file: "patches/1.40.0/fix-ios.patch" "1.41.0": - patch_file: "patches/1.41.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" - patch_file: "patches/1.40.0/fix-ios.patch" + patch_description: "fix dlopen filename" + patch_type: "portability" "1.40.0": - patch_file: "patches/1.40.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" - patch_file: "patches/1.40.0/fix-ios.patch" + patch_description: "fix dlopen filename" + patch_type: "portability" "1.38.1": - patch_file: "patches/1.38.1/fix-cmake.patch" - "1.38.0": - - patch_file: "patches/1.38.0/fix-cmake.patch" - "1.34.2": - - patch_file: "patches/1.34.2/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" diff --git a/recipes/libuv/all/patches/1.34.2/fix-cmake.patch b/recipes/libuv/all/patches/1.34.2/fix-cmake.patch deleted file mode 100644 index f763d9bfd56e94..00000000000000 --- a/recipes/libuv/all/patches/1.34.2/fix-cmake.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2ab6d17e..9292e6a2 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -365,38 +365,26 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD") - list(APPEND uv_test_libraries util) - endif() - --add_library(uv SHARED ${uv_sources}) -+add_library(uv ${uv_sources}) - target_compile_definitions(uv -- INTERFACE USING_UV_SHARED=1 -- PRIVATE ${uv_defines} BUILDING_UV_SHARED=1) -+ PRIVATE -+ ${uv_defines} -+) -+get_target_property(target_type uv TYPE) -+if (target_type STREQUAL "SHARED_LIBRARY") -+ target_compile_definitions(uv -+ INTERFACE -+ USING_UV_SHARED=1 -+ PRIVATE -+ BUILDING_UV_SHARED=1 -+ ) -+else() -+ set_property(TARGET uv PROPERTY OUTPUT_NAME "uv_a") -+endif() - target_compile_options(uv PRIVATE ${uv_cflags}) - target_include_directories(uv PUBLIC include PRIVATE src) - target_link_libraries(uv ${uv_libraries}) - --add_library(uv_a STATIC ${uv_sources}) --target_compile_definitions(uv_a PRIVATE ${uv_defines}) --target_compile_options(uv_a PRIVATE ${uv_cflags}) --target_include_directories(uv_a PUBLIC include PRIVATE src) --target_link_libraries(uv_a ${uv_libraries}) -- --if(LIBUV_BUILD_TESTS) -- add_executable(uv_run_tests ${uv_test_sources}) -- target_compile_definitions(uv_run_tests -- PRIVATE ${uv_defines} USING_UV_SHARED=1) -- target_compile_options(uv_run_tests PRIVATE ${uv_cflags}) -- target_link_libraries(uv_run_tests uv ${uv_test_libraries}) -- add_test(NAME uv_test -- COMMAND uv_run_tests -- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -- add_executable(uv_run_tests_a ${uv_test_sources}) -- target_compile_definitions(uv_run_tests_a PRIVATE ${uv_defines}) -- target_compile_options(uv_run_tests_a PRIVATE ${uv_cflags}) -- target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries}) -- add_test(NAME uv_test_a -- COMMAND uv_run_tests_a -- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) --endif() -- - if(UNIX) - # Now for some gibbering horrors from beyond the stars... - foreach(x ${uv_libraries}) -@@ -411,20 +399,18 @@ if(UNIX) - set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) - set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) - set(prefix ${CMAKE_INSTALL_PREFIX}) -- configure_file(libuv.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libuv.pc @ONLY) - - install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -- install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libuv.pc -- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -- install(TARGETS uv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses) -+ install(TARGETS uv -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - - if(WIN32) - install(DIRECTORY include/ DESTINATION include) -- install(FILES LICENSE DESTINATION .) -- install(TARGETS uv uv_a -- RUNTIME DESTINATION lib/$ -- ARCHIVE DESTINATION lib/$) -+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses) -+ install(TARGETS uv -+ RUNTIME DESTINATION bin -+ ARCHIVE DESTINATION lib) - endif() diff --git a/recipes/libuv/all/patches/1.38.0/fix-cmake.patch b/recipes/libuv/all/patches/1.38.0/fix-cmake.patch deleted file mode 100644 index 031e64210b090f..00000000000000 --- a/recipes/libuv/all/patches/1.38.0/fix-cmake.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0496d36a..90615d57 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -298,13 +298,19 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD") - list(APPEND uv_test_libraries util) - endif() - --add_library(uv SHARED ${uv_sources}) --target_compile_definitions(uv -- INTERFACE -- USING_UV_SHARED=1 -- PRIVATE -- BUILDING_UV_SHARED=1 -- ${uv_defines}) -+add_library(uv ${uv_sources}) -+get_target_property(target_type uv TYPE) -+if (target_type STREQUAL "SHARED_LIBRARY") -+ target_compile_definitions(uv -+ INTERFACE -+ USING_UV_SHARED=1 -+ PRIVATE -+ BUILDING_UV_SHARED=1 -+ ) -+else() -+ set_property(TARGET uv PROPERTY OUTPUT_NAME "uv_a") -+endif() -+target_compile_definitions(uv PRIVATE ${uv_defines}) - target_compile_options(uv PRIVATE ${uv_cflags}) - target_include_directories(uv - PUBLIC -@@ -314,17 +320,6 @@ target_include_directories(uv - $) - target_link_libraries(uv ${uv_libraries}) - --add_library(uv_a STATIC ${uv_sources}) --target_compile_definitions(uv_a PRIVATE ${uv_defines}) --target_compile_options(uv_a PRIVATE ${uv_cflags}) --target_include_directories(uv_a -- PUBLIC -- $ -- $ -- PRIVATE -- $) --target_link_libraries(uv_a ${uv_libraries}) -- - if(LIBUV_BUILD_TESTS) - # Small hack: use ${uv_test_sources} now to get the runner skeleton, - # before the actual tests are added. -@@ -558,22 +553,20 @@ if(UNIX) - set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) - set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) - set(prefix ${CMAKE_INSTALL_PREFIX}) -- configure_file(libuv.pc.in libuv.pc @ONLY) - - install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -- install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) -- install(FILES ${PROJECT_BINARY_DIR}/libuv.pc -- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -- install(TARGETS uv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses) -+ install(TARGETS uv -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - - if(WIN32) - install(DIRECTORY include/ DESTINATION include) -- install(FILES LICENSE DESTINATION .) -- install(TARGETS uv uv_a -- RUNTIME DESTINATION lib/$ -- ARCHIVE DESTINATION lib/$) -+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses) -+ install(TARGETS uv -+ RUNTIME DESTINATION bin -+ ARCHIVE DESTINATION lib) - endif() - - message(STATUS "summary of build options: diff --git a/recipes/libuv/all/patches/1.44.2/fix-cmake.patch b/recipes/libuv/all/patches/1.44.2/fix-cmake.patch new file mode 100644 index 00000000000000..8bae960541ddce --- /dev/null +++ b/recipes/libuv/all/patches/1.44.2/fix-cmake.patch @@ -0,0 +1,49 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7f46682..3477beb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -388,13 +388,18 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD") + list(APPEND uv_test_libraries util) + endif() + +-add_library(uv SHARED ${uv_sources}) ++add_library(uv ${uv_sources}) ++if(BUILD_SHARED_LIBS) + target_compile_definitions(uv + INTERFACE + USING_UV_SHARED=1 + PRIVATE + BUILDING_UV_SHARED=1 + ${uv_defines}) ++else() ++ set_property(TARGET uv PROPERTY OUTPUT_NAME "uv_a") ++ target_compile_definitions(uv PRIVATE ${uv_defines}) ++endif() + target_compile_options(uv PRIVATE ${uv_cflags}) + target_include_directories(uv + PUBLIC +@@ -408,6 +413,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS390") + endif() + target_link_libraries(uv ${uv_libraries}) + ++if(0) + add_library(uv_a STATIC ${uv_sources}) + target_compile_definitions(uv_a PRIVATE ${uv_defines}) + target_compile_options(uv_a PRIVATE ${uv_cflags}) +@@ -422,6 +428,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS390") + set_target_properties(uv_a PROPERTIES LINKER_LANGUAGE CXX) + endif() + target_link_libraries(uv_a ${uv_libraries}) ++endif() + + if(LIBUV_BUILD_TESTS) + # Small hack: use ${uv_test_sources} now to get the runner skeleton, +@@ -685,8 +692,6 @@ install(TARGETS uv EXPORT libuvConfig + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-install(TARGETS uv_a EXPORT libuvConfig +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(EXPORT libuvConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv) + + if(MSVC) diff --git a/recipes/libuv/config.yml b/recipes/libuv/config.yml index 0b7b938d97cc52..cc83d80cfe19bc 100644 --- a/recipes/libuv/config.yml +++ b/recipes/libuv/config.yml @@ -1,4 +1,6 @@ versions: + "1.44.2": + folder: all "1.44.1": folder: all "1.43.0": @@ -13,7 +15,3 @@ versions: folder: all "1.38.1": folder: all - "1.38.0": - folder: all - "1.34.2": - folder: all From 6f97c85c0fdda27dacc5d0f86ebbfb785aaae6cb Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 28 Oct 2022 15:05:06 +0900 Subject: [PATCH 223/300] (#13784) wasmtime: add version 2.0.0 and remove older version --- recipes/wasmtime/all/conandata.yml | 57 ++++++++++++++++-------------- recipes/wasmtime/config.yml | 4 +-- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/recipes/wasmtime/all/conandata.yml b/recipes/wasmtime/all/conandata.yml index f988f4e2263c81..7abaff02430478 100644 --- a/recipes/wasmtime/all/conandata.yml +++ b/recipes/wasmtime/all/conandata.yml @@ -1,4 +1,34 @@ sources: + "2.0.0": + Windows: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-x86_64-windows-c-api.zip" + sha256: "ada9fe8f706811f3f63dcaa4c7c72519893f91ae7980f7f8ed6e542932ad6a4e" + MinGW: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-x86_64-mingw-c-api.zip" + sha256: "dc024d00671098260643b51b3609bb808f440bb8e2f06d9fad6c2af1160d16b7" + Linux: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-x86_64-linux-c-api.tar.xz" + sha256: "c216f16a0494b7b609890effcd417b9807dc8a6d5c47818fb4a297fef2bb54e3" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-aarch64-linux-c-api.tar.xz" + sha256: "9bbcfbcc68b9b8c4572f0bdd956e1a558f9a01e82bd099fac9c7755220c92189" + "s390x": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-s390x-linux-c-api.tar.xz" + sha256: "9bbe40d443a34b1d8f71c9239d87555e9f41e04a9d84f085186711b8075ec5ef" + Macos: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-x86_64-macos-c-api.tar.xz" + sha256: "658f8834a322ddf35cfcfc2c56afbbfad91106a00633d5c6c932757fa83378b2" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-aarch64-macos-c-api.tar.xz" + sha256: "08749d061565f9b48a29c57d3ef9ee2d432d531fad8758be97b1c98bfda1c14b" + Android: + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-aarch64-linux-c-api.tar.xz" + sha256: "9bbcfbcc68b9b8c4572f0bdd956e1a558f9a01e82bd099fac9c7755220c92189" "1.0.1": Windows: "x86_64": @@ -200,30 +230,3 @@ sources: "armv8": url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.34.0/wasmtime-v0.34.0-aarch64-linux-c-api.tar.xz" sha256: "3ee684353b87dd0e114cb7244d79107985ad34ab2358ec342317f5aeed42298a" - "0.32.0": - Windows: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-x86_64-windows-c-api.zip" - sha256: "079abe3c22636a66e6a5f25ebb39e1facec9521d4dd0d41159381a60098701bf" - MinGW: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-x86_64-mingw-c-api.zip" - sha256: "3d999427dab6b2750fccddf6cd2b0ac251dbc4e527cc930728a5280feb248743" - Linux: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-x86_64-linux-c-api.tar.xz" - sha256: "80d2e587e16cda44696a01792e74dc2064fd13598d139302599e10389ca09a0e" - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-aarch64-linux-c-api.tar.xz" - sha256: "6d9425829003a44c92af118ff2ae72a887e088ea6ac4a887ae315b41b5e96206" - "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-s390x-linux-c-api.tar.xz" - sha256: "f0c66b9b6a2e499e9ef0f500711e7dd3fb2f1f458d8fe17c4c81590de1a0b075" - Macos: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-x86_64-macos-c-api.tar.xz" - sha256: "9c191f678dc4fbcf345b628a70322e3034d36469e294d799a9ab4e28b6a98db9" - Android: - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-aarch64-linux-c-api.tar.xz" - sha256: "6d9425829003a44c92af118ff2ae72a887e088ea6ac4a887ae315b41b5e96206" diff --git a/recipes/wasmtime/config.yml b/recipes/wasmtime/config.yml index 807a611cb965c7..4f3b354d98720e 100644 --- a/recipes/wasmtime/config.yml +++ b/recipes/wasmtime/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.0": + folder: all "1.0.1": folder: all "0.39.1": @@ -13,5 +15,3 @@ versions: folder: all "0.34.0": folder: all - "0.32.0": - folder: all From 85c823c71ee02b200e948670942e14f6dff2e017 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Fri, 28 Oct 2022 09:04:48 +0200 Subject: [PATCH 224/300] (#13810) [release] 27 October 2022 Signed-off-by: Uilian Ries Signed-off-by: Uilian Ries --- docs/changelog.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 020830e28edf79..91e466325e4206 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,15 @@ # Changelog +### 27-October-2022 - 15:18 CEST + +- [feature] Add under maintenance check to AccessRequest and ScheduledExportCheck jobs. +- [feature] AccessRequest: Remove inactive users. +- [feature] Accept Major.Minor as bump version. +- [feature] Add message title to gihtub comments. +- [fix] Update maintainers list and fix output. +- [fix] Remove dummy files from tests. +- [fix] Make sure contributors are not removed in Access request PR. + ### 17-October-2022 - 10:33 CEST - [feature] Improve management of GitHub labels on pull requests. From 2a4b9362e0c4f53bb2615620b4307995d9e549cc Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Fri, 28 Oct 2022 15:25:18 +0800 Subject: [PATCH 225/300] (#13551) szip: conan v2 support * szip - modernize * szip - fixes suggested by linter, and test other target * Update recipes/szip/all/conanfile.py Co-authored-by: Chris Mc * Added public definition, removed szip::szip * Fixup test_package * Switch back from can_run() to cross_building(), the make file doesn't like cross-building mac -> mac arm * Whitespace fix * Changed szip to SZIP, allows HDF5 to have a smaller patch * Fix test_v1_package * Dont let project's cmake file change BUILD_SHARED_LIBS * Fix static/shared a better way * Remove test-b from v1 test * Enable b test in test_package. Fixup v1 test -> SZIP::SZIP * Tweak aliases and module-alias, try and support everything Including legacy finders. See new target_legacy_package and target_v1_legacy_package * Fixed tests - one won't pass * Remove cmake_find_package lines * Put finder module back in * Remove legacy tests Co-authored-by: Chris Mc --- recipes/szip/all/CMakeLists.txt | 7 -- recipes/szip/all/conandata.yml | 2 - recipes/szip/all/conanfile.py | 100 ++++++++++-------- recipes/szip/all/test_package/CMakeLists.txt | 10 +- recipes/szip/all/test_package/conanfile.py | 19 +++- .../szip/all/test_v1_package/CMakeLists.txt | 16 +++ recipes/szip/all/test_v1_package/conanfile.py | 17 +++ 7 files changed, 104 insertions(+), 67 deletions(-) delete mode 100644 recipes/szip/all/CMakeLists.txt create mode 100644 recipes/szip/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/szip/all/test_v1_package/conanfile.py diff --git a/recipes/szip/all/CMakeLists.txt b/recipes/szip/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d4..00000000000000 --- a/recipes/szip/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/szip/all/conandata.yml b/recipes/szip/all/conandata.yml index 52d2161a0f0cfa..920d26895e8008 100644 --- a/recipes/szip/all/conandata.yml +++ b/recipes/szip/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "2.1.1": - patch_file: "patches/fix_unknown_size_t.patch" - base_path: "source_subfolder" - patch_file: "patches/build_either_static_or_shared.patch" - base_path: "source_subfolder" diff --git a/recipes/szip/all/conanfile.py b/recipes/szip/all/conanfile.py index ca722c2adb2c42..b431b4a8bec9ef 100644 --- a/recipes/szip/all/conanfile.py +++ b/recipes/szip/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, collect_libs, get, copy, replace_in_file, save +from conan.tools.build import cross_building import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class SzipConan(ConanFile): @@ -10,7 +13,7 @@ class SzipConan(ConanFile): description = "C Implementation of the extended-Rice lossless compression " \ "algorithm, suitable for use with scientific data." license = "Szip License" - topics = ("szip", "compression", "decompression") + topics = "compression", "decompression" homepage = "https://support.hdfgroup.org/doc_resource/SZIP/" url = "https://github.com/conan-io/conan-center-index" @@ -28,21 +31,8 @@ class SzipConan(ConanFile): "enable_large_file": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,41 +40,52 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def build(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"), + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["SZIP_ENABLE_ENCODING"] = self.options.enable_encoding - self._cmake.definitions["SZIP_EXTERNALLY_CONFIGURED"] = True - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["SZIP_BUILD_FRAMEWORKS"] = False - self._cmake.definitions["SZIP_PACK_MACOSX_FRAMEWORK"] = False - self._cmake.definitions["SZIP_ENABLE_LARGE_FILE"] = self.options.enable_large_file - if tools.cross_building(self, skip_x64_x86=True) and self.options.enable_large_file: + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SZIP_ENABLE_ENCODING"] = self.options.enable_encoding + tc.variables["SZIP_EXTERNALLY_CONFIGURED"] = True + tc.variables["BUILD_TESTING"] = False + tc.variables["SZIP_BUILD_FRAMEWORKS"] = False + tc.variables["SZIP_PACK_MACOSX_FRAMEWORK"] = False + tc.variables["SZIP_ENABLE_LARGE_FILE"] = self.options.enable_large_file + if cross_building(self, skip_x64_x86=True) and self.options.enable_large_file: # Assume it works, otherwise raise in 'validate' function - self._cmake.definitions["TEST_LFS_WORKS_RUN"] = True - self._cmake.definitions["TEST_LFS_WORKS_RUN__TRYRUN_OUTPUT"] = True - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["TEST_LFS_WORKS_RUN"] = True + tc.variables["TEST_LFS_WORKS_RUN__TRYRUN_OUTPUT"] = True + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -92,8 +93,7 @@ def package(self): {"szip-shared" if self.options.shared else "szip-static": "szip::szip"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -102,16 +102,22 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "szip") self.cpp_info.set_property("cmake_target_name", "szip-shared" if self.options.shared else "szip-static") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m"]) + + if self.options.shared: + self.cpp_info.defines.append("SZ_BUILT_AS_DYNAMIC_LIB=1") # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/szip/all/test_package/CMakeLists.txt b/recipes/szip/all/test_package/CMakeLists.txt index 9338e5b029a4de..2cc3f3a2650b9a 100644 --- a/recipes/szip/all/test_package/CMakeLists.txt +++ b/recipes/szip/all/test_package/CMakeLists.txt @@ -1,14 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package C) find_package(szip REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET szip-shared) target_link_libraries(${PROJECT_NAME} szip-shared) -else() +else () target_link_libraries(${PROJECT_NAME} szip-static) -endif() +endif () diff --git a/recipes/szip/all/test_package/conanfile.py b/recipes/szip/all/test_package/conanfile.py index 38f4483872d47f..a9fb96656f2039 100644 --- a/recipes/szip/all/test_package/conanfile.py +++ b/recipes/szip/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/szip/all/test_v1_package/CMakeLists.txt b/recipes/szip/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..54dab32a194306 --- /dev/null +++ b/recipes/szip/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + + +find_package(szip REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) + +if(TARGET szip-shared) + target_link_libraries(${PROJECT_NAME} szip-shared) +else () + target_link_libraries(${PROJECT_NAME} szip-static) +endif () diff --git a/recipes/szip/all/test_v1_package/conanfile.py b/recipes/szip/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/szip/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 46cf3f8437e5b2f6d7025efa903dbd003436c710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20S=C3=A1nchez=20Falero?= Date: Fri, 28 Oct 2022 09:50:13 +0200 Subject: [PATCH 226/300] (#13831) jenkins windows tag updated to windows20221024 --- .c3i/config_v1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.c3i/config_v1.yml b/.c3i/config_v1.yml index df0cd98446adcb..84e2b27b4e6495 100644 --- a/.c3i/config_v1.yml +++ b/.c3i/config_v1.yml @@ -159,7 +159,7 @@ node_labels: Windows: x86_64: "Visual Studio": - default: "windows20220803" + default: "windows20221024" Macos: x86_64: "apple-clang": From 636292712d1bd3d3c288ac0d07bc80b5a3b4d360 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 28 Oct 2022 11:36:47 +0200 Subject: [PATCH 227/300] (#13756) Bump volk/1.3.231.0 --- recipes/volk/all/conandata.yml | 3 +++ recipes/volk/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/volk/all/conandata.yml b/recipes/volk/all/conandata.yml index 4c743f1d08e6cf..f9c865549057e7 100644 --- a/recipes/volk/all/conandata.yml +++ b/recipes/volk/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231.1": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "fac8d3d295e88bcc6bfb2b729d2c4babb2ea04ccb39fd918a3471b2d756789b9" "1.3.224.1": url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.224.1.tar.gz" sha256: "86505052a83d3085e34d22f8b9969e9961efc24c0c902fefb0b6b43d496f69b4" diff --git a/recipes/volk/config.yml b/recipes/volk/config.yml index b84efda85dd040..fb5ab123c3994e 100644 --- a/recipes/volk/config.yml +++ b/recipes/volk/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231.1": + folder: "all" "1.3.224.1": folder: "all" "1.3.224.0": From c73f48fc246a4be496972bf451f42810ef4dadf6 Mon Sep 17 00:00:00 2001 From: sujankota Date: Fri, 28 Oct 2022 08:06:43 -0400 Subject: [PATCH 228/300] (#13835) opentdf-client: add version 1.3.3 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/opentdf-client/all/conandata.yml | 3 +++ recipes/opentdf-client/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/opentdf-client/all/conandata.yml b/recipes/opentdf-client/all/conandata.yml index 9fede5e2ebc2dc..9a2734bbd9e289 100644 --- a/recipes/opentdf-client/all/conandata.yml +++ b/recipes/opentdf-client/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.3": + url: "https://github.com/opentdf/client-cpp/archive/1.3.3.tar.gz" + sha256: "7949e662dc55a425771e5ecf2d96e25295d1e2394e805608aed72d1131896948" "1.3.2": url: "https://github.com/opentdf/client-cpp/archive/1.3.2.tar.gz" sha256: "d9a38d3aa6114159c90e0c254c78ddda921e2d520851e4def57f3cd26c564b16" diff --git a/recipes/opentdf-client/config.yml b/recipes/opentdf-client/config.yml index 37ebecaa11ef68..3db9d495515e97 100644 --- a/recipes/opentdf-client/config.yml +++ b/recipes/opentdf-client/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.3": + folder: all "1.3.2": folder: all "1.2.0": From 23c06c9e751e6fc29ad655335873378cf75d9e7e Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 28 Oct 2022 15:06:36 +0200 Subject: [PATCH 229/300] (#13734) Bump spirv-headers/1.3.231.1 * add 1.3.231.0 * minor improvements * package 1.3.231.1 instead of 1.3.231.0 --- recipes/spirv-headers/all/conandata.yml | 3 +++ recipes/spirv-headers/all/conanfile.py | 8 +++----- recipes/spirv-headers/all/test_package/conanfile.py | 7 ++++--- recipes/spirv-headers/all/test_v1_package/CMakeLists.txt | 8 +++----- recipes/spirv-headers/config.yml | 2 ++ 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/recipes/spirv-headers/all/conandata.yml b/recipes/spirv-headers/all/conandata.yml index 196ff31da7ba7f..1e912330b179a3 100644 --- a/recipes/spirv-headers/all/conandata.yml +++ b/recipes/spirv-headers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231.1": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3" "1.3.224.0": url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.224.0.tar.gz" sha256: "2fb1039ec6cec8943400e9b4d01d8bfe8c62a0bd1fafb7c39c56469aa247b838" diff --git a/recipes/spirv-headers/all/conanfile.py b/recipes/spirv-headers/all/conanfile.py index 63222a94c50927..852af3d4936841 100644 --- a/recipes/spirv-headers/all/conanfile.py +++ b/recipes/spirv-headers/all/conanfile.py @@ -15,12 +15,12 @@ class SpirvheadersConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - def package_id(self): - self.info.clear() - def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + self.info.clear() + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -47,9 +47,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "SPIRV-Headers::SPIRV-Headers") self.cpp_info.set_property("pkg_config_name", "SPIRV-Headers") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "SPIRV-Headers" diff --git a/recipes/spirv-headers/all/test_package/conanfile.py b/recipes/spirv-headers/all/test_package/conanfile.py index d120a992c06a69..0a6bc68712d901 100644 --- a/recipes/spirv-headers/all/test_package/conanfile.py +++ b/recipes/spirv-headers/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/spirv-headers/all/test_v1_package/CMakeLists.txt b/recipes/spirv-headers/all/test_v1_package/CMakeLists.txt index 0aed8ae7f92dc9..0d20897301b68b 100644 --- a/recipes/spirv-headers/all/test_v1_package/CMakeLists.txt +++ b/recipes/spirv-headers/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(SPIRV-Headers REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE SPIRV-Headers::SPIRV-Headers) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/spirv-headers/config.yml b/recipes/spirv-headers/config.yml index 503d23699f2bef..9b0f71c9afc69a 100644 --- a/recipes/spirv-headers/config.yml +++ b/recipes/spirv-headers/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231.1": + folder: all "1.3.224.0": folder: all "1.3.216.0": From d6542dce453bde6c084b24d1875c159d4d2ace83 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 28 Oct 2022 15:50:09 +0200 Subject: [PATCH 230/300] (#13752) Bump vulkan-loader/1.3.231.1 * add vulkan-loader/1.3.231.0 * fix build of 1.3.231.0 on Linux when wayland is enabled * update conandata * modernize more * add 1.3.231.1 instead of 1.3.231.0 --- recipes/vulkan-loader/all/conandata.yml | 23 +++++++++++-- recipes/vulkan-loader/all/conanfile.py | 32 ++++++++++--------- ...0.patch => 1.2.154.0-0001-fix-mingw.patch} | 5 --- ...182.patch => 1.2.182-0001-fix-mingw.patch} | 0 ...3.231.1-0001-no-find-package-wayland.patch | 13 ++++++++ .../all/test_package/CMakeLists.txt | 2 +- .../all/test_package/conanfile.py | 7 ++-- .../all/test_v1_package/CMakeLists.txt | 9 ++---- recipes/vulkan-loader/config.yml | 2 ++ 9 files changed, 61 insertions(+), 32 deletions(-) rename recipes/vulkan-loader/all/patches/{fix-mingw-1.2.154.0.patch => 1.2.154.0-0001-fix-mingw.patch} (94%) rename recipes/vulkan-loader/all/patches/{fix-mingw-1.2.182.patch => 1.2.182-0001-fix-mingw.patch} (100%) create mode 100644 recipes/vulkan-loader/all/patches/1.3.231.1-0001-no-find-package-wayland.patch diff --git a/recipes/vulkan-loader/all/conandata.yml b/recipes/vulkan-loader/all/conandata.yml index 492ebfb1d25752..d804f7c0e91a69 100644 --- a/recipes/vulkan-loader/all/conandata.yml +++ b/recipes/vulkan-loader/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231.1": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "5226fbc6a90e4405200c8cfdd5733d5e0c6a64e64dcc614c485ea06e03d66578" "1.3.231": url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/v1.3.231.tar.gz" sha256: "02e185b939635167ea8f8815f8daab76af36923a3b995951fe6a5d3e25c55bf7" @@ -45,7 +48,23 @@ sources: url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/sdk-1.2.154.0.tar.gz" sha256: "418017d7bab907e72291476df231dd0e7dc7fe20b97e55389c975bcfc48d6433" patches: + "1.3.231.1": + - patch_file: "patches/1.3.231.1-0001-no-find-package-wayland.patch" + patch_description: "CMake: remove attempt to find Wayland" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/Vulkan-Loader/pull/1020" + sha256: "f08b35f57884624fea618405affff17215cd747740bbce11af53a69911b48452" "1.2.182": - - patch_file: "patches/fix-mingw-1.2.182.patch" + - patch_file: "patches/1.2.182-0001-fix-mingw.patch" + patch_description: "Fix MinGW" + patch_type: "portability" + sha256: "a05375c60b7f4a91f48df2278518be27e578e38190034bfcc887e5ceaa289c25" "1.2.154.0": - - patch_file: "patches/fix-mingw-1.2.154.0.patch" + - patch_file: "patches/1.2.154.0-0001-fix-mingw.patch" + patch_description: "Fix MinGW" + patch_type: "portability" + patch_source: + - "https://github.com/KhronosGroup/Vulkan-Loader/pull/475" + - "https://github.com/KhronosGroup/Vulkan-Loader/pull/495" + - "https://github.com/KhronosGroup/Vulkan-Loader/pull/523" + sha256: "034e4252276fde22f14630d36404338dc3fa08ebf8fe7d5affe9065e0239f165" diff --git a/recipes/vulkan-loader/all/conanfile.py b/recipes/vulkan-loader/all/conanfile.py index 335e2cc80edb79..19b56e01777351 100644 --- a/recipes/vulkan-loader/all/conanfile.py +++ b/recipes/vulkan-loader/all/conanfile.py @@ -3,12 +3,12 @@ from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import Environment, VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.gnu import PkgConfigDeps from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class VulkanLoaderConan(ConanFile): @@ -47,8 +47,7 @@ def _is_pkgconf_needed(self): self.options.get_safe("with_wsi_wayland") or self.options.get_safe("with_wsi_directfb") def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -61,7 +60,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: del self.settings.compiler.libcxx except Exception: @@ -71,6 +73,9 @@ def configure(self): except Exception: pass + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): self.requires(f"vulkan-headers/{self.version}") if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"): @@ -79,7 +84,7 @@ def requirements(self): self.requires("wayland/1.21.0") def validate(self): - if self.options.get_safe("with_wsi_directfb"): + if self.info.options.get_safe("with_wsi_directfb"): # TODO: directfb package raise ConanInvalidConfiguration("Conan recipe for DirectFB is not available yet.") if not is_apple_os(self) and not self.info.options.shared: @@ -93,18 +98,19 @@ def validate(self): def build_requirements(self): if self._is_pkgconf_needed: - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/1.9.3") if self._is_mingw: self.tool_requires("jwasm/2.13") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): + if self._is_pkgconf_needed or self._is_mingw: + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) tc.variables["VULKAN_HEADERS_INSTALL_DIR"] = self.dependencies["vulkan-headers"].package_folder.replace("\\", "/") tc.variables["BUILD_TESTS"] = False @@ -130,11 +136,7 @@ def generate(self): # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) env = Environment() env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) - envvars = env.vars(self) - envvars.save_script("conanbuildenv_pkg_config_path") - if self._is_pkgconf_needed or self._is_mingw: - env = VirtualBuildEnv(self) - env.generate() + env.vars(self).save_script("conanbuildenv_pkg_config_path") def _patch_sources(self): apply_conandata_patches(self) diff --git a/recipes/vulkan-loader/all/patches/fix-mingw-1.2.154.0.patch b/recipes/vulkan-loader/all/patches/1.2.154.0-0001-fix-mingw.patch similarity index 94% rename from recipes/vulkan-loader/all/patches/fix-mingw-1.2.154.0.patch rename to recipes/vulkan-loader/all/patches/1.2.154.0-0001-fix-mingw.patch index ea9754bf3e7ec7..a585b5a17fff50 100644 --- a/recipes/vulkan-loader/all/patches/fix-mingw-1.2.154.0.patch +++ b/recipes/vulkan-loader/all/patches/1.2.154.0-0001-fix-mingw.patch @@ -1,8 +1,3 @@ -Fixes for MinGW: -https://github.com/KhronosGroup/Vulkan-Loader/pull/475 -https://github.com/KhronosGroup/Vulkan-Loader/pull/495 -https://github.com/KhronosGroup/Vulkan-Loader/pull/523 - --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -133,9 +133,28 @@ set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG}Note that this may be unsafe, as the C co diff --git a/recipes/vulkan-loader/all/patches/fix-mingw-1.2.182.patch b/recipes/vulkan-loader/all/patches/1.2.182-0001-fix-mingw.patch similarity index 100% rename from recipes/vulkan-loader/all/patches/fix-mingw-1.2.182.patch rename to recipes/vulkan-loader/all/patches/1.2.182-0001-fix-mingw.patch diff --git a/recipes/vulkan-loader/all/patches/1.3.231.1-0001-no-find-package-wayland.patch b/recipes/vulkan-loader/all/patches/1.3.231.1-0001-no-find-package-wayland.patch new file mode 100644 index 00000000000000..0f841d44ccf387 --- /dev/null +++ b/recipes/vulkan-loader/all/patches/1.3.231.1-0001-no-find-package-wayland.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -215,10 +215,6 @@ if(UNIX AND NOT APPLE) # i.e.: Linux + find_package(X11 REQUIRED) + endif() + +- if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) +- include_directories(SYSTEM ${WAYLAND_CLIENT_INCLUDE_DIR}) +- endif() + + if(BUILD_WSI_DIRECTFB_SUPPORT) + find_package(DirectFB REQUIRED) diff --git a/recipes/vulkan-loader/all/test_package/CMakeLists.txt b/recipes/vulkan-loader/all/test_package/CMakeLists.txt index 00975b926f978a..5a43176c74c66c 100644 --- a/recipes/vulkan-loader/all/test_package/CMakeLists.txt +++ b/recipes/vulkan-loader/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) find_package(Vulkan REQUIRED) diff --git a/recipes/vulkan-loader/all/test_package/conanfile.py b/recipes/vulkan-loader/all/test_package/conanfile.py index d120a992c06a69..0a6bc68712d901 100644 --- a/recipes/vulkan-loader/all/test_package/conanfile.py +++ b/recipes/vulkan-loader/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/vulkan-loader/all/test_v1_package/CMakeLists.txt b/recipes/vulkan-loader/all/test_v1_package/CMakeLists.txt index 6e3d630171e329..0d20897301b68b 100644 --- a/recipes/vulkan-loader/all/test_v1_package/CMakeLists.txt +++ b/recipes/vulkan-loader/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Vulkan REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Vulkan::Vulkan) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vulkan-loader/config.yml b/recipes/vulkan-loader/config.yml index f2dee728628655..9392c7d1f760b1 100644 --- a/recipes/vulkan-loader/config.yml +++ b/recipes/vulkan-loader/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231.1": + folder: all "1.3.231": folder: all "1.3.224.0": From 7b03f3d0c035fe7698f1d8a1142109bbf294cbde Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 28 Oct 2022 18:10:43 +0100 Subject: [PATCH 231/300] (#13427) [cairo] update toolchain * [cairo] update toolchain * [cairo] update test packages * [cairo] fix license copy * [cairo] bump versions * [cairo] add apple system libs (see comment) * [cairo] improve apple system libs handling * [cairo] add dependency on CoreGraphics for apple * [cairo] address review comments * [cairo] document patches --- recipes/cairo/meson/conandata.yml | 27 ++- recipes/cairo/meson/conanfile.py | 203 +++++++++--------- .../cairo/meson/test_package/CMakeLists.txt | 5 +- recipes/cairo/meson/test_package/conanfile.py | 20 +- .../meson/test_v1_package/CMakeLists.txt | 8 + .../cairo/meson/test_v1_package/conanfile.py | 18 ++ 6 files changed, 163 insertions(+), 118 deletions(-) create mode 100644 recipes/cairo/meson/test_v1_package/CMakeLists.txt create mode 100644 recipes/cairo/meson/test_v1_package/conanfile.py diff --git a/recipes/cairo/meson/conandata.yml b/recipes/cairo/meson/conandata.yml index 22722dbd3bd7e5..b5df6a0c87d1cc 100644 --- a/recipes/cairo/meson/conandata.yml +++ b/recipes/cairo/meson/conandata.yml @@ -5,12 +5,29 @@ sources: patches: "1.17.4": - patch_file: "patches/binutils-2.34-libbfd-fix.patch" - base_path: "source_subfolder/util/cairo-trace" + patch_type: "backport" + patch_description: "fix build with newer versions of bfd" + patch_source: "https://gitlab.freedesktop.org/cairo/cairo/-/commit/e30259f6237571c61992433c110bc6e1ef900244" + base_path: "util/cairo-trace" + - patch_file: "patches/cairo-1.17.4-trace-cflags-fix.patch" - base_path: "source_subfolder/util/cairo-trace" + patch_type: "conan" + patch_description: | + Add missing 'PACKAGE' and 'PACKAGE_VERSION' defines for libbfd headers included by 'lookup-symbol.c'. + base_path: "util/cairo-trace" + - patch_file: "patches/cairo-1.17.4-xlib-xrender-option.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: >- + This patch adds option to enable or disable xlib-xrender component. + Without it 'xrender' is always required when 'xlib' option is enabled. @sh0 + - patch_file: "patches/cairo-1.17.4-symbol-lookup-backport.patch" - base_path: "source_subfolder" + patch_type: "backport" + patch_description: "add symbol-lookup option to allow disabling bfd/libiberty usage" + patch_source: "https://gitlab.freedesktop.org/cairo/cairo/-/commit/e0cf7b869fb1c6b73cf4a9aad2fc8aea4ff1f6ee" + - patch_file: "patches/cairo-1.17.4-encoding-backport.patch" - base_path: "source_subfolder" + patch_type: "backport" + patch_description: "use encoding=utf-8 when reading/writing files in helper script" + patch_source: "https://gitlab.freedesktop.org/cairo/cairo/-/commit/9732f4e80f906fab85b97ae55ee44bfd3ee4945e" diff --git a/recipes/cairo/meson/conanfile.py b/recipes/cairo/meson/conanfile.py index ebff14e5fdea3b..3871b067363f24 100644 --- a/recipes/cairo/meson/conanfile.py +++ b/recipes/cairo/meson/conanfile.py @@ -1,13 +1,26 @@ -import contextlib import glob import os from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools import files, microsoft -from conans import tools, Meson, VisualStudioBuildEnvironment - -required_conan_version = ">=1.50.0" +from conan.tools.apple import is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + rename, + replace_in_file, + rm, + rmdir) +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import MesonToolchain, Meson +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class CairoConan(ConanFile): @@ -50,26 +63,17 @@ class CairoConan(ConanFile): "with_symbol_lookup": False, "tee": True, } - - generators = "pkg_config" - - _meson = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + short_paths = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") + def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): del self.settings.compiler.libcxx @@ -95,19 +99,19 @@ def configure(self): def requirements(self): self.requires("pixman/0.40.0") if self.options.with_zlib and self.options.with_png: - self.requires("expat/2.4.8") + self.requires("expat/2.4.9") if self.options.with_lzo: self.requires("lzo/2.10") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_freetype: self.requires("freetype/2.12.1") if self.options.with_fontconfig: self.requires("fontconfig/2.13.93") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.38") if self.options.with_glib: - self.requires("glib/2.73.3") + self.requires("glib/2.74.0") if self.settings.os == "Linux": if self.options.with_xlib or self.options.with_xlib_xrender or self.options.with_xcb: self.requires("xorg/system") @@ -121,15 +125,15 @@ def requirements(self): self.requires("egl/system") def build_requirements(self): - self.tool_requires("meson/0.63.1") - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("meson/0.63.3") + self.tool_requires("pkgconf/1.9.3") def validate(self): if self.options.get_safe("with_xlib_xrender") and not self.options.get_safe("with_xlib"): raise ConanInvalidConfiguration("'with_xlib_xrender' option requires 'with_xlib' option to be enabled as well!") if self.options.with_glib: if self.options["glib"].shared: - if microsoft.is_msvc_static_runtime(self): + if is_msvc_static_runtime(self): raise ConanInvalidConfiguration( "Linking shared glib with the MSVC static runtime is not supported" ) @@ -138,100 +142,93 @@ def validate(self): "Linking a shared library against static glib can cause unexpected behaviour." ) - @contextlib.contextmanager - def _build_context(self): - if microsoft.is_msvc(self): - env_build = VisualStudioBuildEnvironment(self) - if not self.options.shared: - env_build.flags.append("-DCAIRO_WIN32_STATIC_BUILD") - env_build.cxx_flags.append("-DCAIRO_WIN32_STATIC_BUILD") - with tools.environment_append(env_build.vars): - yield - else: - yield - - def source(self): - files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _configure_meson(self): - def boolean(value): + def generate(self): + def is_enabled(value): return "enabled" if value else "disabled" - meson = Meson(self) + pkg_deps = PkgConfigDeps(self) + pkg_deps.generate() - defs = dict() - defs["tests"] = "disabled" - defs["zlib"] = boolean(self.options.with_zlib) - defs["png"] = boolean(self.options.with_png) - defs["freetype"] = boolean(self.options.with_freetype) - defs["fontconfig"] = boolean(self.options.with_fontconfig) + options = dict() + options["tests"] = "disabled" + options["zlib"] = is_enabled(self.options.with_zlib) + options["png"] = is_enabled(self.options.with_png) + options["freetype"] = is_enabled(self.options.with_freetype) + options["fontconfig"] = is_enabled(self.options.with_fontconfig) if self.settings.os == "Linux": - defs["xcb"] = boolean(self.options.get_safe("with_xcb")) - defs["xlib"] = boolean(self.options.get_safe("with_xlib")) - defs["xlib-xrender"] = boolean(self.options.get_safe("with_xlib_xrender")) + options["xcb"] = is_enabled(self.options.with_xcb) + options["xlib"] = is_enabled(self.options.with_xlib) + options["xlib-xrender"] = is_enabled(self.options.with_xlib_xrender) else: - defs["xcb"] = "disabled" - defs["xlib"] = "disabled" + options["xcb"] = "disabled" + options["xlib"] = "disabled" if self.options.get_safe("with_opengl") == "desktop": - defs["gl-backend"] = "gl" + options["gl-backend"] = "gl" elif self.options.get_safe("with_opengl") == "gles2": - defs["gl-backend"] = "glesv2" + options["gl-backend"] = "glesv2" elif self.options.get_safe("with_opengl") == "gles3": - defs["gl-backend"] = "glesv3" + options["gl-backend"] = "glesv3" else: - defs["gl-backend"] = "disabled" - defs["glesv2"] = boolean(self.options.get_safe("with_opengl") == "gles2") - defs["glesv3"] = boolean(self.options.get_safe("with_opengl") == "gles3") - defs["tee"] = boolean(self.options.tee) - defs["symbol-lookup"] = boolean(self.options.get_safe("with_symbol_lookup")) + options["gl-backend"] = "disabled" + options["glesv2"] = is_enabled(self.options.get_safe("with_opengl") == "gles2") + options["glesv3"] = is_enabled(self.options.get_safe("with_opengl") == "gles3") + options["tee"] = is_enabled(self.options.tee) + options["symbol-lookup"] = is_enabled(self.options.get_safe("with_symbol_lookup")) # future options to add, see meson_options.txt. # for now, disabling explicitly, to avoid non-reproducible auto-detection of system libs - defs["cogl"] = "disabled" # https://gitlab.gnome.org/GNOME/cogl - defs["directfb"] = "disabled" - defs["drm"] = "disabled" # not yet compilable in cairo 1.17.4 - defs["openvg"] = "disabled" # https://www.khronos.org/openvg/ - defs["qt"] = "disabled" # not yet compilable in cairo 1.17.4 - defs["gtk2-utils"] = "disabled" - defs["spectre"] = "disabled" # https://www.freedesktop.org/wiki/Software/libspectre/ - - meson.configure( - source_folder=self._source_subfolder, - args=["--wrap-mode=nofallback"], - build_folder=self._build_subfolder, - defs=defs, - ) - return meson + options["cogl"] = "disabled" # https://gitlab.gnome.org/GNOME/cogl + options["directfb"] = "disabled" + options["drm"] = "disabled" # not yet compilable in cairo 1.17.4 + options["openvg"] = "disabled" # https://www.khronos.org/openvg/ + options["qt"] = "disabled" # not yet compilable in cairo 1.17.4 + options["gtk2-utils"] = "disabled" + options["spectre"] = "disabled" # https://www.freedesktop.org/wiki/Software/libspectre/ + + meson = MesonToolchain(self) + meson.project_options.update(options) + + if is_apple_os(self) and Version(self.version) < "1.17.6": + # This was fixed in the meson build from 1.17.6 + meson.c_link_args += ["-framework", "ApplicationServices", "-framework", "CoreFoundation"] + + if not self.options.shared: + meson.c_args.append("-DCAIRO_WIN32_STATIC_BUILD") + + meson.generate() + + env = VirtualBuildEnv(self) + env.generate() + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def build(self): - files.apply_conandata_patches(self) + apply_conandata_patches(self) # Dependency freetype2 found: NO found 2.11.0 but need: '>= 9.7.3' if self.options.with_freetype: - files.replace_in_file(self, "freetype2.pc", - f"Version: {self.deps_cpp_info['freetype'].version}", - "Version: 9.7.3") - with self._build_context(): - meson = self._configure_meson() - meson.build() - - def _fix_library_names(self): - if microsoft.is_msvc(self): - with tools.chdir(os.path.join(self.package_folder, "lib")): - for filename_old in glob.glob("*.a"): - filename_new = filename_old[3:-2] + ".lib" - self.output.info("rename %s into %s" % (filename_old, filename_new)) - files.rename(self, filename_old, filename_new) + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "freetype_required_version = '>= 9.7.3'", + f"freetype_required_version = '>= {self.deps_cpp_info['freetype'].version}'") + meson = Meson(self) + meson.configure() + meson.build() + + def _fix_library_names(self, path): + if is_msvc(self): + for filename_old in glob.glob(os.path.join(path, "*.a")): + root, _ = os.path.splitext(filename_old) + folder, basename = os.path.split(root) + rename(self, filename_old, os.path.join(folder, basename.replace("lib", "") + ".lib")) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("COPYING*", src=self._source_subfolder, dst="licenses", keep_path=False) - with self._build_context(): - meson = self._configure_meson() - meson.install() - self._fix_library_names() - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - files.rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + meson = Meson(self) + meson.install() + self._fix_library_names(os.path.join(self.package_folder, "lib")) + copy(self, "COPYING*", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): base_requirements = {"pixman::pixman"} @@ -290,7 +287,7 @@ def add_component_and_base_requirements(component, requirements, system_libs=Non if self.options.get_safe("with_xlib"): add_component_and_base_requirements("cairo-xlib-xcb", ["xorg::x11-xcb"]) - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["cairo-quartz"].set_property("pkg_config_name", "cairo-quartz") self.cpp_info.components["cairo-quartz"].names["pkg_config"] = "cairo-quartz" self.cpp_info.components["cairo-quartz"].requires = ["cairo_"] @@ -303,7 +300,7 @@ def add_component_and_base_requirements(component, requirements, system_libs=Non self.cpp_info.components["cairo-quartz-font"].names["pkg_config"] = "cairo-quartz-font" self.cpp_info.components["cairo-quartz-font"].requires = ["cairo_"] - self.cpp_info.components["cairo_"].frameworks.append("CoreGraphics") + self.cpp_info.components["cairo_"].frameworks += ["ApplicationServices", "CoreFoundation", "CoreGraphics"] if self.settings.os == "Windows": self.cpp_info.components["cairo-win32"].set_property("pkg_config_name", "cairo-win32") diff --git a/recipes/cairo/meson/test_package/CMakeLists.txt b/recipes/cairo/meson/test_package/CMakeLists.txt index f544bec65da1ef..4f33d55898eb29 100644 --- a/recipes/cairo/meson/test_package/CMakeLists.txt +++ b/recipes/cairo/meson/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1.2) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(cairo CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} cairo::cairo) +target_link_libraries(${PROJECT_NAME} PRIVATE cairo::cairo) diff --git a/recipes/cairo/meson/test_package/conanfile.py b/recipes/cairo/meson/test_package/conanfile.py index 24f9e474d6cd2d..e904c93b97465a 100644 --- a/recipes/cairo/meson/test_package/conanfile.py +++ b/recipes/cairo/meson/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cairo/meson/test_v1_package/CMakeLists.txt b/recipes/cairo/meson/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..692a4909c85a77 --- /dev/null +++ b/recipes/cairo/meson/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1.2) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cairo/meson/test_v1_package/conanfile.py b/recipes/cairo/meson/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..24f9e474d6cd2d --- /dev/null +++ b/recipes/cairo/meson/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + From 10220974bc10a0f579346f559247ef3539645ad5 Mon Sep 17 00:00:00 2001 From: fdgStilla <79465612+fdgStilla@users.noreply.github.com> Date: Fri, 28 Oct 2022 19:47:18 +0200 Subject: [PATCH 232/300] (#13717) [anyrpc] Add new recipe * Create anyRPC from cmake template * Customize template for anyrpc * log4cplus not compatible with wchar option * Fix shared compilation option * Link consumer to ws2_32 * Fix shared compilation on windows * Fix test_v1_package source location * Fix pylint * Fix asan by backporting a fix from the repo * Add pthread on linux * The package requires at least c++11 * Clean template comment * Trigger CI * Revert "Trigger CI" This reverts commit bf8211436dc0b5cc28cc4904b7bce07ee27762dc. * Review: Prefer features based on cmake targets * Review: Try to exercise some method to validate runtime linkage. * Review: Use self.info.options * Review: simplify test_v1_package * Review: try/catch when deleting fpic in configure * Review: link system libm * Review: combine if statements --- recipes/anyrpc/all/conandata.yml | 17 +++ recipes/anyrpc/all/conanfile.py | 127 ++++++++++++++++++ .../all/patches/0001-fix-asan-1.0.2.patch | 28 ++++ .../0002-fix-shared-library-1.0.2.patch | 54 ++++++++ .../patches/0003-use-conan-libs-1.0.2.patch | 44 ++++++ .../anyrpc/all/test_package/CMakeLists.txt | 9 ++ recipes/anyrpc/all/test_package/conanfile.py | 26 ++++ .../anyrpc/all/test_package/test_anyrpc.cpp | 17 +++ .../anyrpc/all/test_v1_package/CMakeLists.txt | 6 + .../anyrpc/all/test_v1_package/conanfile.py | 18 +++ recipes/anyrpc/config.yml | 3 + 11 files changed, 349 insertions(+) create mode 100644 recipes/anyrpc/all/conandata.yml create mode 100644 recipes/anyrpc/all/conanfile.py create mode 100644 recipes/anyrpc/all/patches/0001-fix-asan-1.0.2.patch create mode 100644 recipes/anyrpc/all/patches/0002-fix-shared-library-1.0.2.patch create mode 100644 recipes/anyrpc/all/patches/0003-use-conan-libs-1.0.2.patch create mode 100644 recipes/anyrpc/all/test_package/CMakeLists.txt create mode 100644 recipes/anyrpc/all/test_package/conanfile.py create mode 100644 recipes/anyrpc/all/test_package/test_anyrpc.cpp create mode 100644 recipes/anyrpc/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/anyrpc/all/test_v1_package/conanfile.py create mode 100644 recipes/anyrpc/config.yml diff --git a/recipes/anyrpc/all/conandata.yml b/recipes/anyrpc/all/conandata.yml new file mode 100644 index 00000000000000..26dc592b0ce1b4 --- /dev/null +++ b/recipes/anyrpc/all/conandata.yml @@ -0,0 +1,17 @@ +sources: + "1.0.2": + url: "https://github.com/sgieseking/anyrpc/archive/refs/tags/v1.0.2.tar.gz" + sha256: "236c9fa0ba417af945d950866c9671a1efa06506af8c86efa2e89ab67607969f" +patches: + "1.0.2": + - patch_file: "patches/0001-fix-asan-1.0.2.patch" + patch_description: "Handle ASAN flag properly in CMakeLists.txt" + patch_type: backport + patch_source: "https://github.com/sgieseking/anyrpc/pull/42" + - patch_file: "patches/0002-fix-shared-library-1.0.2.patch" + patch_description: "Fixed 'undefined reference' error when compile for windows platform" + patch_type: backport + patch_source: "https://github.com/sgieseking/anyrpc/pull/43" + - patch_file: "patches/0003-use-conan-libs-1.0.2.patch" + patch_description: "Link to conan libs" + patch_type: "conan" diff --git a/recipes/anyrpc/all/conanfile.py b/recipes/anyrpc/all/conanfile.py new file mode 100644 index 00000000000000..79bf90cb74d724 --- /dev/null +++ b/recipes/anyrpc/all/conanfile.py @@ -0,0 +1,127 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.52.0" + + +class AnyRPCConan(ConanFile): + name = "anyrpc" + description = "A multiprotocol remote procedure call system for C++" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/sgieseking/anyrpc" + topics = ("rpc") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_log4cplus": [True, False], + "with_threading": [True, False], + "with_regex": [True, False], + "with_wchar": [True, False], + "with_protocol_json": [True, False], + "with_protocol_xml": [True, False], + "with_protocol_messagepack": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_log4cplus": False, + "with_threading": True, + "with_wchar": True, + "with_regex": True, + "with_protocol_json": True, + "with_protocol_xml": True, + "with_protocol_messagepack": True, + } + + @property + def _minimum_cpp_standard(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_log4cplus: + self.requires("log4cplus/2.0.7") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + if self.info.options.with_log4cplus and self.info.options.with_wchar: + raise ConanInvalidConfiguration(f"{self.ref} can not be built with both log4cplus and wchar, see https://github.com/sgieseking/anyrpc/issues/25") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ANYRPC_LIB_BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_TEST"] = False + tc.variables["BUILD_WITH_ADDRESS_SANITIZE"] = False + + tc.variables["BUILD_WITH_LOG4CPLUS"] = self.options.with_log4cplus + tc.variables["BUILD_WITH_THREADING"] = self.options.with_threading + tc.variables["BUILD_WITH_REGEX"] = self.options.with_regex + tc.variables["BUILD_WITH_WCHAR"] = self.options.with_wchar + + tc.variables["BUILD_PROTOCOL_JSON"] = self.options.with_protocol_json + tc.variables["BUILD_PROTOCOL_XML"] = self.options.with_protocol_xml + tc.variables["BUILD_PROTOCOL_MESSAGEPACK"] = self.options.with_protocol_messagepack + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="license", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.libs = ["anyrpc"] + + if not self.options.shared and self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/anyrpc/all/patches/0001-fix-asan-1.0.2.patch b/recipes/anyrpc/all/patches/0001-fix-asan-1.0.2.patch new file mode 100644 index 00000000000000..23a8dc94863a2f --- /dev/null +++ b/recipes/anyrpc/all/patches/0001-fix-asan-1.0.2.patch @@ -0,0 +1,28 @@ +From 74b4fbb92b654a9483ef3ff64b708fda46bd7b2b Mon Sep 17 00:00:00 2001 +From: Falko Axmann +Date: Sun, 12 Jan 2020 12:43:00 +0100 +Subject: [PATCH] Handle ASAN flag properly in CMakeLists.txt + +Because of a typo ("else" instead of "elseif"), the +BUILD_WITH_ADDRESS_SANITIZE option was ignored and on +Linux, anyrpc would always be built with ASAN enabled. +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cfeb604..87991bb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,7 +63,7 @@ if (MSVC) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" ) + elseif (MINGW) + SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U__STRICT_ANSI__" ) +-else (BUILD_WITH_ADDRESS_SANITIZE) ++elseif (BUILD_WITH_ADDRESS_SANITIZE) + SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer" ) + SET( ASAN_LIBRARY asan ) + endif () +-- +2.36.1.windows.1 + diff --git a/recipes/anyrpc/all/patches/0002-fix-shared-library-1.0.2.patch b/recipes/anyrpc/all/patches/0002-fix-shared-library-1.0.2.patch new file mode 100644 index 00000000000000..bb861d675230e0 --- /dev/null +++ b/recipes/anyrpc/all/patches/0002-fix-shared-library-1.0.2.patch @@ -0,0 +1,54 @@ +From c8ece5d572bf68a7d0f63405089a7a8d7d6206ee Mon Sep 17 00:00:00 2001 +From: "email@email.com" +Date: Fri, 31 Jul 2020 15:37:29 +0300 +Subject: [PATCH] fixed 'undefined reference' error when compile for windows + platform + +--- + include/anyrpc/json/jsonserver.h | 2 +- + include/anyrpc/messagepack/messagepackserver.h | 2 +- + include/anyrpc/xml/xmlserver.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/anyrpc/json/jsonserver.h b/include/anyrpc/json/jsonserver.h +index d883b16..000bbd4 100644 +--- a/include/anyrpc/json/jsonserver.h ++++ b/include/anyrpc/json/jsonserver.h +@@ -24,7 +24,7 @@ + namespace anyrpc + { + +-bool JsonRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); ++ANYRPC_API bool JsonRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); + + //////////////////////////////////////////////////////////////////////////////// + +diff --git a/include/anyrpc/messagepack/messagepackserver.h b/include/anyrpc/messagepack/messagepackserver.h +index cc708f8..708bd72 100644 +--- a/include/anyrpc/messagepack/messagepackserver.h ++++ b/include/anyrpc/messagepack/messagepackserver.h +@@ -24,7 +24,7 @@ + namespace anyrpc + { + +-bool MessagePackRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); ++ANYRPC_API bool MessagePackRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); + + //////////////////////////////////////////////////////////////////////////////// + +diff --git a/include/anyrpc/xml/xmlserver.h b/include/anyrpc/xml/xmlserver.h +index 5350ca5..fe0ed23 100644 +--- a/include/anyrpc/xml/xmlserver.h ++++ b/include/anyrpc/xml/xmlserver.h +@@ -24,7 +24,7 @@ + namespace anyrpc + { + +-bool XmlRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); ++ANYRPC_API bool XmlRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); + + //////////////////////////////////////////////////////////////////////////////// + +-- +2.36.1.windows.1 + diff --git a/recipes/anyrpc/all/patches/0003-use-conan-libs-1.0.2.patch b/recipes/anyrpc/all/patches/0003-use-conan-libs-1.0.2.patch new file mode 100644 index 00000000000000..b1c4f4b1d7f2eb --- /dev/null +++ b/recipes/anyrpc/all/patches/0003-use-conan-libs-1.0.2.patch @@ -0,0 +1,44 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 2.8) + + Project(AnyRPC CXX) + +-# Some of the cmake find_package files are part of this distribution +-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +- + # Read out version from "version" file + file(STRINGS "version" ANYRPC_VERSION_FILE) + +@@ -91,7 +88,7 @@ CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/version.h.in" + "${PROJECT_SOURCE_DIR}/include/anyrpc/version.h" ) + + if (BUILD_WITH_LOG4CPLUS) +- find_package( Log4cplus ) +- if (NOT LOG4CPLUS_FOUND) ++ find_package( log4cplus ) ++ if (NOT log4cplus_FOUND) + # the find_package call for Log4cplus doesn't generate an error even if marked as required + message( FATAL_ERROR "LOG4CPLUS library required if BUILD_WITH_LOG4CPLUS on" ) + +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -44,15 +44,15 @@ set(ANYRPC_HEADERS ${ANYRPC_HEADERS} ${ANYRPC_INTERNAL_HEADERS} + + # Add the necessary external library references + if (BUILD_WITH_LOG4CPLUS) +- include_directories(${LOG4CPLUS_INCLUDE_DIRS}) ++ set( LOG4CPLUS_TARGET "log4cplus::log4cplus" ) + add_definitions( -DBUILD_WITH_LOG4CPLUS ) + else () +- set( LOG4CPLUS_LIBRARIES "" ) ++ set( LOG4CPLUS_TARGET "" ) + endif () + + # Create the libraries with these header and source files + add_library( anyrpc ${ANYRPC_LIB_TYPE} ${ANYRPC_SOURCES} ${ANYRPC_HEADERS} ) +-target_link_libraries( anyrpc ${ASAN_LIBRARY} ${LOG4CPLUS_LIBRARIES}) ++target_link_libraries( anyrpc ${ASAN_LIBRARY} ${LOG4CPLUS_TARGET}) + + # Need the winsock library for Windows + if (WIN32) diff --git a/recipes/anyrpc/all/test_package/CMakeLists.txt b/recipes/anyrpc/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..f9c6894d75a0fd --- /dev/null +++ b/recipes/anyrpc/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_anyrpc CXX) + +find_package(anyrpc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_anyrpc.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE anyrpc::anyrpc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/anyrpc/all/test_package/conanfile.py b/recipes/anyrpc/all/test_package/conanfile.py new file mode 100644 index 00000000000000..7f2b358ed020e9 --- /dev/null +++ b/recipes/anyrpc/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestAnyRpcConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_anyrpc") + self.run(bin_path, env="conanrun") diff --git a/recipes/anyrpc/all/test_package/test_anyrpc.cpp b/recipes/anyrpc/all/test_package/test_anyrpc.cpp new file mode 100644 index 00000000000000..3a1af31f88b40c --- /dev/null +++ b/recipes/anyrpc/all/test_package/test_anyrpc.cpp @@ -0,0 +1,17 @@ +#include +#include + +#include "anyrpc/anyrpc.h" + +void testFunc(anyrpc::Value& params, anyrpc::Value& result) +{ +} + +int main(void) +{ + anyrpc::JsonHttpServer server; + anyrpc::MethodManager* methodManager = server.GetMethodManager(); + methodManager->AddFunction(&testFunc, "testFunc", "Test function"); + + return EXIT_SUCCESS; +} diff --git a/recipes/anyrpc/all/test_v1_package/CMakeLists.txt b/recipes/anyrpc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..8272097b5b3da0 --- /dev/null +++ b/recipes/anyrpc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/anyrpc/all/test_v1_package/conanfile.py b/recipes/anyrpc/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..e946eccc88b511 --- /dev/null +++ b/recipes/anyrpc/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestAnyRpcV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_anyrpc") + self.run(bin_path, run_environment=True) diff --git a/recipes/anyrpc/config.yml b/recipes/anyrpc/config.yml new file mode 100644 index 00000000000000..8457ca9a4a8cd8 --- /dev/null +++ b/recipes/anyrpc/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.2": + folder: all From 7873e934ab2772344fc714f398547da355462876 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 28 Oct 2022 20:22:23 +0200 Subject: [PATCH 233/300] (#13806) xorstr: conan v2 support --- recipes/xorstr/all/conanfile.py | 56 ++++++++++++------- .../xorstr/all/test_package/CMakeLists.txt | 9 ++- recipes/xorstr/all/test_package/conanfile.py | 19 +++++-- .../xorstr/all/test_v1_package/CMakeLists.txt | 8 +++ .../xorstr/all/test_v1_package/conanfile.py | 17 ++++++ 5 files changed, 78 insertions(+), 31 deletions(-) create mode 100644 recipes/xorstr/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/xorstr/all/test_v1_package/conanfile.py diff --git a/recipes/xorstr/all/conanfile.py b/recipes/xorstr/all/conanfile.py index 069c03de54d913..2712a05ac70441 100644 --- a/recipes/xorstr/all/conanfile.py +++ b/recipes/xorstr/all/conanfile.py @@ -1,56 +1,70 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class XorstrConan(ConanFile): name = "xorstr" description = "A heavily vectorized c++17 compile time string encryption." license = "Apache-2.0" - topics = ("conan", "xorstr", "encryption", "string", "vectorized") + topics = ("encryption", "string", "vectorized") homepage = "https://github.com/JustasMasiulis/xorstr" url = "https://github.com/conan-io/conan-center-index" no_copy_source = True - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property def _compilers_minimum_version(self): return { "Visual Studio": "16", + "msvc": "192", "gcc": "7", "clang": "5.0", - "apple-clang": "9.1" + "apple-clang": "9.1", } + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) - def lazy_lt_semver(v1, v2): + def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("{} {} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name, self.version)) - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("{} {} requires C++17, which your compiler does not support.".format(self.name, self.version)) - - def package_id(self): - self.info.header_only() + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/xorstr/all/test_package/CMakeLists.txt b/recipes/xorstr/all/test_package/CMakeLists.txt index 0029db0945c647..b2faa1d5c02ce8 100644 --- a/recipes/xorstr/all/test_package/CMakeLists.txt +++ b/recipes/xorstr/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(xorstr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE xorstr::xorstr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/xorstr/all/test_package/conanfile.py b/recipes/xorstr/all/test_package/conanfile.py index 5216332f39f5ca..0a6bc68712d901 100644 --- a/recipes/xorstr/all/test_package/conanfile.py +++ b/recipes/xorstr/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xorstr/all/test_v1_package/CMakeLists.txt b/recipes/xorstr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/xorstr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xorstr/all/test_v1_package/conanfile.py b/recipes/xorstr/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/xorstr/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 396043736244edec0dd211b14b67a7f95899e536 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 28 Oct 2022 20:45:36 +0200 Subject: [PATCH 234/300] (#13817) grpc: more conan v2 stuff + bump zlib * more conan v2 stuff - use conan.tools.files.copy instead of self.copy - no more usage of msvc_version_to_vs_ide_version, it's not part of conan public API. Use check_min_vs instead. - access to dependencies options through self.dependencies * bump zlib * add empty layout for the moment * add missing exception type --- recipes/grpc/all/conanfile.py | 69 ++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/recipes/grpc/all/conanfile.py b/recipes/grpc/all/conanfile.py index 11b78891b33dc7..6fecfa05f80937 100644 --- a/recipes/grpc/all/conanfile.py +++ b/recipes/grpc/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os -from conan.tools.microsoft import visual, is_msvc from conan.tools.build import cross_building, valid_min_cppstd, check_min_cppstd -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, rename, replace_in_file +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc from conan.tools.scm import Version -from conan.errors import ConanInvalidConfiguration from conans import CMake import os import shutil @@ -72,8 +72,8 @@ def _cxxstd_required(self): return 14 if Version(self.version) >= "1.47" else 11 def export_sources(self): - self.copy("CMakeLists.txt") - self.copy(os.path.join("cmake", self._grpc_plugin_template)) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + copy(self, f"cmake/{self._grpc_plugin_template}", self.recipe_folder, self.export_sources_folder) export_conandata_patches(self) def config_options(self): @@ -82,11 +82,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass self.options["protobuf"].shared = True self.options["googleapis"].shared = True self.options["grpc-proto"].shared = True + def layout(self): + pass + def requirements(self): if is_msvc(self) and Version(self.version) < "1.47": self.requires("abseil/20211102.0") @@ -95,35 +101,32 @@ def requirements(self): self.requires("c-ares/1.18.1") self.requires("openssl/1.1.1q") self.requires("re2/20220601") - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") self.requires("protobuf/3.21.4") self.requires("googleapis/cci.20220711") self.requires("grpc-proto/cci.20220627") + def package_id(self): + del self.info.options.secure + self.info.requires["protobuf"].full_package_mode() + def validate(self): - if is_msvc(self): - if self.settings.compiler == "Visual Studio": - vs_ide_version = self.settings.compiler.version - else: - vs_ide_version = visual.msvc_version_to_vs_ide_version(self.settings.compiler.version) - if Version(vs_ide_version) < "14": - raise ConanInvalidConfiguration("gRPC can only be built with Visual Studio 2015 or higher.") - - if self.options.shared: - raise ConanInvalidConfiguration("gRPC shared not supported yet with Visual Studio") - - if Version(self.version) >= "1.47" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": + check_min_vs(self, "190") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") + + if Version(self.version) >= "1.47" and self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "6": raise ConanInvalidConfiguration("GCC older than 6 is not supported") - if self.settings.compiler.get_safe("cppstd"): + if self.info.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._cxxstd_required) - if self.options.shared and (not self.options["protobuf"].shared or not self.options["googleapis"].shared or not self.options["grpc-proto"].shared): - raise ConanInvalidConfiguration("If built as shared, protobuf, googleapis and grpc-proto must be shared as well. Please, use `protobuf:shared=True` and `googleapis:shared=True` and `grpc-proto:shared=True`") - - def package_id(self): - del self.info.options.secure - self.info.requires["protobuf"].full_package_mode() + if self.info.options.shared and \ + (not self.dependencies["protobuf"].options.shared or not self.dependencies["googleapis"].options.shared or not self.dependencies["grpc-proto"].options.shared): + raise ConanInvalidConfiguration( + "If built as shared, protobuf, googleapis and grpc-proto must be shared as well. " + "Please, use `protobuf:shared=True` and `googleapis:shared=True` and `grpc-proto:shared=True`", + ) def build_requirements(self): if hasattr(self, "settings_build"): @@ -217,7 +220,7 @@ def build(self): cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=os.path.join(self.source_folder, self._source_subfolder), dst=os.path.join(self.package_folder, "licenses")) cmake = self._configure_cmake() cmake.install() @@ -266,15 +269,14 @@ def _grpc_plugins(self): } def _create_executable_module_file(self, target, executable): + module_abs_path = os.path.join(self.package_folder, self._module_path) + # Copy our CMake module template file to package folder - self.copy(self._grpc_plugin_template, dst=self._module_path, - src=os.path.join(self.source_folder, "cmake")) + copy(self, self._grpc_plugin_template, src=os.path.join(self.source_folder, "cmake"), dst=module_abs_path) # Rename it - dst_file = os.path.join(self.package_folder, self._module_path, - "{}.cmake".format(executable)) - rename(self, os.path.join(self.package_folder, self._module_path, self._grpc_plugin_template), - dst_file) + dst_file = os.path.join(module_abs_path, f"{executable}.cmake") + rename(self, os.path.join(module_abs_path, self._grpc_plugin_template), dst_file) # Replace placeholders replace_in_file(self, dst_file, "@target_name@", target) @@ -402,6 +404,7 @@ def corefoundation(): def package_info(self): self.cpp_info.set_property("cmake_file_name", "gRPC") + self.cpp_info.resdirs = ["res"] ssl_roots_file_path = os.path.join(self.package_folder, "res", "grpc", "roots.pem") self.runenv_info.define_path("GRPC_DEFAULT_SSL_ROOTS_FILE_PATH", ssl_roots_file_path) self.env_info.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH = ssl_roots_file_path # remove in conan v2? From 3ae55defdee1fb853beb956f68b81c808d1bab1d Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Fri, 28 Oct 2022 21:05:01 +0200 Subject: [PATCH 235/300] (#13822) freetype: bump zlib + always define `FREETYPE_FOUND` CMake variable + define `user.freetype:libtool_version` config * bump zlib * reorder methods * define `user.freetype:libtool_version` config * always set FREETYPE_FOUND to TRUE * test CMake variables as well as Find module & config files --- recipes/freetype/all/conanfile.py | 40 ++++++++----------- .../freetype/all/test_package/CMakeLists.txt | 4 +- .../all/test_package_module/CMakeLists.txt | 23 +++++++++++ .../all/test_package_module/conanfile.py | 27 +++++++++++++ .../all/test_v1_package/CMakeLists.txt | 8 ++-- .../freetype/all/test_v1_package/conanfile.py | 6 +-- .../all/test_v1_package_module/CMakeLists.txt | 8 ++++ .../all/test_v1_package_module/conanfile.py | 18 +++++++++ 8 files changed, 100 insertions(+), 34 deletions(-) create mode 100644 recipes/freetype/all/test_package_module/CMakeLists.txt create mode 100644 recipes/freetype/all/test_package_module/conanfile.py create mode 100644 recipes/freetype/all/test_v1_package_module/CMakeLists.txt create mode 100644 recipes/freetype/all/test_v1_package_module/conanfile.py diff --git a/recipes/freetype/all/conanfile.py b/recipes/freetype/all/conanfile.py index 4138e31ca1536a..2d2959fc43fd9e 100644 --- a/recipes/freetype/all/conanfile.py +++ b/recipes/freetype/all/conanfile.py @@ -62,18 +62,22 @@ def configure(self): except Exception: pass + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.with_png: self.requires("libpng/1.6.38") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.get_safe("with_brotli"): self.requires("brotli/1.0.9") - def layout(self): - cmake_layout(self, src_folder="src") + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def generate(self): deps = CMakeDeps(self) @@ -105,10 +109,6 @@ def generate(self): cmake.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" cmake.generate() - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) - def _patch_sources(self): # Do not accidentally enable dependencies we have disabled cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") @@ -207,9 +207,7 @@ def package(self): def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ - if(DEFINED Freetype_FOUND) - set(FREETYPE_FOUND ${Freetype_FOUND}) - endif() + set(FREETYPE_FOUND TRUE) if(DEFINED Freetype_INCLUDE_DIRS) set(FREETYPE_INCLUDE_DIRS ${Freetype_INCLUDE_DIRS}) endif() @@ -233,19 +231,13 @@ def _create_cmake_module_alias_targets(self, module_file, targets): """.format(alias=alias, aliased=aliased)) save(self, module_file, content) - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") - @property def _module_vars_rel_path(self): - return os.path.join(self._module_subfolder, - f"conan-official-{self.name}-variables.cmake") + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") @property def _module_target_rel_path(self): - return os.path.join(self._module_subfolder, - f"conan-official-{self.name}-targets.cmake") + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @staticmethod def _chmod_plus_x(filename): @@ -258,20 +250,15 @@ def package_info(self): self.cpp_info.set_property("cmake_module_target_name", "Freetype::Freetype") self.cpp_info.set_property("cmake_file_name", "freetype") self.cpp_info.set_property("cmake_target_name", "freetype") - self.cpp_info.builddirs.append(self._module_subfolder) self.cpp_info.set_property("cmake_build_modules", [self._module_vars_rel_path]) self.cpp_info.set_property("pkg_config_name", "freetype2") self.cpp_info.libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") self.cpp_info.includedirs.append(os.path.join("include", "freetype2")) - freetype_config = os.path.join(self.package_folder, "bin", "freetype-config") - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) - self.env_info.FT2_CONFIG = freetype_config - self._chmod_plus_x(freetype_config) libtool_version = load(self, self._libtool_version_txt).strip() - self.user_info.LIBTOOL_VERSION = libtool_version + self.conf_info.define("user.freetype:libtool_version", libtool_version) # FIXME: need to do override the pkg_config version (pkg_config_custom_content does not work) # self.cpp_info.version["pkg_config"] = pkg_config_version @@ -283,3 +270,8 @@ def package_info(self): self.cpp_info.build_modules["cmake_find_package"] = [self._module_vars_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_target_rel_path] self.cpp_info.names["pkg_config"] = "freetype2" + freetype_config = os.path.join(self.package_folder, "bin", "freetype-config") + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.FT2_CONFIG = freetype_config + self._chmod_plus_x(freetype_config) + self.user_info.LIBTOOL_VERSION = libtool_version diff --git a/recipes/freetype/all/test_package/CMakeLists.txt b/recipes/freetype/all/test_package/CMakeLists.txt index d0f6e7db35f58e..9ac9bd88e8a632 100644 --- a/recipes/freetype/all/test_package/CMakeLists.txt +++ b/recipes/freetype/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -find_package(Freetype CONFIG REQUIRED) +find_package(freetype REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE freetype) diff --git a/recipes/freetype/all/test_package_module/CMakeLists.txt b/recipes/freetype/all/test_package_module/CMakeLists.txt new file mode 100644 index 00000000000000..3a9f9ffa7c6301 --- /dev/null +++ b/recipes/freetype/all/test_package_module/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Freetype REQUIRED MODULE) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Freetype::Freetype) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindFreetype.html +# are properly defined in conan generators +set(_custom_vars + FREETYPE_FOUND + FREETYPE_INCLUDE_DIRS + FREETYPE_LIBRARIES + FREETYPE_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/freetype/all/test_package_module/conanfile.py b/recipes/freetype/all/test_package_module/conanfile.py new file mode 100644 index 00000000000000..e789c017730b37 --- /dev/null +++ b/recipes/freetype/all/test_package_module/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + font_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {font_path}", env="conanrun") diff --git a/recipes/freetype/all/test_v1_package/CMakeLists.txt b/recipes/freetype/all/test_v1_package/CMakeLists.txt index 29099563ff9fb7..0d20897301b68b 100644 --- a/recipes/freetype/all/test_v1_package/CMakeLists.txt +++ b/recipes/freetype/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Freetype REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE Freetype::Freetype) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/freetype/all/test_v1_package/conanfile.py b/recipes/freetype/all/test_v1_package/conanfile.py index aed73943409ce6..da2d908b1d4a7b 100644 --- a/recipes/freetype/all/test_v1_package/conanfile.py +++ b/recipes/freetype/all/test_v1_package/conanfile.py @@ -3,8 +3,8 @@ 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) @@ -14,5 +14,5 @@ def build(self): def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") - font_path = os.path.join(self.source_folder, "..", "test_package", "OpenSans-Bold.ttf") + font_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") self.run(f"{bin_path} {font_path}", run_environment=True) diff --git a/recipes/freetype/all/test_v1_package_module/CMakeLists.txt b/recipes/freetype/all/test_v1_package_module/CMakeLists.txt new file mode 100644 index 00000000000000..27f7a57e7a0b3e --- /dev/null +++ b/recipes/freetype/all/test_v1_package_module/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package_module + ${CMAKE_CURRENT_BINARY_DIR}/test_package_module) diff --git a/recipes/freetype/all/test_v1_package_module/conanfile.py b/recipes/freetype/all/test_v1_package_module/conanfile.py new file mode 100644 index 00000000000000..78343583655411 --- /dev/null +++ b/recipes/freetype/all/test_v1_package_module/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + font_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {font_path}", run_environment=True) From d424a44c965d2fd0382c6a1e9eb82ea8e237b2f0 Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 29 Oct 2022 04:46:19 +0900 Subject: [PATCH 236/300] (#13840) jsonnet: add version 0.19.1 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/jsonnet/all/conandata.yml | 8 ++++++++ recipes/jsonnet/config.yml | 2 ++ 2 files changed, 10 insertions(+) diff --git a/recipes/jsonnet/all/conandata.yml b/recipes/jsonnet/all/conandata.yml index 107abd3b3d8242..af6fab5053143a 100644 --- a/recipes/jsonnet/all/conandata.yml +++ b/recipes/jsonnet/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.19.1": + url: "https://github.com/google/jsonnet/archive/v0.19.1.tar.gz" + sha256: "f5a20f2dc98fdebd5d42a45365f52fa59a7e6b174e43970fea4f9718a914e887" "0.18.0": url: "https://github.com/google/jsonnet/archive/v0.18.0.tar.gz" sha256: "85c240c4740f0c788c4d49f9c9c0942f5a2d1c2ae58b2c71068107bc80a3ced4" @@ -6,6 +9,11 @@ sources: url: "https://github.com/google/jsonnet/archive/v0.17.0.tar.gz" sha256: "076b52edf888c01097010ad4299e3b2e7a72b60a41abbc65af364af1ed3c8dbe" patches: + "0.19.1": + - patch_file: "patches/0.18.0/0001-fix-nlohmann-include.patch" + base_path: "source_subfolder" + - patch_file: "patches/0.18.0/0002-cmake-fixes.patch" + base_path: "source_subfolder" "0.18.0": - patch_file: "patches/0.18.0/0001-fix-nlohmann-include.patch" base_path: "source_subfolder" diff --git a/recipes/jsonnet/config.yml b/recipes/jsonnet/config.yml index 5bf98d20ca9eb8..d98d76db4349a2 100644 --- a/recipes/jsonnet/config.yml +++ b/recipes/jsonnet/config.yml @@ -1,4 +1,6 @@ versions: + "0.19.1": + folder: all "0.18.0": folder: all "0.17.0": From 27c45b6c5f5f3473558c8cfdb119e9890f63f6f8 Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 29 Oct 2022 05:05:49 +0900 Subject: [PATCH 237/300] (#13842) highway: add version 1.0.2 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/highway/all/conandata.yml | 3 +++ recipes/highway/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/highway/all/conandata.yml b/recipes/highway/all/conandata.yml index c9671c15c90e36..08bd07626134af 100644 --- a/recipes/highway/all/conandata.yml +++ b/recipes/highway/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.2": + url: "https://github.com/google/highway/archive/1.0.2.tar.gz" + sha256: "e8ef71236ac0d97f12d553ec1ffc5b6375d57b5f0b860c7447dd69b6ed1072db" "1.0.1": url: "https://github.com/google/highway/archive/1.0.1.tar.gz" sha256: "7ca6af7dc2e3e054de9e17b9dfd88609a7fd202812b1c216f43cc41647c97311" diff --git a/recipes/highway/config.yml b/recipes/highway/config.yml index eb41394c69dcd1..a34a1de737c39c 100644 --- a/recipes/highway/config.yml +++ b/recipes/highway/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.2": + folder: all "1.0.1": folder: all "1.0.0": From 2161857ff4b9e5af14332e0a2168126646d4ce46 Mon Sep 17 00:00:00 2001 From: xiss burg Date: Fri, 28 Oct 2022 16:25:50 -0500 Subject: [PATCH 238/300] (#13562) Edyn 1.2.0 * Edyn 1.2.0 * Create separate versions for Edyn. * Fix Edyn version * Conan 2.0 migration and other fixes * Select EnTT version. * Update sha256 * New line at end of file * Use files package. * Omit building examples and pass option for using doubles Update test_package conanfile with further Conan 2.0 changes * Add test_v1_package * New line at end of file * Do not skip pylint * Attempt to add missing includes. * Attempt to add missing includes in test package v1. * Import tools one level further Remove unnecessary properties * Remove unnecessary CMakeLists * Change src folder * Use check_min_vs for Visual Studio version checking * [docs] Regenerate tables of contents * Block failing config * Add build/bin path to v2 test * Reorder methods in accordance to template Remove libstdc++11 from validate condition as libstdc++ also causes the same issue * Version v1.2.1 * Point to new release. * del fPIC on Windows * Fix pdb deletion * Fix pdb deletion, for realsies this time * Remove blocking of gcc11-release-shared as it should be fixed upstream Co-authored-by: Raziel Alphadios Co-authored-by: xissburg --- recipes/edyn/all/CMakeLists.txt | 7 -- recipes/edyn/all/conandata.yml | 6 +- recipes/edyn/all/conanfile.py | 103 +++++++++--------- recipes/edyn/all/test_package/CMakeLists.txt | 9 +- recipes/edyn/all/test_package/conanfile.py | 20 +++- .../edyn/all/test_v1_package/CMakeLists.txt | 12 ++ recipes/edyn/all/test_v1_package/conanfile.py | 17 +++ .../edyn/all/test_v1_package/test_package.cpp | 11 ++ recipes/edyn/config.yml | 2 +- 9 files changed, 110 insertions(+), 77 deletions(-) delete mode 100644 recipes/edyn/all/CMakeLists.txt create mode 100644 recipes/edyn/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/edyn/all/test_v1_package/conanfile.py create mode 100644 recipes/edyn/all/test_v1_package/test_package.cpp diff --git a/recipes/edyn/all/CMakeLists.txt b/recipes/edyn/all/CMakeLists.txt deleted file mode 100644 index 05ca2858f3f12e..00000000000000 --- a/recipes/edyn/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/edyn/all/conandata.yml b/recipes/edyn/all/conandata.yml index f6b51ad6e6f7c8..4f8e161949ad22 100644 --- a/recipes/edyn/all/conandata.yml +++ b/recipes/edyn/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.0.0": - url: "https://github.com/xissburg/edyn/archive/refs/tags/v1.0.0.tar.gz" - sha256: "171ec6dd9fd6dae2b79a45496e1c0322a0b10badc801f921280fe78454f58928" + "1.2.1": + url: "https://github.com/xissburg/edyn/archive/refs/tags/v1.2.1.tar.gz" + sha256: "d088dac1bebed65cd342c76f27661fbb557b95f959a67137f4df1000d9698b13" diff --git a/recipes/edyn/all/conanfile.py b/recipes/edyn/all/conanfile.py index 0461ba3ef69ff5..9e0c289bac7895 100644 --- a/recipes/edyn/all/conanfile.py +++ b/recipes/edyn/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.files import rmdir, rm, copy, get, collect_libs +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import cmake_layout +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.50.0" class EdynConan(ConanFile): name = "edyn" @@ -13,7 +18,7 @@ class EdynConan(ConanFile): homepage = "https://github.com/xissburg/edyn" topics = ("physics", "game-development", "ecs") settings = "os", "arch", "compiler", "build_type" - + options = { "shared": [True, False], "fPIC": [True, False], @@ -24,20 +29,14 @@ class EdynConan(ConanFile): "fPIC": True, "floating_type": "float", } - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" @property - def _build_subfolder(self): - return "build_subfolder" - - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + def _compiler_required(self): + return { + "gcc": "9.3", # GCC 9.3 started supporting attributes in constructor arguments + "clang": "8", + "apple-clang": "10", + } def config_options(self): if self.settings.os == "Windows": @@ -47,60 +46,56 @@ def configure(self): if self.options.shared: del self.options.fPIC - def requirements(self): - self.requires("entt/3.9.0") + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _compiler_required(self): - return { - "gcc": "9.3", # GCC 9.3 started supporting attributes in constructor arguments - } + def requirements(self): + self.requires("entt/3.10.1") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) - try: - minimum_required_compiler_version = self._compiler_required[str(self.settings.compiler)] - if tools.Version(self.settings.compiler.version) < minimum_required_compiler_version: - raise ConanInvalidConfiguration("This package requires C++17 support. The current compiler does not support it.") - except KeyError: - self.output.warn("This recipe has no support for the current compiler. Please consider adding it.") - + check_min_cppstd(self, 17) + check_min_vs(self, 192) + if not is_msvc(self): + try: + minimum_required_compiler_version = self._compiler_required[str(self.settings.compiler)] + if Version(self.settings.compiler.version) < minimum_required_compiler_version: + raise ConanInvalidConfiguration("This package requires C++17 support. The current compiler does not support it.") + except KeyError: + self.output.warn("This recipe has no support for the current compiler. Please consider adding it.") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["EDYN_INSTALL"] = True + tc.variables["EDYN_BUILD_EXAMPLES"] = False + if self.options.floating_type == "double": + tc.variables["EDYN_CONFIG_DOUBLE"] = True + tc.generate() - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["EDYN_INSTALL"] = True - cmake.configure(build_folder=self._build_subfolder) - return cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, pattern="*.pdb", folder=self.package_folder, recursive=True) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) - self.cpp_info.set_property("cmake_find_mode", "both") - self.cpp_info.set_property("cmake_module_file_name", "Edyn") self.cpp_info.set_property("cmake_file_name", "Edyn") self.cpp_info.set_property("cmake_target_name", "Edyn::Edyn") self.cpp_info.set_property("pkg_config_name", "Edyn") diff --git a/recipes/edyn/all/test_package/CMakeLists.txt b/recipes/edyn/all/test_package/CMakeLists.txt index e2cfbe0f46b9e3..3298fd461a4e37 100644 --- a/recipes/edyn/all/test_package/CMakeLists.txt +++ b/recipes/edyn/all/test_package/CMakeLists.txt @@ -1,11 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Edyn REQUIRED CONFIG) diff --git a/recipes/edyn/all/test_package/conanfile.py b/recipes/edyn/all/test_package/conanfile.py index a500b98343c743..a52c6b7a0d922b 100644 --- a/recipes/edyn/all/test_package/conanfile.py +++ b/recipes/edyn/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import cmake_layout +from conan.tools.cmake import CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/edyn/all/test_v1_package/CMakeLists.txt b/recipes/edyn/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..26c41f72889f8e --- /dev/null +++ b/recipes/edyn/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Edyn REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) +target_link_libraries(${PROJECT_NAME} Edyn::Edyn) diff --git a/recipes/edyn/all/test_v1_package/conanfile.py b/recipes/edyn/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/edyn/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/edyn/all/test_v1_package/test_package.cpp b/recipes/edyn/all/test_v1_package/test_package.cpp new file mode 100644 index 00000000000000..ec6be85f6dfe01 --- /dev/null +++ b/recipes/edyn/all/test_v1_package/test_package.cpp @@ -0,0 +1,11 @@ +#include +#include + +int main() +{ + edyn::vector3 const v0{ 0, 1, 2 }; + edyn::vector3 const v1{ -2, -1, -0 }; + + std::printf("%f\n", edyn::dot(v0, v1)); + assert(edyn::dot(v0, v1) == -1); +} diff --git a/recipes/edyn/config.yml b/recipes/edyn/config.yml index 40341aa3db6cd3..b230418434b611 100644 --- a/recipes/edyn/config.yml +++ b/recipes/edyn/config.yml @@ -1,3 +1,3 @@ versions: - "1.0.0": + "1.2.1": folder: all From 50a3aed534573d6f1ca8b13195f089dad4f31e83 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Fri, 28 Oct 2022 15:01:10 -0700 Subject: [PATCH 239/300] (#13754) docs: remove workaround for info object in validate * docs: remove workaround for info object in validate * make it 1.x valid until migration Q's are A'd --- .../header_only/all/conanfile.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/docs/package_templates/header_only/all/conanfile.py b/docs/package_templates/header_only/all/conanfile.py index 99bcc94e5e166c..1f987bd08a8da8 100644 --- a/docs/package_templates/header_only/all/conanfile.py +++ b/docs/package_templates/header_only/all/conanfile.py @@ -1,4 +1,4 @@ -from conan import ConanFile, conan_version +from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy @@ -57,22 +57,19 @@ def requirements(self): def package_id(self): self.info.clear() - @property - def _info(self): - return self if Version(conan_version).major < 2 else self.info - def validate(self): - # compiler subsettings are not available when building with self.info.clear() - if self._info.settings.compiler.get_safe("cppstd"): + # FIXME: `self.settings` is not available in 2.0 but there are plenty of open issues about + # the migration point. For now we are only going to write valid 1.x recipes until we have a proper answer + if self.settings.compiler.get_safe("cppstd"): # validate the minimum cpp standard supported when installing the package. For C++ projects only check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compilers_minimum_version.get(str(self._info.settings.compiler), False) - if minimum_version and Version(self._info.settings.compiler.version) < minimum_version: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) # in case it does not work in another configuration, it should validated here too - if self._info.settings.os == "Windows": + if self.settings.os == "Windows": raise ConanInvalidConfiguration(f"{self.ref} can not be used on Windows.") def source(self): From 9d0a00867b613f8d764e9d093eedd009c1245d5b Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Sat, 29 Oct 2022 01:25:13 +0300 Subject: [PATCH 240/300] (#13755) [libaom-av1] Added 3.5.0 * [aom] Update to 3.5.0 * Added patch type and description * Update patch meta data for all versions --- recipes/libaom-av1/all/conandata.yml | 17 +++++++++++++++ .../all/patches/0001-3.5.0-fix-install.patch | 21 +++++++++++++++++++ recipes/libaom-av1/config.yml | 2 ++ 3 files changed, 40 insertions(+) create mode 100644 recipes/libaom-av1/all/patches/0001-3.5.0-fix-install.patch diff --git a/recipes/libaom-av1/all/conandata.yml b/recipes/libaom-av1/all/conandata.yml index a658972bada52f..8a6a9a41576b73 100644 --- a/recipes/libaom-av1/all/conandata.yml +++ b/recipes/libaom-av1/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.5.0": + url: "https://storage.googleapis.com/aom-releases/libaom-3.5.0.tar.gz" + sha256: "d37dbee372e2430a7efde813984ae6d78bdf1fc4080ebe32457c9115408b0738" "3.4.0": url: "https://storage.googleapis.com/aom-releases/libaom-3.4.0.tar.gz" sha256: "bd754b58c3fa69f3ffd29da77de591bd9c26970e3b18537951336d6c0252e354" @@ -15,13 +18,27 @@ sources: url: "https://storage.googleapis.com/aom-releases/libaom-2.0.1.tar.gz" sha256: "a0cff299621e2ef885aba219c498fa39a7d9a7ddf47585a118fd66c64ad1b312" patches: + "3.5.0": + - patch_file: "patches/0001-3.5.0-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "3.4.0": - patch_file: "patches/0001-3.4.0-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "3.3.0": - patch_file: "patches/0001-3.3.0-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "3.1.2": - patch_file: "patches/0001-3.1.1-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "3.1.1": - patch_file: "patches/0001-3.1.1-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "2.0.1": - patch_file: "patches/0001-2.0.1-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. diff --git a/recipes/libaom-av1/all/patches/0001-3.5.0-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.5.0-fix-install.patch new file mode 100644 index 00000000000000..cdf8395c587c8a --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-3.5.0-fix-install.patch @@ -0,0 +1,21 @@ +--- a/build/cmake/aom_install.cmake ++++ b/build/cmake/aom_install.cmake +@@ -27,7 +27,7 @@ endif() + # Note: aom.pc generation uses GNUInstallDirs: + # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html + macro(setup_aom_install_targets) +- if(NOT XCODE) ++ if(1) + include("GNUInstallDirs") + set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc") + +@@ -78,7 +78,8 @@ macro(setup_aom_install_targets) + endif() + + if(BUILD_SHARED_LIBS) +- set(AOM_INSTALL_LIBS aom aom_static) ++ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) ++ set(AOM_INSTALL_LIBS aom) + else() + set(AOM_INSTALL_LIBS aom) + endif() diff --git a/recipes/libaom-av1/config.yml b/recipes/libaom-av1/config.yml index e66c6b859cddf6..63fbe232d59228 100644 --- a/recipes/libaom-av1/config.yml +++ b/recipes/libaom-av1/config.yml @@ -1,4 +1,6 @@ versions: + "3.5.0": + folder: all "3.4.0": folder: all "3.3.0": From fe3bcd97d3df966f46368747b5565a1d353aaeac Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Sat, 29 Oct 2022 07:11:05 +0800 Subject: [PATCH 241/300] (#13791) libmp3lame: conan v2 support * libmp3lame: support conan v2 * Fixes * Don't call autoreconf * Update conanfile.py Fix linter * Update recipes/libmp3lame/all/test_v1_package/conanfile.py Co-authored-by: Uilian Ries * Fix linter Co-authored-by: Uilian Ries --- recipes/libmp3lame/all/conandata.yml | 11 +- recipes/libmp3lame/all/conanfile.py | 153 +++++++++--------- .../all/test_package/CMakeLists.txt | 7 +- .../libmp3lame/all/test_package/conanfile.py | 27 ++-- .../all/test_v1_package/CMakeLists.txt | 10 ++ .../all/test_v1_package/conanfile.py | 17 ++ 6 files changed, 125 insertions(+), 100 deletions(-) create mode 100644 recipes/libmp3lame/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libmp3lame/all/test_v1_package/conanfile.py diff --git a/recipes/libmp3lame/all/conandata.yml b/recipes/libmp3lame/all/conandata.yml index 7e4efc5251ea5d..ccb693b07c6785 100644 --- a/recipes/libmp3lame/all/conandata.yml +++ b/recipes/libmp3lame/all/conandata.yml @@ -5,8 +5,13 @@ sources: patches: "3.100": - patch_file: "patches/6410.patch" - base_path: "source_subfolder" + patch_type: "backport" + patch_description: "bug tracker item #487: v3.100 breaks Windows compatibility" + patch_source: "https://sourceforge.net/p/lame/svn/commit_browser -- [r6410]" - patch_file: "patches/6416.patch" - base_path: "source_subfolder" + patch_type: "backport" + patch_description: "lame patches ticket #75: Fix for completing svn-r6410" + patch_source: "https://sourceforge.net/p/lame/svn/commit_browser -- [r6410]" - patch_file: "patches/android.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Add __ANDROID__ test to one bit" diff --git a/recipes/libmp3lame/all/conanfile.py b/recipes/libmp3lame/all/conanfile.py index 3728a80aeffaf4..ea3ac2334c9c17 100644 --- a/recipes/libmp3lame/all/conanfile.py +++ b/recipes/libmp3lame/all/conanfile.py @@ -1,11 +1,12 @@ -from conan.tools.files import rename -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools -from contextlib import contextmanager -import functools +from conan import ConanFile +from conan.tools.microsoft import is_msvc, VCVars, unix_path +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, chdir, rmdir, copy, rm, replace_in_file, rename +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain import os import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class LibMP3LameConan(ConanFile): @@ -13,7 +14,7 @@ class LibMP3LameConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "LAME is a high quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL." homepage = "http://lame.sourceforge.net" - topics = ("libmp3lame", "multimedia", "audio", "mp3", "decoder", "encoding", "decoding") + topics = "multimedia", "audio", "mp3", "decoder", "encoding", "decoding" license = "LGPL-2.0" settings = "os", "arch", "compiler", "build_type" @@ -26,18 +27,10 @@ class LibMP3LameConan(ConanFile): "fPIC": True, } - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_clang_cl(self): return str(self.settings.compiler) in ["clang"] and str(self.settings.os) in ['Windows'] - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -47,8 +40,7 @@ def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -56,112 +48,115 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if not self._is_msvc and not self._is_clang_cl: + if not is_msvc(self) and not self._is_clang_cl: self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self.settings.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _apply_patch(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, "include", "libmp3lame.sym"), "lame_init_old\n", "") - @contextmanager - def _msvc_build_environment(self): - with tools.chdir(self._source_subfolder): - with tools.vcvars(self.settings): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - yield + def _generate_vs(self): + tc = VCVars(self) + tc.generate() def _build_vs(self): - with self._msvc_build_environment(): - shutil.copy("configMS.h", "config.h") + with chdir(self, self.source_folder): + shutil.copy2("configMS.h", "config.h") # Honor vc runtime - tools.replace_in_file("Makefile.MSVC", "CC_OPTS = $(CC_OPTS) /MT", "") + replace_in_file(self, "Makefile.MSVC", "CC_OPTS = $(CC_OPTS) /MT", "") # Do not hardcode LTO - tools.replace_in_file("Makefile.MSVC", " /GL", "") - tools.replace_in_file("Makefile.MSVC", " /LTCG", "") - tools.replace_in_file("Makefile.MSVC", "ADDL_OBJ = bufferoverflowU.lib", "") + replace_in_file(self, "Makefile.MSVC", " /GL", "") + replace_in_file(self, "Makefile.MSVC", " /LTCG", "") + replace_in_file(self, "Makefile.MSVC", "ADDL_OBJ = bufferoverflowU.lib", "") command = "nmake -f Makefile.MSVC comp=msvc" if self._is_clang_cl: cl = os.environ.get('CC', "clang-cl") link = os.environ.get("LD", 'lld-link') - tools.replace_in_file('Makefile.MSVC', 'CC = cl', 'CC = %s' % cl) - tools.replace_in_file('Makefile.MSVC', 'LN = link', 'LN = %s' % link) + replace_in_file(self, 'Makefile.MSVC', 'CC = cl', 'CC = %s' % cl) + replace_in_file(self, 'Makefile.MSVC', 'LN = link', 'LN = %s' % link) # what is /GAy? MSDN doesn't know it # clang-cl: error: no such file or directory: '/GAy' # https://docs.microsoft.com/en-us/cpp/build/reference/ga-optimize-for-windows-application?view=msvc-170 - tools.replace_in_file('Makefile.MSVC', '/GAy', '/GA') + replace_in_file(self, 'Makefile.MSVC', '/GAy', '/GA') if self.settings.arch == "x86_64": - tools.replace_in_file("Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:X64") + replace_in_file(self, "Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:X64") command += " MSVCVER=Win64 asm=yes" elif self.settings.arch == "armv8": - tools.replace_in_file("Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:ARM64") + replace_in_file(self, "Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:ARM64") command += " MSVCVER=Win64" else: command += " asm=yes" command += " libmp3lame.dll" if self.options.shared else " libmp3lame-static.lib" self.run(command) - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--disable-frontend", - ] - if self.settings.build_type == "Debug": - args.append("--enable-debug") + def _generate_autotools(self): + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-frontend") if self.settings.compiler == "clang" and self.settings.arch in ["x86", "x86_64"]: - autotools.flags.extend(["-mmmx", "-msse"]) - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools + tc.extra_cxxflags.extend(["-mmmx", "-msse"]) + tc.generate() def _build_autotools(self): - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/") - autotools = self._configure_autotools() + copy(self, "config.sub", self._user_info_build["gnu-config"].CONFIG_SUB, + os.path.join(self.source_folder)) + copy(self, "config.guess", self._user_info_build["gnu-config"].CONFIG_GUESS, + os.path.join(self.source_folder)) + autotools = Autotools(self) + autotools.configure() autotools.make() + def generate(self): + if is_msvc(self) or self._is_clang_cl: + self._generate_vs() + else: + self._generate_autotools() + def build(self): - self._apply_patch() - if self._is_msvc or self._is_clang_cl: + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "include", "libmp3lame.sym"), "lame_init_old\n", "") + + if is_msvc(self) or self._is_clang_cl: self._build_vs() else: self._build_autotools() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - if self._is_msvc or self._is_clang_cl: - self.copy(pattern="*.h", src=os.path.join(self._source_subfolder, "include"), dst=os.path.join("include", "lame")) + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder,"licenses")) + if is_msvc(self) or self._is_clang_cl: + copy(self, pattern="*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder,"include", "lame")) name = "libmp3lame.lib" if self.options.shared else "libmp3lame-static.lib" - self.copy(name, src=os.path.join(self._source_subfolder, "output"), dst="lib") + copy(self, name, src=os.path.join(self.source_folder, "output"), dst=os.path.join(self.package_folder,"lib")) if self.options.shared: - self.copy(pattern="*.dll", src=os.path.join(self._source_subfolder, "output"), dst="bin") + copy(self, pattern="*.dll", src=os.path.join(self.source_folder, "output"), dst=os.path.join(self.package_folder,"bin")) rename(self, os.path.join(self.package_folder, "lib", name), os.path.join(self.package_folder, "lib", "mp3lame.lib")) else: - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.libs = ["mp3lame"] diff --git a/recipes/libmp3lame/all/test_package/CMakeLists.txt b/recipes/libmp3lame/all/test_package/CMakeLists.txt index a59f5d862ad46a..c1f711f1d88713 100644 --- a/recipes/libmp3lame/all/test_package/CMakeLists.txt +++ b/recipes/libmp3lame/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libmp3lame REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libmp3lame::libmp3lame) +target_link_libraries(${PROJECT_NAME} PRIVATE libmp3lame::libmp3lame) diff --git a/recipes/libmp3lame/all/test_package/conanfile.py b/recipes/libmp3lame/all/test_package/conanfile.py index 697dfef261b53b..48499fa0989d9c 100644 --- a/recipes/libmp3lame/all/test_package/conanfile.py +++ b/recipes/libmp3lame/all/test_package/conanfile.py @@ -1,19 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmp3lame/all/test_v1_package/CMakeLists.txt b/recipes/libmp3lame/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..243da6435edb3e --- /dev/null +++ b/recipes/libmp3lame/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libmp3lame REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} libmp3lame::libmp3lame) diff --git a/recipes/libmp3lame/all/test_v1_package/conanfile.py b/recipes/libmp3lame/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libmp3lame/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 059a610f057c4394fae9c2069c4fe946a2cea904 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 29 Oct 2022 01:45:42 +0200 Subject: [PATCH 242/300] (#13813) libcurl: fix MinGW * fix a typo which was breaking MinGW * use self.dependencies instead of self.deps_cpp_info * patch zlib name in autotools build regardless of compiler * fix mingw build to x86 --- recipes/libcurl/all/conanfile.py | 72 ++++++++++++++++---------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/recipes/libcurl/all/conanfile.py b/recipes/libcurl/all/conanfile.py index 82f6473ce9b610..0d543d075c3337 100644 --- a/recipes/libcurl/all/conanfile.py +++ b/recipes/libcurl/all/conanfile.py @@ -282,35 +282,34 @@ def _patch_autotools(self): replace_in_file(self, top_makefile, "SUBDIRS = lib src", "SUBDIRS = lib") replace_in_file(self, top_makefile, "include src/Makefile.inc", "") - if self._is_mingw: - # patch for zlib naming in mingw - if self.options.with_zlib: - configure_ac = os.path.join(self.source_folder, "configure.ac") - zlib_name = self.deps_cpp_info["zlib"].libs[0] - replace_in_file(self, configure_ac, - "AC_CHECK_LIB(z,", - f"AC_CHECK_LIB({zlib_name}") - replace_in_file(self, configure_ac, - "-lz ", - f"-l{zlib_name}") - - if self.options.shared: - # patch for shared mingw build - lib_makefile = os.path.join(self.source_folder, "lib", "Makefile.am") - replace_in_file(self, lib_makefile, - "noinst_LTLIBRARIES = libcurlu.la", - "") - replace_in_file(self, lib_makefile, - "noinst_LTLIBRARIES =", - "") - replace_in_file(self, lib_makefile, - "lib_LTLIBRARIES = libcurl.la", - "noinst_LTLIBRARIES = libcurl.la") - # add directives to build dll - # used only for native mingw-make - if not cross_building(self): - added_content = load(self, "lib_Makefile_add.am") - save(self, lib_makefile, added_content, append=True) + # zlib naming is not always very consistent + if self.options.with_zlib: + configure_ac = os.path.join(self.source_folder, "configure.ac") + zlib_name = self.dependencies["zlib"].cpp_info.libs[0] + replace_in_file(self, configure_ac, + "AC_CHECK_LIB(z,", + f"AC_CHECK_LIB({zlib_name},") + replace_in_file(self, configure_ac, + "-lz ", + f"-l{zlib_name} ") + + if self._is_mingw and self.options.shared: + # patch for shared mingw build + lib_makefile = os.path.join(self.source_folder, "lib", "Makefile.am") + replace_in_file(self, lib_makefile, + "noinst_LTLIBRARIES = libcurlu.la", + "") + replace_in_file(self, lib_makefile, + "noinst_LTLIBRARIES =", + "") + replace_in_file(self, lib_makefile, + "lib_LTLIBRARIES = libcurl.la", + "noinst_LTLIBRARIES = libcurl.la") + # add directives to build dll + # used only for native mingw-make + if not cross_building(self): + added_content = load(self, "lib_Makefile_add.am") + save(self, lib_makefile, added_content, append=True) def _patch_cmake(self): if not self._is_using_cmake_build: @@ -398,30 +397,30 @@ def _generate_with_autotools(self): f"--enable-unix-sockets={self._yes_no(self.options.with_unix_sockets)}", ]) if self.options.with_ssl == "openssl": - path = unix_path(self, self.deps_cpp_info["openssl"].rootpath) + path = unix_path(self, self.dependencies["openssl"].package_folder) tc.configure_args.append(f"--with-ssl={path}") else: tc.configure_args.append("--without-ssl") if self.options.with_ssl == "wolfssl": - path = unix_path(self, self.deps_cpp_info["wolfssl"].rootpath) + path = unix_path(self, self.dependencies["wolfssl"].package_folder) tc.configure_args.append(f"--with-wolfssl={path}") else: tc.configure_args.append("--without-wolfssl") if self.options.with_libssh2: - path = unix_path(self, self.deps_cpp_info["libssh2"].rootpath) + path = unix_path(self, self.dependencies["libssh2"].package_folder) tc.configure_args.append(f"--with-libssh2={path}") else: tc.configure_args.append("--without-libssh2") if self.options.with_nghttp2: - path = unix_path(self, self.deps_cpp_info["libnghttp2"].rootpath) + path = unix_path(self, self.dependencies["libnghttp2"].package_folder) tc.configure_args.append(f"--with-nghttp2={path}") else: tc.configure_args.append("--without-nghttp2") if self.options.with_zlib: - path = unix_path(self, self.deps_cpp_info["zlib"].rootpath) + path = unix_path(self, self.dependencies["zlib"].package_folder) tc.configure_args.append(f"--with-zlib={path}") else: tc.configure_args.append("--without-zlib") @@ -476,13 +475,12 @@ def _generate_with_autotools(self): rcflags = "-O COFF" if self.settings.arch == "x86": rcflags += " --target=pe-i386" - else: + elif self.settings.arch == "x86_64": rcflags += " --target=pe-x86-64" + tc.extra_defines.append("_AMD64_") env = tc.environment() env.define("RCFLAGS", rcflags) - tc.extra_defines.append("_AMD64_") - if self.settings.os != "Windows": tc.fpic = self.options.get_safe("fPIC", True) From ca55b6483dfad4461f3e4c60b83e01a4796d220b Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Sat, 29 Oct 2022 03:25:16 -0500 Subject: [PATCH 243/300] (#13347) glib: Fix test package to allow cross-compilation * remove unused patch * glib: Fix test package to allow cross-compilation CMake's FindPkgConfig module doesn't behave correctly when cross-compiling. The test package has been modified to use CMake config modules when cross-compiling. This allows cross-compiling the glib package. * Use PKG_CONFIG_PATH workaround for CMake * Fix test_v1_package * Use pkgconf in test package * Workaround libdir / libdir1 inconsistency in pkg_config / PkgConfigDeps * Fix minimum CMake version for pkg_check_modules * Fix code warning from apple-clang * Fix Apple shared install name? * Simplify boolean print out * Check exceptions in configure * Check pkg_config conf variable * Use SPDX identifier for license * Organize imports * Remove workarounds for MesonToolchain generator * Fix SHA * Fix merge Co-authored-by: ericLemanissier --- recipes/glib/all/conandata.yml | 38 ++++++++----------- recipes/glib/all/conanfile.py | 28 ++++---------- ...67ae441bc6059b43a1051dd0b750fe5f6301.patch | 25 ------------ recipes/glib/all/test_package/CMakeLists.txt | 4 +- recipes/glib/all/test_package/conanfile.py | 31 +++++++++------ recipes/glib/all/test_package/test_package.c | 2 +- recipes/glib/all/test_v1_package/conanfile.py | 11 +++--- recipes/glib/config.yml | 12 ++---- 8 files changed, 56 insertions(+), 95 deletions(-) delete mode 100644 recipes/glib/all/patches/f2ea67ae441bc6059b43a1051dd0b750fe5f6301.patch diff --git a/recipes/glib/all/conandata.yml b/recipes/glib/all/conandata.yml index 5eb5b3d461c8ee..02c07bbcb018ac 100644 --- a/recipes/glib/all/conandata.yml +++ b/recipes/glib/all/conandata.yml @@ -1,34 +1,28 @@ sources: + "2.74.1": + url: "https://download.gnome.org/sources/glib/2.74/glib-2.74.1.tar.xz" + sha256: "0ab981618d1db47845e56417b0d7c123f81a3427b2b9c93f5a46ff5bbb964964" "2.74.0": url: "https://download.gnome.org/sources/glib/2.74/glib-2.74.0.tar.xz" sha256: "3652c7f072d7b031a6b5edd623f77ebc5dcd2ae698598abcc89ff39ca75add30" "2.73.3": url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.3.tar.xz" sha256: "df1a2b841667d6b48b2ef6969ebda4328243829f6e45866726f806f90f64eead" - "2.73.2": - url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.2.tar.xz" - sha256: "5f3ee36e34f4aaab393c3e3dc46fb01b32f7ead6c88d41d7f20d88a49cdef1d9" - "2.73.1": - url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.1.tar.xz" - sha256: "77b21da5bd195a8e5f751206a2acab477636e3d02fe4f3796ede5788255382ae" - "2.73.0": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.73.0/glib-2.73.0.tar.gz" - sha256: "3f573319adbdf572d79255e8bae85c7e2902d1aa6177d2646605a00c0a607eca" - "2.72.1": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.72.1/glib-2.72.1.tar.gz" - sha256: "4a345987a9ee7709417f5a5c6f4eeec2497bc2a913f14c1b9bdc403409d5ffb7" + "2.72.4": + url: "https://download.gnome.org/sources/glib/2.72/glib-2.72.4.tar.xz" + sha256: "8848aba518ba2f4217d144307a1d6cb9afcc92b54e5c13ac1f8c4d4608e96f0e" "2.71.3": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.71.3/glib-2.71.3.tar.gz" - sha256: "08e17cf608f5ac3462092bff13828c1c0aab37c5b4827d4e17b948215b4e40ea" - "2.70.4": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.70.4/glib-2.70.4.tar.gz" - sha256: "23461c4e694b465fad32ea677b3abc9306fa8511d12e915aee09b53f362c7fff" + url: "https://download.gnome.org/sources/glib/2.71/glib-2.71.3.tar.xz" + sha256: "288549404c26db3d52cf7a37f2f42b495b31ccffce2b4cb2439a64099c740343" + "2.70.5": + url: "https://download.gnome.org/sources/glib/2.70/glib-2.70.5.tar.xz" + sha256: "f70bf76ebcc84e0705722f038be8e2f9a58d17e1a700810c635fcc18b8974b7e" "2.69.3": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.69.3/glib-2.69.3.tar.gz" - sha256: "290f05eb5affd1bac142010d6511c7a3de361e5f69addc677cf6b3c92a757b44" + url: "https://download.gnome.org/sources/glib/2.69/glib-2.69.3.tar.xz" + sha256: "47af2c6e06becee44d447ae7d1212dbab255b002b5141d9b62a4357c0ecc058f" "2.68.3": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.68.3/glib-2.68.3.tar.gz" - sha256: "465c0727dd5505e998ebb1dae7c38683440dc6d6beffbca6bbf3eaabdb4f6ac7" + url: "https://download.gnome.org/sources/glib/2.68/glib-2.68.3.tar.xz" + sha256: "e7e1a3c20c026109c45c9ec4a31d8dcebc22e86c69486993e565817d64be3138" patches: "2.74.0": - patch_file: "patches/0001-2.74.0-clang-static-assert.patch" @@ -40,5 +34,3 @@ patches: patch_type: backport patch_description: fix for clang compilation patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2898 - "2.73.1": - - patch_file: "patches/f2ea67ae441bc6059b43a1051dd0b750fe5f6301.patch" diff --git a/recipes/glib/all/conanfile.py b/recipes/glib/all/conanfile.py index 7742c7227fde4a..45a32d15f9f33d 100644 --- a/recipes/glib/all/conanfile.py +++ b/recipes/glib/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.apple import fix_apple_shared_install_name, is_apple_os from conan.tools.env import VirtualBuildEnv from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir -from conan.tools.gnu import PkgConfigDeps, AutotoolsDeps +from conan.tools.gnu import PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain from conan.tools.microsoft import is_msvc @@ -21,8 +21,7 @@ class GLibConan(ConanFile): topics = ("gobject", "gio", "gmodule") url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.gnome.org/GNOME/glib" - license = "LGPL-2.1" - + license = "LGPL-2.1-or-later" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,7 +39,6 @@ class GLibConan(ConanFile): "with_mount": True, "with_selinux": True, } - short_paths = True def export_sources(self): @@ -109,31 +107,20 @@ def validate(self): def build_requirements(self): self.tool_requires("meson/0.63.3") - self.tool_requires("pkgconf/1.9.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): - env = VirtualBuildEnv(self) - env.generate() + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() tc = PkgConfigDeps(self) tc.generate() - tc = AutotoolsDeps(self) - # bug? meson toolchain doesn't read CPPFLAGS - cppflags = tc.vars().get("CPPFLAGS") - tc.environment.append('CFLAGS', cppflags) - tc.environment.append('CXXFLAGS', cppflags) - # conan or meson bug? LIBPATH is ignored - ldflags = tc.vars().get("LDFLAGS") - ldflags = ldflags.replace("-LIBPATH", "/LIBPATH") - tc.environment.define('LDFLAGS', ldflags) - tc.generate() - # it's needed so MesonToolchain reads from AutotoolsDeps, should it be automatic? - self.buildenv.compose_env(tc.environment) - tc = MesonToolchain(self) + if is_apple_os(self): tc.project_options["iconv"] = "external" # https://gitlab.gnome.org/GNOME/glib/issues/1557 tc.project_options["selinux"] = "enabled" if self.options.get_safe("with_selinux") else "disabled" @@ -308,6 +295,7 @@ def package_info(self): 'datadir': '${prefix}/res', 'schemasdir': '${datadir}/glib-2.0/schemas', 'bindir': '${prefix}/bin', + # Can't use libdir here as it is libdir1 when using the PkgConfigDeps generator. 'giomoduledir': '${prefix}/lib/gio/modules', 'gio': '${bindir}/gio', 'gio_querymodules': '${bindir}/gio-querymodules', diff --git a/recipes/glib/all/patches/f2ea67ae441bc6059b43a1051dd0b750fe5f6301.patch b/recipes/glib/all/patches/f2ea67ae441bc6059b43a1051dd0b750fe5f6301.patch deleted file mode 100644 index 0d4711bf3c4971..00000000000000 --- a/recipes/glib/all/patches/f2ea67ae441bc6059b43a1051dd0b750fe5f6301.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f2ea67ae441bc6059b43a1051dd0b750fe5f6301 Mon Sep 17 00:00:00 2001 -From: ericLemanissier -Date: Thu, 23 Jun 2022 08:26:21 +0000 -Subject: [PATCH] use gvdb as a subproject - -this fixes the build when using --wrap-mode=nofallback -fix proposed by @eschwartz ---- - meson.build | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/meson.build b/meson.build -index 1234ba064..3da0010af 100644 ---- a/meson.build -+++ b/meson.build -@@ -2042,6 +2042,7 @@ else - endif - - # Import the gvdb sources as a subproject to avoid having the copylib in-tree -+subproject('gvdb') - gvdb_dep = dependency('gvdb') - - libm = cc.find_library('m', required : false) --- -GitLab diff --git a/recipes/glib/all/test_package/CMakeLists.txt b/recipes/glib/all/test_package/CMakeLists.txt index 701cfbcd53416f..44f2423e0f8316 100644 --- a/recipes/glib/all/test_package/CMakeLists.txt +++ b/recipes/glib/all/test_package/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.6) project(test_package LANGUAGES C) add_executable(${PROJECT_NAME} test_package.c) -if (WIN32) +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") find_package(glib CONFIG REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE glib::glib-2.0 glib::gio-2.0 glib::gmodule-2.0 glib::gobject-2.0 glib::gthread-2.0) else() diff --git a/recipes/glib/all/test_package/conanfile.py b/recipes/glib/all/test_package/conanfile.py index 3cff3b0d1d1304..8349dc46848c72 100644 --- a/recipes/glib/all/test_package/conanfile.py +++ b/recipes/glib/all/test_package/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile -from conan.tools.build import can_run -from conan.tools.cmake import CMake, CMakeDeps, cmake_layout -from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv from conan.tools.gnu import PkgConfig, PkgConfigDeps import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -18,22 +17,31 @@ def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): - if self.settings.os != "Windows": + if self.settings.os != "Windows" and not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): self.tool_requires("pkgconf/1.9.3") def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_CROSSCOMPILING"] = cross_building(self) + tc.generate() if self.settings.os == "Windows": deps = CMakeDeps(self) deps.generate() else: - env = VirtualBuildEnv(self) - env.generate() - pkg = PkgConfigDeps(self) - pkg.generate() - # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + # todo Remove the following workaround after https://github.com/conan-io/conan/issues/11962 is fixed. env = Environment() env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) - env.vars(self).save_script("conanbuildenv_pkg_config_path") + envvars = env.vars(self) + envvars.save_script("pkg_config") + + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + virtual_run_env = VirtualRunEnv(self) + virtual_run_env.generate() + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + cmake_deps = CMakeDeps(self) + cmake_deps.generate() def build(self): cmake = CMake(self) @@ -49,3 +57,4 @@ def test(self): pkg_config = PkgConfig(self, "gio-2.0", pkg_config_path=self.generators_folder) gdbus_codegen = pkg_config.variables["gdbus_codegen"] self.run(f"{gdbus_codegen} -h", env="conanrun") + diff --git a/recipes/glib/all/test_package/test_package.c b/recipes/glib/all/test_package/test_package.c index 8257bd8a6d5234..c75317a5f7f063 100644 --- a/recipes/glib/all/test_package/test_package.c +++ b/recipes/glib/all/test_package/test_package.c @@ -14,7 +14,7 @@ int main() { GQueue *queue = g_queue_new(); g_queue_free(queue); - g_module_supported(); + printf("glib module supported: %s\n", g_module_supported() ? "true" : "false"); GMutex m; g_mutex_init(&m); diff --git a/recipes/glib/all/test_v1_package/conanfile.py b/recipes/glib/all/test_v1_package/conanfile.py index d968f0377f778f..f8dd4972dff881 100644 --- a/recipes/glib/all/test_v1_package/conanfile.py +++ b/recipes/glib/all/test_v1_package/conanfile.py @@ -11,14 +11,15 @@ def build_requirements(self): self.build_requires("pkgconf/1.9.3") def build(self): - if self.settings.os != "Windows": - with tools.environment_append({"PKG_CONFIG_PATH": "."}): + if not tools.cross_building(self) and self.settings.os != "Windows": + with tools.environment_append({'PKG_CONFIG_PATH': "."}): pkg_config = tools.PkgConfig("gio-2.0") self.run(f"{pkg_config.variables['gdbus_codegen']} -h", run_environment=True) - cmake = CMake(self) - cmake.configure() - cmake.build() + with tools.environment_append({'PKG_CONFIG_PATH': "."}): + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): if not tools.cross_building(self): diff --git a/recipes/glib/config.yml b/recipes/glib/config.yml index e8494b97b4aa41..71762c69a90763 100644 --- a/recipes/glib/config.yml +++ b/recipes/glib/config.yml @@ -1,19 +1,15 @@ versions: + "2.74.1": + folder: all "2.74.0": folder: all "2.73.3": folder: all - "2.73.2": - folder: all - "2.73.1": - folder: all - "2.73.0": - folder: all - "2.72.1": + "2.72.4": folder: all "2.71.3": folder: all - "2.70.4": + "2.70.5": folder: all "2.69.3": folder: all From 4bf2713e37bfe554d322fa78c330e00bd32efbf4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 29 Oct 2022 11:17:46 +0200 Subject: [PATCH 244/300] (#13836) [config] Update windows node labels for conan v2 config too --- .c3i/config_v2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.c3i/config_v2.yml b/.c3i/config_v2.yml index b63fb15a0d2e91..b6da2e14522493 100644 --- a/.c3i/config_v2.yml +++ b/.c3i/config_v2.yml @@ -87,7 +87,7 @@ node_labels: Windows: x86_64: "msvc": - default: "windows20220803" + default: "windows20221024" Macos: x86_64: "apple-clang": From 83f9f5cdd23b9acd2da77188a193cc3769c584f5 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Sat, 29 Oct 2022 11:44:32 +0200 Subject: [PATCH 245/300] (#13832) [docs] Bump version label only accepts SEMVER and MAJOR.MINOR * Document bump version format Signed-off-by: Uilian Ries * Move to the right section Signed-off-by: Uilian Ries Signed-off-by: Uilian Ries --- docs/labels.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/labels.md b/docs/labels.md index 30b4d0a7eeb467..270b6b157a75a8 100644 --- a/docs/labels.md +++ b/docs/labels.md @@ -32,8 +32,8 @@ If the pull request modifies anything else, the label won't be assigned, we need Label [`Bump version`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3A%22Bump+version%22) is assigned by the bot to pull-requests that are just adding a new version of the library. The new version should satisfy -some extra conditions: sources should provide from the same URL domain as previous versions and the version itself should -be valid semver. +some extra conditions: sources should provide from the same URL domain as previous versions. +For now, only [SEMVER](https://semver.org/#semantic-versioning-200) and `` are acceptable version formats. > These pull-requests will be merged right away without requiring any approval (CI and CLA checks must have passed). From 7053dfe07c2d170f64811a4f4473c4d9233e2267 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Sat, 29 Oct 2022 12:04:44 +0200 Subject: [PATCH 246/300] (#13846) libxml2: bump reqs * libxml2: bump reqs * Update conanfile.py --- recipes/libxml2/all/conanfile.py | 46 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/recipes/libxml2/all/conanfile.py b/recipes/libxml2/all/conanfile.py index 7e16807397e884..1353012acdd293 100644 --- a/recipes/libxml2/all/conanfile.py +++ b/recipes/libxml2/all/conanfile.py @@ -1,6 +1,7 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment +from conans import tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment from contextlib import contextmanager -from conan.tools.files import rename +from conan import ConanFile +from conan.tools.files import rename, get, chdir, replace_in_file, rm, rmdir, save, mkdir import functools import itertools import os @@ -88,7 +89,7 @@ def configure(self): def requirements(self): if self.options.zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.lzma: self.requires("xz_utils/5.2.5") if self.options.iconv: @@ -99,19 +100,19 @@ def requirements(self): def build_requirements(self): if not (self._is_msvc or self._is_mingw_windows): if self.options.zlib or self.options.lzma or self.options.icu: - self.build_requires("pkgconf/1.7.4") + self.build_requires("pkgconf/1.9.3") if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): self.build_requires("msys2/cci.latest") def source(self): # can't use strip_root here because if fails since 2.9.10 with: # KeyError: "linkname 'libxml2-2.9.1x/test/relaxng/ambig_name-class.xml' not found" - tools.get(**self.conan_data["sources"][self.version]) + get(self, **self.conan_data["sources"][self.version]) rename(self, "libxml2-{}".format(self.version), self._source_subfolder) @contextmanager def _msvc_build_environment(self): - with tools.chdir(os.path.join(self._source_subfolder, 'win32')): + with chdir(self, os.path.join(self._source_subfolder, 'win32')): with tools.vcvars(self.settings): with tools.environment_append(VisualStudioBuildEnvironment(self).vars): yield @@ -156,7 +157,7 @@ def fix_library(option, package, old_libname): if not libname.endswith('.lib'): libname += '.lib' libs.append(libname) - tools.replace_in_file("Makefile.msvc", + replace_in_file(self, "Makefile.msvc", "LIBS = $(LIBS) %s" % old_libname, "LIBS = $(LIBS) %s" % ' '.join(libs)) @@ -180,7 +181,7 @@ def _package_msvc(self): @contextmanager def _mingw_build_environment(self): - with tools.chdir(os.path.join(self._source_subfolder, "win32")): + with chdir(self, os.path.join(self._source_subfolder, "win32")): with tools.environment_append(AutoToolsBuildEnvironment(self).vars): yield @@ -215,7 +216,7 @@ def _build_mingw(self): # build def fix_library(option, package, old_libname): if option: - tools.replace_in_file( + replace_in_file(self, "Makefile.mingw", "LIBS += -l{}".format(old_libname), "LIBS += -l{}".format(" -l".join(self.deps_cpp_info[package].libs)), @@ -231,7 +232,7 @@ def fix_library(option, package, old_libname): def _package_mingw(self): with self._mingw_build_environment(): - tools.mkdir(os.path.join(self.package_folder, "include", "libxml2")) + mkdir(self, os.path.join(self.package_folder, "include", "libxml2")) self.run("mingw32-make -f Makefile.mingw install-libs") if self.options.include_utils: self.run("mingw32-make -f Makefile.mingw install-dist") @@ -255,11 +256,11 @@ def _configure_autotools(self): def _patch_sources(self): # Break dependency of install on build for makefile in ("Makefile.mingw", "Makefile.msvc"): - tools.replace_in_file(os.path.join(self._source_subfolder, "win32", makefile), + replace_in_file(self, os.path.join(self._source_subfolder, "win32", makefile), "install-libs : all", "install-libs :") # relocatable shared lib on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), + replace_in_file(self, os.path.join(self._source_subfolder, "configure"), "-install_name \\$rpath/", "-install_name @rpath/") @@ -287,12 +288,12 @@ def package(self): os.remove(os.path.join(self.package_folder, "bin", "libxml2.dll")) os.remove(os.path.join(self.package_folder, "lib", "libxml2_a_dll.lib")) os.remove(os.path.join(self.package_folder, "lib", "libxml2_a.lib" if self.options.shared else "libxml2.lib")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) elif self._is_mingw_windows: self._package_mingw() if self.options.shared: os.remove(os.path.join(self.package_folder, "lib", "libxml2.a")) - tools.rename(os.path.join(self.package_folder, "lib", "libxml2.lib"), + rename(self, os.path.join(self.package_folder, "lib", "libxml2.lib"), os.path.join(self.package_folder, "lib", "libxml2.dll.a")) else: os.remove(os.path.join(self.package_folder, "bin", "libxml2.dll")) @@ -304,13 +305,13 @@ def package(self): if self.options.include_utils: autotools.make(["install", "xmllint", "xmlcatalog", "xml2-config"]) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.sh") + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.sh", os.path.join(self.package_folder, "lib")) for prefix in ["run", "test"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), prefix + "*") - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, prefix + "*", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) for header in ["win32config.h", "wsockcompat.h"]: self.copy(pattern=header, src=os.path.join(self._source_subfolder, "include"), @@ -320,8 +321,7 @@ def package(self): os.path.join(self.package_folder, self._module_file_rel_path) ) - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): # FIXME: also define LIBXML2_XMLLINT_EXECUTABLE variable content = textwrap.dedent("""\ if(DEFINED LibXml2_FOUND) @@ -342,7 +342,7 @@ def _create_cmake_module_variables(module_file): set(LIBXML2_VERSION_STRING ${LibXml2_VERSION}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): From 5bc3b8ec0fc5a6fa95b4e99ba0b183478e0e68a5 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 29 Oct 2022 12:44:59 +0200 Subject: [PATCH 247/300] (#13735) Bump spirv-cross/1.3.231.1 * add spirv-cross/1.3.231.0 * modernize a little bit more * add 1.3.231.1 instead of 1.3.231.0 * fix required_conan_version --- recipes/spirv-cross/all/conandata.yml | 3 +++ recipes/spirv-cross/all/conanfile.py | 10 ++++++---- .../spirv-cross/all/test_v1_package/CMakeLists.txt | 13 +++---------- recipes/spirv-cross/config.yml | 2 ++ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/recipes/spirv-cross/all/conandata.yml b/recipes/spirv-cross/all/conandata.yml index 9f381bc4d1821d..ccac03d97d7f34 100644 --- a/recipes/spirv-cross/all/conandata.yml +++ b/recipes/spirv-cross/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231.1": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "3b42f5b6e46b45600e09fd55234f59edb7cfca803e49d7830dc6fb5a086143b1" "1.3.224.0": url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.224.0.tar.gz" sha256: "00256c33e235c5b9f0fc4b531fb9058d3cf1ff53e21e2db62cd8db848525536c" diff --git a/recipes/spirv-cross/all/conanfile.py b/recipes/spirv-cross/all/conanfile.py index 03c287d70e62c7..30a688b542978e 100644 --- a/recipes/spirv-cross/all/conanfile.py +++ b/recipes/spirv-cross/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, copy, get, rm, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save from conans import CMake, tools as tools_legacy import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class SpirvCrossConan(ConanFile): @@ -60,8 +60,7 @@ def _build_subfolder(self): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -74,6 +73,9 @@ def configure(self): del self.options.c_api del self.options.util + def layout(self): + pass + def validate(self): if not self.info.options.glsl and \ (self.info.options.hlsl or self.info.options.msl or self.info.options.cpp or self.info.options.reflect): diff --git a/recipes/spirv-cross/all/test_v1_package/CMakeLists.txt b/recipes/spirv-cross/all/test_v1_package/CMakeLists.txt index 97069b25defdb1..0d20897301b68b 100644 --- a/recipes/spirv-cross/all/test_v1_package/CMakeLists.txt +++ b/recipes/spirv-cross/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -# FIXME: this is not the official way to find spirv-cross components -find_package(spirv-cross REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -if(TARGET spirv-cross-c) - target_link_libraries(${PROJECT_NAME} PRIVATE spirv-cross-c) -elseif(TARGET spirv-cross-c-shared) - target_link_libraries(${PROJECT_NAME} PRIVATE spirv-cross-c-shared) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/spirv-cross/config.yml b/recipes/spirv-cross/config.yml index 791b0b57e6377c..9a1052e813471c 100644 --- a/recipes/spirv-cross/config.yml +++ b/recipes/spirv-cross/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231.1": + folder: all "1.3.224.0": folder: all "1.3.216.0": From a963044e967ae79ba5cbb3d3501359920cc0114f Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Sat, 29 Oct 2022 13:45:02 +0200 Subject: [PATCH 248/300] (#13850) pcre: bump zlib --- recipes/pcre/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/pcre/all/conanfile.py b/recipes/pcre/all/conanfile.py index 1298f3df04c72b..9ffa5521e50c7b 100644 --- a/recipes/pcre/all/conanfile.py +++ b/recipes/pcre/all/conanfile.py @@ -78,7 +78,7 @@ def requirements(self): if self.options.get_safe("with_bzip2"): self.requires("bzip2/1.0.8") if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if not self.info.options.build_pcre_8 and not self.info.options.build_pcre_16 and not self.info.options.build_pcre_32: From c042b8039174bcd7016feac0f386d9dfcd942e83 Mon Sep 17 00:00:00 2001 From: toge Date: Sat, 29 Oct 2022 21:04:20 +0900 Subject: [PATCH 249/300] (#13852) daw_header_libraries: add version 2.73.1 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/daw_header_libraries/all/conandata.yml | 3 +++ recipes/daw_header_libraries/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/daw_header_libraries/all/conandata.yml b/recipes/daw_header_libraries/all/conandata.yml index 1096c3719c4e74..c98b162458d799 100644 --- a/recipes/daw_header_libraries/all/conandata.yml +++ b/recipes/daw_header_libraries/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.73.1": + url: "https://github.com/beached/header_libraries/archive/v2.73.1.tar.gz" + sha256: "62bd26398afa7eba1aae7bbbf107865044b8be0539d266085c36aed82557ae07" "2.72.0": url: "https://github.com/beached/header_libraries/archive/v2.72.0.tar.gz" sha256: "f681755183af4af35f4741f3bcb7d99c6707911806e39e3acc982f9532aacc08" diff --git a/recipes/daw_header_libraries/config.yml b/recipes/daw_header_libraries/config.yml index 2a15faca97b8eb..17e1b15d8a0510 100644 --- a/recipes/daw_header_libraries/config.yml +++ b/recipes/daw_header_libraries/config.yml @@ -1,4 +1,6 @@ versions: + "2.73.1": + folder: all "2.72.0": folder: all "2.71.0": From e2da3a03a60cf476b722bbe64be6bd55864d815e Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sat, 29 Oct 2022 15:25:20 +0200 Subject: [PATCH 250/300] (#13838) spirv-tools: add 1.3.231.1 & modernize a little bit more * modernize more * add spirv-tools/1.3.231.1 --- recipes/spirv-tools/all/conandata.yml | 3 +++ recipes/spirv-tools/all/conanfile.py | 24 ++++++++++--------- .../dependencies/dependencies-1.3.231.1.yml | 1 + .../spirv-tools/all/test_package/conanfile.py | 7 +++--- .../all/test_v1_package/CMakeLists.txt | 21 +++------------- recipes/spirv-tools/config.yml | 2 ++ 6 files changed, 26 insertions(+), 32 deletions(-) create mode 100644 recipes/spirv-tools/all/dependencies/dependencies-1.3.231.1.yml diff --git a/recipes/spirv-tools/all/conandata.yml b/recipes/spirv-tools/all/conandata.yml index 803c2f4c4cf9f3..444cdf7f3b2fb7 100644 --- a/recipes/spirv-tools/all/conandata.yml +++ b/recipes/spirv-tools/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231.1": + url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "b97df7fdac617878668762ab452ae2ae425a0f36e29711b4cc6c4ae216e32309" "1.3.224.0": url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.224.0.tar.gz" sha256: "428b83f2710c07123cf2ec21934389f893aa0b570d1fe4aba6e38718c9a6ea69" diff --git a/recipes/spirv-tools/all/conanfile.py b/recipes/spirv-tools/all/conanfile.py index 7f8d2a0bea0dc0..2ad27d812da9b0 100644 --- a/recipes/spirv-tools/all/conanfile.py +++ b/recipes/spirv-tools/all/conanfile.py @@ -2,15 +2,15 @@ from conan.errors import ConanException from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rm, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, save from conan.tools.scm import Version -from conans import tools as tools_legacy +from conans.tools import stdcpp_library # TODO: import from conan.tools.build in conan 1.54.0 (https://github.com/conan-io/conan/pull/12269) import functools import os import textwrap import yaml -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class SpirvtoolsConan(ConanFile): @@ -74,8 +74,7 @@ def export(self): copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder) def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -83,7 +82,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def _require(self, recipe_name): if recipe_name not in self._dependencies_versions: @@ -94,12 +99,9 @@ def requirements(self): self.requires(self._require("spirv-headers")) def validate(self): - if self.info.settings.compiler.cppstd: + if self.info.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -237,7 +239,7 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["spirv-tools-core"].system_libs.extend(["m", "rt"]) if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["spirv-tools-core"].system_libs.append(libcxx) diff --git a/recipes/spirv-tools/all/dependencies/dependencies-1.3.231.1.yml b/recipes/spirv-tools/all/dependencies/dependencies-1.3.231.1.yml new file mode 100644 index 00000000000000..c7958b90b620e4 --- /dev/null +++ b/recipes/spirv-tools/all/dependencies/dependencies-1.3.231.1.yml @@ -0,0 +1 @@ +spirv-headers: "1.3.231.1" diff --git a/recipes/spirv-tools/all/test_package/conanfile.py b/recipes/spirv-tools/all/test_package/conanfile.py index 1235aa2253cefb..d8eaf2ab17123a 100644 --- a/recipes/spirv-tools/all/test_package/conanfile.py +++ b/recipes/spirv-tools/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/spirv-tools/all/test_v1_package/CMakeLists.txt b/recipes/spirv-tools/all/test_v1_package/CMakeLists.txt index 28cb54d7435c56..0d20897301b68b 100644 --- a/recipes/spirv-tools/all/test_v1_package/CMakeLists.txt +++ b/recipes/spirv-tools/all/test_v1_package/CMakeLists.txt @@ -1,23 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(SPIRV-Tools REQUIRED CONFIG) - -add_executable(${PROJECT_NAME}_c ../test_package/test_package.c) -if(TARGET SPIRV-Tools-shared) - target_link_libraries(${PROJECT_NAME}_c PRIVATE SPIRV-Tools-shared) -elseif(TARGET SPIRV-Tools-static) - target_link_libraries(${PROJECT_NAME}_c PRIVATE SPIRV-Tools-static) -else() - target_link_libraries(${PROJECT_NAME}_c PRIVATE SPIRV-Tools) -endif() - -# TODO: we should call find_package(SPIRV-Tools-opt REQUIRED CONFIG), but not modeled right now -if(TARGET SPIRV-Tools-opt) - add_executable(${PROJECT_NAME}_cpp ../test_package/test_package.cpp) - target_link_libraries(${PROJECT_NAME}_cpp PRIVATE SPIRV-Tools-opt) - target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_11) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/spirv-tools/config.yml b/recipes/spirv-tools/config.yml index 0b673c62a4f587..5ec3ee7c46e2a1 100644 --- a/recipes/spirv-tools/config.yml +++ b/recipes/spirv-tools/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231.1": + folder: all "1.3.224.0": folder: all "1.3.216.0": From 2bcdf5529bc8840790fd2f1eff67b6d955b3f076 Mon Sep 17 00:00:00 2001 From: toge Date: Sun, 30 Oct 2022 00:09:49 +0900 Subject: [PATCH 251/300] (#13856) daw_json_link: add version 3.3.0 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/daw_json_link/all/conandata.yml | 3 +++ recipes/daw_json_link/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/daw_json_link/all/conandata.yml b/recipes/daw_json_link/all/conandata.yml index 93243ede3fc684..40ad2a7eb68bcd 100644 --- a/recipes/daw_json_link/all/conandata.yml +++ b/recipes/daw_json_link/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.3.0": + url: "https://github.com/beached/daw_json_link/archive/v3.3.0.tar.gz" + sha256: "fd806245fc8b944e613b29da5ef0570c0e6881b6049a7bf65eb0285c58848f40" "3.1.1": url: "https://github.com/beached/daw_json_link/archive/v3.1.1.tar.gz" sha256: "7d340886898b2ea3c595f0f871c81e4c7382fe53d22d80edc5629768e49fa634" diff --git a/recipes/daw_json_link/config.yml b/recipes/daw_json_link/config.yml index 0be7e0765dcdbf..f8a7633e3c0aca 100644 --- a/recipes/daw_json_link/config.yml +++ b/recipes/daw_json_link/config.yml @@ -1,4 +1,6 @@ versions: + "3.3.0": + folder: "all" "3.1.1": folder: "all" "3.1.0": From 7e292bc025078633df6537fe50204423729c8672 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Sun, 30 Oct 2022 00:24:44 +0200 Subject: [PATCH 252/300] (#13837) qt 5.15.7 * qt 5.15.7 * bump reqs also, reorder build_modules according to dependencies * Update conanfile.py * enable qttools and qttranslations they are "essential" modules which should not take too long to compile --- recipes/qt/5.x.x/conandata.yml | 38 +++++------ recipes/qt/5.x.x/conanfile.py | 66 ++++++++++--------- recipes/qt/5.x.x/patches/QTBUG-90395.diff | 38 ----------- recipes/qt/5.x.x/patches/b498f4ce3f.patch | 37 ----------- .../patches/declarative_missing_header.diff | 11 ---- ...odules5.15.4.conf => qtmodules5.15.7.conf} | 0 recipes/qt/config.yml | 6 +- 7 files changed, 54 insertions(+), 142 deletions(-) delete mode 100644 recipes/qt/5.x.x/patches/QTBUG-90395.diff delete mode 100644 recipes/qt/5.x.x/patches/b498f4ce3f.patch delete mode 100644 recipes/qt/5.x.x/patches/declarative_missing_header.diff rename recipes/qt/5.x.x/{qtmodules5.15.4.conf => qtmodules5.15.7.conf} (100%) diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index e8ed136ff350b1..1ffad75cd4fb3f 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -1,18 +1,11 @@ sources: - "5.15.4": + "5.15.7": url: - - "https://download.qt.io/archive/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz" - sha256: "615ff68d7af8eef3167de1fd15eac1b150e1fd69d1e2f4239e54447e7797253b" - "5.15.5": - url: - - "https://download.qt.io/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" - sha256: "5a97827bdf9fd515f43bc7651defaf64fecb7a55e051c79b8f80510d0e990f06" + - "https://download.qt.io/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" + sha256: "8a71986676a3f37a198a9113acedbfd5bc5606a459b6b85816d951458adbe9a0" "5.15.6": url: - "https://download.qt.io/archive/qt/5.15/5.15.6/single/qt-everywhere-opensource-src-5.15.6.tar.xz" @@ -20,18 +13,21 @@ sources: - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.6/single/qt-everywhere-opensource-src-5.15.6.tar.xz" - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.6/single/qt-everywhere-opensource-src-5.15.6.tar.xz" sha256: "ebc77d27934b70b25b3dc34fbec7c4471eb451848e891c42b32409ea30fe309f" + "5.15.5": + url: + - "https://download.qt.io/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" + sha256: "5a97827bdf9fd515f43bc7651defaf64fecb7a55e051c79b8f80510d0e990f06" patches: - "5.15.4": + "5.15.7": - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" base_path: "qt5/qtwebengine" - patch_file: "patches/fix-macdeployqt.diff" base_path: "qt5/qttools" - - patch_file: "patches/QTBUG-90395.diff" - base_path: "qt5/qtbase" - - patch_file: "patches/declarative_missing_header.diff" - base_path: "qt5/qtdeclarative" - patch_file: "patches/dece6f5.diff" base_path: "qt5/qtbase" - patch_file: "patches/QTBUG-98813.patch" @@ -40,8 +36,6 @@ patches: base_path: "qt5/qtwebengine/src/3rdparty" - patch_file: "patches/107ed30ec5.patch" base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/b498f4ce3f.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - patch_file: "patches/chromium-v8-missing-constexpr.patch" base_path: "qt5/qtwebengine/src/3rdparty/chromium/v8" - patch_file: "patches/chromium-skia-missing-iterator-include.patch" @@ -50,7 +44,7 @@ patches: base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/skia" - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" base_path: "qt5/qtwebengine/src/3rdparty" - "5.15.5": + "5.15.6": - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" @@ -73,7 +67,7 @@ patches: base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/skia" - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" base_path: "qt5/qtwebengine/src/3rdparty" - "5.15.6": + "5.15.5": - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py index 2f862bb4502129..03097ebe24c617 100644 --- a/recipes/qt/5.x.x/conanfile.py +++ b/recipes/qt/5.x.x/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os from conan.tools.build import build_jobs, check_min_cppstd, cross_building -from conan.tools.files import chdir, get, load, patch, replace_in_file, rm, rmdir, save +from conan.tools.files import chdir, get, load, replace_in_file, rm, rmdir, save, export_conandata_patches, apply_conandata_patches from conan.tools.microsoft import msvc_runtime_flag from conan.tools.scm import Version from conans import tools, RunEnvironment @@ -13,7 +13,7 @@ import os import textwrap -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class qt(Generator): @@ -136,7 +136,7 @@ class QtConan(ConanFile): "config": None, "multiconfiguration": False } - default_options.update({module: False for module in _submodules}) + default_options.update({module: (module in ["qttools", "qttranslations"]) for module in _submodules}) no_copy_source = True short_paths = True @@ -154,8 +154,7 @@ def export(self): self.copy("qtmodules%s.conf" % self.version) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def build_requirements(self): if self._settings_build.os == "Windows" and self._is_msvc: @@ -271,7 +270,7 @@ def configure(self): config = configparser.ConfigParser() config.read(os.path.join(self.recipe_folder, "qtmodules%s.conf" % self.version)) submodules_tree = {} - assert config.sections() + assert config.sections(), f"no qtmodules.conf file for version {self.version}" for s in config.sections(): section = str(s) assert section.startswith("submodule ") @@ -352,7 +351,7 @@ def validate(self): raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.openssl: self.requires("openssl/1.1.1q") if self.options.with_pcre2: @@ -374,7 +373,7 @@ def requirements(self): if self.options.get_safe("with_icu", False): self.requires("icu/71.1") if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration: - self.requires("harfbuzz/5.3.0") + self.requires("harfbuzz/5.3.1") if self.options.get_safe("with_libjpeg", False) and not self.options.multiconfiguration: if self.options.with_libjpeg == "libjpeg-turbo": self.requires("libjpeg-turbo/2.1.4") @@ -408,7 +407,7 @@ def requirements(self): self.requires("opus/1.3.1") self.requires("xorg-proto/2022.2") self.requires("libxshmfence/1.3") - self.requires("nss/3.83") + self.requires("nss/3.84") self.requires("libdrm/2.4.109") self.requires("egl/system") if self.options.get_safe("with_gstreamer", False): @@ -430,8 +429,7 @@ def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, destination="qt5") - for data in self.conan_data.get("patches", {}).get(self.version, []): - patch(self, **data) + apply_conandata_patches(self) for f in ["renderer", os.path.join("renderer", "core"), os.path.join("renderer", "platform")]: replace_in_file(self, os.path.join(self.source_folder, "qt5", "qtwebengine", "src", "3rdparty", "chromium", "third_party", "blink", f, "BUILD.gn"), " if (enable_precompiled_headers) {\n if (is_win) {", @@ -933,7 +931,13 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "Qt5" self.cpp_info.names["cmake_find_package_multi"] = "Qt5" - build_modules = [] + build_modules = {} + def _add_build_module(component, module): + if component not in build_modules: + build_modules[component] = [] + build_modules[component].append(module) + self.cpp_info.components[component].build_modules["cmake_find_package"].append(module) + self.cpp_info.components[component].build_modules["cmake_find_package_multi"].append(module) libsuffix = "" if not self.options.multiconfiguration: @@ -1031,9 +1035,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.with_md4c: gui_reqs.append("md4c::md4c") _create_module("Gui", gui_reqs) - build_modules.append(self._cmake_qt5_private_file("Gui")) - self.cpp_info.components["qtGui"].build_modules["cmake_find_package"].append(self._cmake_qt5_private_file("Gui")) - self.cpp_info.components["qtGui"].build_modules["cmake_find_package_multi"].append(self._cmake_qt5_private_file("Gui")) + _add_build_module("qtGui", self._cmake_qt5_private_file("Gui")) event_dispatcher_reqs = ["Core", "Gui"] if self.options.with_glib: @@ -1136,9 +1138,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): _create_module("Test") if self.options.widgets: _create_module("Widgets", ["Gui"]) - build_modules.append(self._cmake_qt5_private_file("Widgets")) - self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package"].append(self._cmake_qt5_private_file("Widgets")) - self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package_multi"].append(self._cmake_qt5_private_file("Widgets")) + _add_build_module("qtWidgets", self._cmake_qt5_private_file("Widgets")) if self.options.gui and self.options.widgets and not self.settings.os in ["iOS", "watchOS", "tvOS"]: _create_module("PrintSupport", ["Gui", "Widgets"]) if self.settings.os == "Macos" and not self.options.shared: @@ -1154,9 +1154,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.qtdeclarative: _create_module("Qml", ["Network"]) - build_modules.append(self._cmake_qt5_private_file("Qml")) - self.cpp_info.components["qtQml"].build_modules["cmake_find_package"].append(self._cmake_qt5_private_file("Qml")) - self.cpp_info.components["qtQml"].build_modules["cmake_find_package_multi"].append(self._cmake_qt5_private_file("Qml")) + _add_build_module("qtQml", self._cmake_qt5_private_file("Qml")) _create_module("QmlModels", ["Qml"]) self.cpp_info.components["qtQmlImportScanner"].set_property("cmake_target_name", "Qt5::QmlImportScanner") self.cpp_info.components["qtQmlImportScanner"].names["cmake_find_package"] = "QmlImportScanner" # this is an alias for Qml and there to integrate with existing consumers @@ -1407,20 +1405,14 @@ def _create_plugin(pluginname, libname, plugintype, requires): self.cpp_info.components["qtCore"].frameworks.append("Security") # qtcore requires "_SecRequirementCreateWithString" and more, which are in "Security" framework self.cpp_info.components["qtCore"].builddirs.append(os.path.join("bin","archdatadir","bin")) - build_modules.append(self._cmake_core_extras_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_core_extras_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_core_extras_file) - build_modules.append(self._cmake_qt5_private_file("Core")) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_qt5_private_file("Core")) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_qt5_private_file("Core")) + _add_build_module("qtCore", self._cmake_core_extras_file) + _add_build_module("qtCore", self._cmake_qt5_private_file("Core")) for m in os.listdir(os.path.join("lib", "cmake")): module = os.path.join("lib", "cmake", m, "%sMacros.cmake" % m) component_name = m.replace("Qt5", "qt") if os.path.isfile(module): - build_modules.append(module) - self.cpp_info.components[component_name].build_modules["cmake_find_package"].append(module) - self.cpp_info.components[component_name].build_modules["cmake_find_package_multi"].append(module) + _add_build_module(component_name, module) self.cpp_info.components[component_name].builddirs.append(os.path.join("lib", "cmake", m)) qt5core_config_extras_mkspec_dir_cmake = load(self, @@ -1445,7 +1437,19 @@ def _create_plugin(pluginname, libname, plugintype, requires): self.cpp_info.components[component].exelinkflags.extend(obj_files) self.cpp_info.components[component].sharedlinkflags.extend(obj_files) - self.cpp_info.set_property("cmake_build_modules", build_modules) + build_modules_list = [] + + def _add_build_modules_for_component(component): + for req in self.cpp_info.components[component].requires: + if "::" in req: # not a qt component + continue + _add_build_modules_for_component(req) + build_modules_list.extend(build_modules.pop(component, [])) + + for c in self.cpp_info.components: + _add_build_modules_for_component(c) + + self.cpp_info.set_property("cmake_build_modules", build_modules_list) @staticmethod def _remove_duplicate(l): diff --git a/recipes/qt/5.x.x/patches/QTBUG-90395.diff b/recipes/qt/5.x.x/patches/QTBUG-90395.diff deleted file mode 100644 index 9d391311c34556..00000000000000 --- a/recipes/qt/5.x.x/patches/QTBUG-90395.diff +++ /dev/null @@ -1,38 +0,0 @@ -Description: include to fix some GCC 11 build issues -Origin: upstream, commits: - https://code.qt.io/cgit/qt/qtbase.git/commit/?id=813a928c7c3cf986 - https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9c56d4da2ff631a8 -Last-Update: 2021-01-26 - ---- a/src/corelib/global/qendian.h -+++ b/src/corelib/global/qendian.h -@@ -44,6 +44,8 @@ - #include - #include - -+#include -+ - // include stdlib.h and hope that it defines __GLIBC__ for glibc-based systems - #include - #include ---- a/src/corelib/global/qfloat16.h -+++ b/src/corelib/global/qfloat16.h -@@ -43,6 +43,7 @@ - - #include - #include -+#include - #include - - #if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__AVX2__) && !defined(__F16C__) ---- a/src/corelib/text/qbytearraymatcher.h -+++ b/src/corelib/text/qbytearraymatcher.h -@@ -42,6 +42,8 @@ - - #include - -+#include -+ - QT_BEGIN_NAMESPACE - - diff --git a/recipes/qt/5.x.x/patches/b498f4ce3f.patch b/recipes/qt/5.x.x/patches/b498f4ce3f.patch deleted file mode 100644 index 60ad749a0917d6..00000000000000 --- a/recipes/qt/5.x.x/patches/b498f4ce3f.patch +++ /dev/null @@ -1,37 +0,0 @@ -From b498f4ce3f542882767238ea9f01eb85de6c6fda Mon Sep 17 00:00:00 2001 -From: Peter Varga -Date: Tue, 18 May 2021 09:11:49 +0200 -Subject: [PATCH] Fix build with GCC 11 - -Change-Id: Ifc73421768e2c6123225064314d39d8479ea4ed8 -Fixes: QTBUG-93824 -Reviewed-by: Allan Sandfeld Jensen ---- - .../abseil-cpp/absl/synchronization/internal/graphcycles.cc | 1 + - .../perfetto/src/trace_processor/containers/string_pool.h | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc b/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc -index 19f9aab5b1a..27fec21681d 100644 ---- a/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc -+++ b/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc -@@ -37,6 +37,7 @@ - - #include - #include -+#include - #include "absl/base/internal/hide_ptr.h" - #include "absl/base/internal/raw_logging.h" - #include "absl/base/internal/spinlock.h" -diff --git a/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h b/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h -index 11ae91cfeca..6b76b74c91b 100644 ---- a/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h -+++ b/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h -@@ -17,6 +17,7 @@ - #ifndef SRC_TRACE_PROCESSOR_CONTAINERS_STRING_POOL_H_ - #define SRC_TRACE_PROCESSOR_CONTAINERS_STRING_POOL_H_ - -+#include - #include - #include - diff --git a/recipes/qt/5.x.x/patches/declarative_missing_header.diff b/recipes/qt/5.x.x/patches/declarative_missing_header.diff deleted file mode 100644 index 3422534c423c6b..00000000000000 --- a/recipes/qt/5.x.x/patches/declarative_missing_header.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/qmldebug/qqmlprofilerevent_p.h -+++ b/src/qmldebug/qqmlprofilerevent_p.h -@@ -49,7 +49,7 @@ - - #include - #include -- -+#include - // - // W A R N I N G - // ------------- diff --git a/recipes/qt/5.x.x/qtmodules5.15.4.conf b/recipes/qt/5.x.x/qtmodules5.15.7.conf similarity index 100% rename from recipes/qt/5.x.x/qtmodules5.15.4.conf rename to recipes/qt/5.x.x/qtmodules5.15.7.conf diff --git a/recipes/qt/config.yml b/recipes/qt/config.yml index 4291074f66a3b1..71933750fc704a 100644 --- a/recipes/qt/config.yml +++ b/recipes/qt/config.yml @@ -1,10 +1,10 @@ versions: - "5.15.4": - folder: 5.x.x - "5.15.5": + "5.15.7": folder: 5.x.x "5.15.6": folder: 5.x.x + "5.15.5": + folder: 5.x.x "6.1.3": folder: 6.x.x "6.2.4": From c9e95d8188082fe6c811145e88b40445790907a6 Mon Sep 17 00:00:00 2001 From: schoetbi Date: Sun, 30 Oct 2022 09:24:04 +0100 Subject: [PATCH 253/300] (#13635) updated flatbuffers 22.9.24 and 22.9.29 Added flatbuffers 22.9.24 --- recipes/flatbuffers/all/conandata.yml | 6 ++++++ recipes/flatbuffers/config.yml | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/recipes/flatbuffers/all/conandata.yml b/recipes/flatbuffers/all/conandata.yml index e9889e6085f44c..e4764dfb0f82a3 100644 --- a/recipes/flatbuffers/all/conandata.yml +++ b/recipes/flatbuffers/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "22.9.29": + url: "https://github.com/google/flatbuffers/archive/refs/tags/v22.9.29.tar.gz" + sha256: "372df01795c670f6538055a7932fc7eb3e81b3653be4a216c081e9c3c26b1b6d" + "22.9.24": + url: "https://github.com/google/flatbuffers/archive/refs/tags/v22.9.24.tar.gz" + sha256: "40e0788873012def4d66a2fdbac15fbe012784473c01a703ccb5be33383556bf" "2.0.8": url: "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.8.tar.gz" sha256: "f97965a727d26386afaefff950badef2db3ab6af9afe23ed6d94bfb65f95f37e" diff --git a/recipes/flatbuffers/config.yml b/recipes/flatbuffers/config.yml index 35c8973207d4cc..359f2ddaa5b81f 100644 --- a/recipes/flatbuffers/config.yml +++ b/recipes/flatbuffers/config.yml @@ -1,4 +1,8 @@ versions: + "22.9.29": + folder: all + "22.9.24": + folder: all "2.0.8": folder: all "2.0.6": From 1dfd47eecaab58265deea6c0208504c23055c8e3 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 30 Oct 2022 11:44:32 +0100 Subject: [PATCH 254/300] (#13868) Bump draco/1.5.5 --- recipes/draco/all/conandata.yml | 3 +++ recipes/draco/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/draco/all/conandata.yml b/recipes/draco/all/conandata.yml index e60ef8b61cbf0b..5105546d4c2a2b 100644 --- a/recipes/draco/all/conandata.yml +++ b/recipes/draco/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5.5": + url: "https://github.com/google/draco/archive/refs/tags/1.5.5.tar.gz" + sha256: "6b7994150bbc513abcdbe22ad778d6b2df10fc8cdc7035e916985b2a209ab826" "1.5.4": url: "https://github.com/google/draco/archive/refs/tags/1.5.4.tar.gz" sha256: "7698cce91c24725562fb73811d24823f0f0a25e3ac0941e792993c5191d3baee" diff --git a/recipes/draco/config.yml b/recipes/draco/config.yml index e0e89faa27b30a..1d0bf1ab356f53 100644 --- a/recipes/draco/config.yml +++ b/recipes/draco/config.yml @@ -1,4 +1,6 @@ versions: + "1.5.5": + folder: all "1.5.4": folder: all "1.5.3": From ee4bd625572b1cb7b3a5240e4d993f5f34156717 Mon Sep 17 00:00:00 2001 From: toge Date: Sun, 30 Oct 2022 23:44:59 +0900 Subject: [PATCH 255/300] (#13871) daw_utf_range: update dependencies --- recipes/daw_utf_range/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/daw_utf_range/all/conanfile.py b/recipes/daw_utf_range/all/conanfile.py index d9974b561af310..cc060a4492ccd1 100644 --- a/recipes/daw_utf_range/all/conanfile.py +++ b/recipes/daw_utf_range/all/conanfile.py @@ -36,7 +36,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("daw_header_libraries/2.72.0") + self.requires("daw_header_libraries/2.73.1") def package_id(self): self.info.clear() From e8ba8ec47cae8e50d09fe4afe5e889c8698b7c42 Mon Sep 17 00:00:00 2001 From: toge Date: Mon, 31 Oct 2022 01:26:05 +0900 Subject: [PATCH 256/300] (#13873) daw_json_link: update dependencies --- recipes/daw_json_link/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/daw_json_link/all/conanfile.py b/recipes/daw_json_link/all/conanfile.py index b69ebd0801b47f..074aa2b014a8e0 100644 --- a/recipes/daw_json_link/all/conanfile.py +++ b/recipes/daw_json_link/all/conanfile.py @@ -38,7 +38,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("daw_header_libraries/2.72.0") + self.requires("daw_header_libraries/2.73.1") self.requires("daw_utf_range/2.2.2") def package_id(self): From c936e6a467f3aaebb3475636dc4772532ccd8f1f Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 1 Nov 2022 02:16:22 +0900 Subject: [PATCH 257/300] (#13895) utf8proc: add version 2.8.0 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/utf8proc/all/conandata.yml | 3 +++ recipes/utf8proc/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/utf8proc/all/conandata.yml b/recipes/utf8proc/all/conandata.yml index 51d38ebd768e5e..2e408e9011b374 100644 --- a/recipes/utf8proc/all/conandata.yml +++ b/recipes/utf8proc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.8.0": + url: "https://github.com/JuliaStrings/utf8proc/archive/v2.8.0.tar.gz" + sha256: "a0a60a79fe6f6d54e7d411facbfcc867a6e198608f2cd992490e46f04b1bcecc" "2.7.0": url: "https://github.com/JuliaStrings/utf8proc/archive/v2.7.0.tar.gz" sha256: "4bb121e297293c0fd55f08f83afab6d35d48f0af4ecc07523ad8ec99aa2b12a1" diff --git a/recipes/utf8proc/config.yml b/recipes/utf8proc/config.yml index 89fa84c7728400..44b916f7f7e88e 100644 --- a/recipes/utf8proc/config.yml +++ b/recipes/utf8proc/config.yml @@ -1,4 +1,6 @@ versions: + "2.8.0": + folder: all "2.7.0": folder: all "2.6.1": From 2fc42d1488d5bf29af9aad1c16a0f2f112db1110 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Tue, 1 Nov 2022 02:08:43 +0800 Subject: [PATCH 258/300] (#13793) cli11: conan v2 support * cli11: conan v2 support * Fix for test_v1_package * Apply suggestions from code review Co-authored-by: Uilian Ries * Update recipes/cli11/all/test_v1_package/CMakeLists.txt Co-authored-by: toge Co-authored-by: Uilian Ries Co-authored-by: toge --- recipes/cli11/all/conanfile.py | 53 +++++++++++++------ recipes/cli11/all/test_package/CMakeLists.txt | 10 ++-- recipes/cli11/all/test_package/conanfile.py | 21 +++++--- .../cli11/all/test_v1_package/CMakeLists.txt | 8 +++ .../cli11/all/test_v1_package/conanfile.py | 17 ++++++ 5 files changed, 80 insertions(+), 29 deletions(-) create mode 100644 recipes/cli11/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/cli11/all/test_v1_package/conanfile.py diff --git a/recipes/cli11/all/conanfile.py b/recipes/cli11/all/conanfile.py index bf1a635513afa9..6ccc240eeda4f9 100644 --- a/recipes/cli11/all/conanfile.py +++ b/recipes/cli11/all/conanfile.py @@ -1,45 +1,64 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.build import check_min_cppstd import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class CLI11Conan(ConanFile): name = "cli11" homepage = "https://github.com/CLIUtils/CLI11" description = "A command line parser for C++11 and beyond." - topics = ("cli-parser", "cpp11", "no-dependencies", "cli", "header-only") + topics = "cli-parser", "cpp11", "no-dependencies", "cli", "header-only" url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" settings = "os", "compiler", "build_type", "arch" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "11" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CLI11_BUILD_EXAMPLES"] = False + tc.variables["CLI11_BUILD_TESTS"] = False + tc.variables["CLI11_BUILD_DOCS"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) cmake = CMake(self) - cmake.definitions["CLI11_BUILD_EXAMPLES"] = False - cmake.definitions["CLI11_BUILD_TESTS"] = False - cmake.definitions["CLI11_BUILD_DOCS"] = False - cmake.configure(source_folder=self._source_subfolder) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # since 2.1.1 - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_id(self): - self.info.header_only() + self.info.clear() def package_info(self): - self.cpp_info.set_property("cmake_target_name", "CLI11::CLI11") self.cpp_info.set_property("cmake_file_name", "CLI11") + self.cpp_info.set_property("cmake_target_name", "CLI11::CLI11") self.cpp_info.set_property("pkg_config_name", "CLI11") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "CLI11" self.cpp_info.names["cmake_find_package_multi"] = "CLI11" self.cpp_info.names["pkg_config"] = "CLI11" diff --git a/recipes/cli11/all/test_package/CMakeLists.txt b/recipes/cli11/all/test_package/CMakeLists.txt index 8f4fafc076f521..0b06b681b89979 100644 --- a/recipes/cli11/all/test_package/CMakeLists.txt +++ b/recipes/cli11/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(CLI11 REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_link_libraries(${CMAKE_PROJECT_NAME} CLI11::CLI11) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE CLI11::CLI11) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cli11/all/test_package/conanfile.py b/recipes/cli11/all/test_package/conanfile.py index b30e638816fc58..a9fb96656f2039 100644 --- a/recipes/cli11/all/test_package/conanfile.py +++ b/recipes/cli11/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package_multi", "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin","test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cli11/all/test_v1_package/CMakeLists.txt b/recipes/cli11/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..145dcc03e0f3d1 --- /dev/null +++ b/recipes/cli11/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cli11/all/test_v1_package/conanfile.py b/recipes/cli11/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..b30e638816fc58 --- /dev/null +++ b/recipes/cli11/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake_find_package_multi", "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin","test_package") + self.run(bin_path, run_environment=True) From 68050a72da26d5b080e12ef2886983af51771625 Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 1 Nov 2022 08:06:33 +0900 Subject: [PATCH 259/300] (#13884) boost: update zlib --- recipes/boost/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/boost/all/conanfile.py b/recipes/boost/all/conanfile.py index cc2f76d2b68087..651bf5cd0d3c1b 100644 --- a/recipes/boost/all/conanfile.py +++ b/recipes/boost/all/conanfile.py @@ -532,7 +532,7 @@ def _with_stacktrace_backtrace(self): def requirements(self): if self._with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self._with_bzip2: self.requires("bzip2/1.0.8") if self._with_lzma: From a2b083f365573fa093e92e1534f3e69fcbe4719a Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 1 Nov 2022 02:46:42 +0100 Subject: [PATCH 260/300] (#13905) openexr: bump zlib --- recipes/openexr/2.x/conanfile.py | 2 +- recipes/openexr/3.x/conanfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/openexr/2.x/conanfile.py b/recipes/openexr/2.x/conanfile.py index 871879a5c3f881..e6fecd0261780b 100644 --- a/recipes/openexr/2.x/conanfile.py +++ b/recipes/openexr/2.x/conanfile.py @@ -39,7 +39,7 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if Version(self.version) < "2.5.0" and hasattr(self, "settings_build") and cross_building(self): diff --git a/recipes/openexr/3.x/conanfile.py b/recipes/openexr/3.x/conanfile.py index 7d9caddb48d9fc..8f95edf1a7078d 100644 --- a/recipes/openexr/3.x/conanfile.py +++ b/recipes/openexr/3.x/conanfile.py @@ -40,7 +40,7 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") # Note: OpenEXR and Imath are versioned independently. self.requires("imath/3.1.5") From 0dd59cd8c0c0ee54ae165aa8dfb0aecdd47fcf9e Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 1 Nov 2022 11:45:13 +0900 Subject: [PATCH 261/300] (#13911) etl: add version 20.35.0 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/etl/all/conandata.yml | 3 +++ recipes/etl/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/etl/all/conandata.yml b/recipes/etl/all/conandata.yml index a2883e8b77a597..28a7b9e5386ab2 100644 --- a/recipes/etl/all/conandata.yml +++ b/recipes/etl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "20.35.0": + url: "https://github.com/ETLCPP/etl/archive/20.35.0.tar.gz" + sha256: "1bfbc5679bce41625add0e5d7354ab8521dc4811f13e1627a9816af65f49f42b" "20.34.0": url: "https://github.com/ETLCPP/etl/archive/20.34.0.tar.gz" sha256: "56e25968f20167a161ee50c3eecda3daa91f696660ba59654c1afd22e502c465" diff --git a/recipes/etl/config.yml b/recipes/etl/config.yml index d9aa5dd96d1e94..00ddf8566d799b 100644 --- a/recipes/etl/config.yml +++ b/recipes/etl/config.yml @@ -1,4 +1,6 @@ versions: + "20.35.0": + folder: all "20.34.0": folder: all "20.33.0": From 9bbdf5318b079afc0e3d5bcfedfb1309b1e080d3 Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 1 Nov 2022 13:46:30 +0900 Subject: [PATCH 262/300] (#13909) thrift: update dependencies --- recipes/thrift/all/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/thrift/all/conanfile.py b/recipes/thrift/all/conanfile.py index 341979c20ba156..1403d889a9ab8b 100644 --- a/recipes/thrift/all/conanfile.py +++ b/recipes/thrift/all/conanfile.py @@ -64,15 +64,15 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") if self.options.with_openssl: self.requires("openssl/1.1.1q") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_libevent: self.requires("libevent/2.1.12") if self.options.with_qt5: - self.requires("qt/5.15.4") + self.requires("qt/5.15.7") def build_requirements(self): # TODO: use is_msvc with build_context in conan >=1.52.0 (see https://github.com/conan-io/conan/pull/11949) From 0c568c31225d8fa9d4d0766b7e4b16aa5bdac9cb Mon Sep 17 00:00:00 2001 From: toge Date: Tue, 1 Nov 2022 21:46:56 +0900 Subject: [PATCH 263/300] (#13915) glaze: add version 0.1.2 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/glaze/all/conandata.yml | 3 +++ recipes/glaze/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/glaze/all/conandata.yml b/recipes/glaze/all/conandata.yml index 3d4f2f48f098bb..4d798c50cbfc4e 100644 --- a/recipes/glaze/all/conandata.yml +++ b/recipes/glaze/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.2": + url: "https://github.com/stephenberry/glaze/archive/v0.1.2.tar.gz" + sha256: "5de894dbad95a773a7b1e3c43eeb42ec79bf30bc04355d4d055db0cba1ae52db" "0.1.0": url: "https://github.com/stephenberry/glaze/archive/v0.1.0.tar.gz" sha256: "bb709637217b68c835c5c17d49d6e1d10682a9fb5d3899b4452f737f64961a67" diff --git a/recipes/glaze/config.yml b/recipes/glaze/config.yml index 43d3b0291396c1..9f71c0e5cdfaea 100644 --- a/recipes/glaze/config.yml +++ b/recipes/glaze/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.2": + folder: all "0.1.0": folder: all "0.0.7": From a35c5c385115403e34aa0157729392b1f51074d5 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 1 Nov 2022 18:06:03 +0100 Subject: [PATCH 264/300] (#13814) [docs] Document inactive users process * Document inactiver users Signed-off-by: Uilian Ries * Move next to acces request Signed-off-by: Uilian Ries * Faqs points to access request section Signed-off-by: Uilian Ries * Update docs/how_to_add_packages.md Co-authored-by: Daniel * Update docs/how_to_add_packages.md Co-authored-by: Daniel Signed-off-by: Uilian Ries Co-authored-by: Daniel --- docs/faqs.md | 4 ++++ docs/how_to_add_packages.md | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/faqs.md b/docs/faqs.md index 7520683aecc5ec..2df8702454f5d1 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -409,3 +409,7 @@ merging to the master branch. Feel free to contribute to a new Github Action tha No. The [pylint](v2_linter.md) has an important role of keeping any recipe prepared for [Conan v2 migration](v2_migration.md). In case you are having difficult to understand [linter errors](linters.md), please comment on your pull request about the problem to receive help from the community. + +## How long can I be inactive before being removed from the authorized users list? + +Please, read [Inactivity and user removal section](how_to_add_packages.md#inactivity-and-user-removal). diff --git a/docs/how_to_add_packages.md b/docs/how_to_add_packages.md index 778b437005387e..b73ca6d23ce6fe 100644 --- a/docs/how_to_add_packages.md +++ b/docs/how_to_add_packages.md @@ -45,6 +45,14 @@ This process helps conan-center-index against spam and malicious code. The proce When submitting a pull request for the first time, you will be prompted to sign the [CLA](CONTRIBUTOR_LICENSE_AGREEMENT.md) for your code contributions. You can view your signed CLA's by going to and signing in. + +## Inactivity and user removal + +For security reasons related to the CI, when a user no longer contributes for a long period, it will be considered inactive and removed from the authorized user's list. +For now, it's configured for **4 months**, and it's computed based on the latest commit, not comments or opened issues. +After that time, the CI bot will ask to remove the user name from the authorized users' list through the access request PR, which occurs a few times every week. +In case you are interested in coming back, please, ask again to be included in the issue [#4](https://github.com/conan-io/conan-center-index/issues/4), the process will be precise like for newcomers. + ## Submitting a Package :two: To contribute a package, you can submit a [Pull Request](https://github.com/conan-io/conan-center-index/pulls) to this GitHub repository https://github.com/conan-io/conan-center-index. From ead3630cfda6ecafa276ce82d359a942234cd19d Mon Sep 17 00:00:00 2001 From: Xianda Ke Date: Wed, 2 Nov 2022 01:26:05 +0800 Subject: [PATCH 265/300] (#13833) add gtest v1.10.0 support * add gtest v1.10.0 support there is a compatible issue in version > 1.10.0. 'enum class' is forced to use ADL lookup, and what's more, the template<> version does not work. The user has to write lots of customized funciton operator<<() to pass compiling, it is a bit annoying. Add 1.10.0 support for convenience. * address review comments * address code-review comments --- recipes/gtest/all/conandata.yml | 12 + recipes/gtest/all/conanfile.py | 48 +- .../all/patches/gtest-1.10.0-override.patch | 450 ++++++++++++++++++ recipes/gtest/all/patches/gtest-1.10.0.patch | 13 + recipes/gtest/config.yml | 2 + 5 files changed, 515 insertions(+), 10 deletions(-) create mode 100644 recipes/gtest/all/patches/gtest-1.10.0-override.patch create mode 100644 recipes/gtest/all/patches/gtest-1.10.0.patch diff --git a/recipes/gtest/all/conandata.yml b/recipes/gtest/all/conandata.yml index 4339f47aabf119..57289aca6e374f 100644 --- a/recipes/gtest/all/conandata.yml +++ b/recipes/gtest/all/conandata.yml @@ -2,3 +2,15 @@ sources: "1.12.1": url: "https://github.com/google/googletest/archive/release-1.12.1.tar.gz" sha256: "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2" + "1.10.0": + url: "https://github.com/google/googletest/archive/release-1.10.0.tar.gz" + sha256: "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb" +patches: + "1.10.0": + - patch_file: "patches/gtest-1.10.0.patch" + patch_description: "add CUSTOM_DEBUG_POSTFIX option" + patch_type: "conan" + - patch_file: "patches/gtest-1.10.0-override.patch" + patch_description: "prevent compiler from complaining while compiling" + patch_type: "backport" + patch_source: "https://github.com/google/googletest/pull/2507" diff --git a/recipes/gtest/all/conanfile.py b/recipes/gtest/all/conanfile.py index 967828a11c68b5..264c3cfc9fb2fe 100644 --- a/recipes/gtest/all/conanfile.py +++ b/recipes/gtest/all/conanfile.py @@ -3,11 +3,12 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd -from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, replace_in_file, rm, rmdir from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.52.0" class GTestConan(ConanFile): @@ -53,9 +54,19 @@ def _minimum_compilers_version(self): def _is_clang_cl(self): return self.settings.os == "Windows" and self.settings.compiler == "clang" + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "1.12.0" and self.settings.build_type != "Debug": + del self.options.debug_postfix + + if Version(self.version) < "1.12.0" and self.settings.build_type == "Debug": + if self.options.debug_postfix == "deprecated": + # in 1.10.0, use 'd' as default + self.default_options["debug_postfix"] = "d" def configure(self): if self.options.shared: @@ -63,8 +74,9 @@ def configure(self): del self.options.fPIC except Exception: pass - if self.options.debug_postfix != "deprecated": - self.output.warn("gtest/*:debug_postfix is deprecated.") + if Version(self.version) >= "1.12.0": + if self.options.debug_postfix != "deprecated": + self.output.warn(f"{self.ref}:debug_postfix is deprecated in 1.12.0.") def layout(self): cmake_layout(self, src_folder="src") @@ -105,6 +117,10 @@ def generate(self): tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.variables["BUILD_GMOCK"] = bool(self.options.build_gmock) tc.variables["gtest_hide_internal_symbols"] = bool(self.options.hide_symbols) + + if self.settings.build_type == "Debug" and Version(self.version) < "1.12.0": + tc.cache_variables["CUSTOM_DEBUG_POSTFIX"] = str(self.options.debug_postfix) + if is_msvc(self) or self._is_clang_cl: tc.variables["gtest_force_shared_crt"] = not is_msvc_static_runtime(self) if self.settings.os == "Windows" and self.settings.compiler == "gcc": @@ -112,10 +128,15 @@ def generate(self): tc.generate() def _patch_sources(self): + internal_utils = os.path.join(self.source_folder, "googletest", + "cmake", "internal_utils.cmake") + apply_conandata_patches(self) + if Version(self.version) < "1.12.0": + replace_in_file(self, internal_utils, "-Werror", "") + if is_msvc(self) or self._is_clang_cl: # No warnings as errors - replace_in_file(self, os.path.join(self.source_folder, "googletest", - "cmake", "internal_utils.cmake"), "-WX", "") + replace_in_file(self, internal_utils, "-WX", "") def build(self): self._patch_sources() @@ -131,6 +152,13 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + @property + def _postfix(self): + # In 1.12.0, gtest remove debug postfix. + if Version(self.version) >= "1.12.0": + return "" + return self.options.debug_postfix if self.settings.build_type == "Debug" else "" + def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "GTest") @@ -139,7 +167,7 @@ def package_info(self): self.cpp_info.components["libgtest"].set_property("cmake_target_name", "GTest::gtest") self.cpp_info.components["libgtest"].set_property("cmake_target_aliases", ["GTest::GTest"]) self.cpp_info.components["libgtest"].set_property("pkg_config_name", "gtest") - self.cpp_info.components["libgtest"].libs = ["gtest"] + self.cpp_info.components["libgtest"].libs = [f"gtest{self._postfix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libgtest"].system_libs.append("m") self.cpp_info.components["libgtest"].system_libs.append("pthread") @@ -153,21 +181,21 @@ def package_info(self): self.cpp_info.components["gtest_main"].set_property("cmake_target_name", "GTest::gtest_main") self.cpp_info.components["gtest_main"].set_property("cmake_target_aliases", ["GTest::Main"]) self.cpp_info.components["gtest_main"].set_property("pkg_config_name", "gtest_main") - self.cpp_info.components["gtest_main"].libs = ["gtest_main"] + self.cpp_info.components["gtest_main"].libs = [f"gtest_main{self._postfix}"] self.cpp_info.components["gtest_main"].requires = ["libgtest"] # gmock if self.options.build_gmock: self.cpp_info.components["gmock"].set_property("cmake_target_name", "GTest::gmock") self.cpp_info.components["gmock"].set_property("pkg_config_name", "gmock") - self.cpp_info.components["gmock"].libs = ["gmock"] + self.cpp_info.components["gmock"].libs = [f"gmock{self._postfix}"] self.cpp_info.components["gmock"].requires = ["libgtest"] # gmock_main if not self.options.no_main: self.cpp_info.components["gmock_main"].set_property("cmake_target_name", "GTest::gmock_main") self.cpp_info.components["gmock_main"].set_property("pkg_config_name", "gmock_main") - self.cpp_info.components["gmock_main"].libs = ["gmock_main"] + self.cpp_info.components["gmock_main"].libs = [f"gmock_main{self._postfix}"] self.cpp_info.components["gmock_main"].requires = ["gmock"] # TODO: to remove in conan v2 once cmake_find_package_* generators removed diff --git a/recipes/gtest/all/patches/gtest-1.10.0-override.patch b/recipes/gtest/all/patches/gtest-1.10.0-override.patch new file mode 100644 index 00000000000000..1757bf31074459 --- /dev/null +++ b/recipes/gtest/all/patches/gtest-1.10.0-override.patch @@ -0,0 +1,450 @@ +From 3cddd56e195b516f449bea6dcd3edd4494195631 Mon Sep 17 00:00:00 2001 +From: Robert Luberda +Date: Wed, 9 Oct 2019 21:48:00 +0200 +Subject: [PATCH] Add more override keywords + +Mark more functions with "override" keyword, just like +it was done in commit 2460f97152c. + +This should prevent compiler from complaining while compiling both +user code, and the googletest code itself with the -Wsuggest-override +option turned on; with the exception of: + * calls to new MOCK_METHOD() in test/gmock-function-mocker_test.cc + * calls to old MOCK_METHODx()/MOCK_CONST_METHODx() in other + unit test files. + +Closes #2493 +--- + .../include/gmock/gmock-generated-actions.h | 24 ++--- + .../gmock/gmock-generated-actions.h.pump | 4 +- + .../include/gmock/gmock-generated-matchers.h | 88 +++++++++---------- + .../gmock/gmock-generated-matchers.h.pump | 8 +- + googletest/include/gtest/gtest-typed-test.h | 4 +- + .../include/gtest/internal/gtest-port.h | 4 +- + googletest/test/gtest_unittest.cc | 4 +- + 7 files changed, 68 insertions(+), 68 deletions(-) + +diff --git a/googlemock/include/gmock/gmock-generated-actions.h b/googlemock/include/gmock/gmock-generated-actions.h +index 981af78ff..cee96dae8 100644 +--- a/googlemock/include/gmock/gmock-generated-actions.h ++++ b/googlemock/include/gmock/gmock-generated-actions.h +@@ -663,7 +663,7 @@ class ActionHelper { + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -726,7 +726,7 @@ class ActionHelper { + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + gmock_Impl() {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -776,7 +776,7 @@ class ActionHelper { + args_type;\ + explicit gmock_Impl(p0##_type gmock_p0) : \ + p0(::std::forward(gmock_p0)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -832,7 +832,7 @@ class ActionHelper { + gmock_Impl(p0##_type gmock_p0, \ + p1##_type gmock_p1) : p0(::std::forward(gmock_p0)), \ + p1(::std::forward(gmock_p1)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -893,7 +893,7 @@ class ActionHelper { + p2##_type gmock_p2) : p0(::std::forward(gmock_p0)), \ + p1(::std::forward(gmock_p1)), \ + p2(::std::forward(gmock_p2)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -961,7 +961,7 @@ class ActionHelper { + p1(::std::forward(gmock_p1)), \ + p2(::std::forward(gmock_p2)), \ + p3(::std::forward(gmock_p3)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -1038,7 +1038,7 @@ class ActionHelper { + p2(::std::forward(gmock_p2)), \ + p3(::std::forward(gmock_p3)), \ + p4(::std::forward(gmock_p4)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -1119,7 +1119,7 @@ class ActionHelper { + p3(::std::forward(gmock_p3)), \ + p4(::std::forward(gmock_p4)), \ + p5(::std::forward(gmock_p5)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -1206,7 +1206,7 @@ class ActionHelper { + p4(::std::forward(gmock_p4)), \ + p5(::std::forward(gmock_p5)), \ + p6(::std::forward(gmock_p6)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -1302,7 +1302,7 @@ class ActionHelper { + p5(::std::forward(gmock_p5)), \ + p6(::std::forward(gmock_p6)), \ + p7(::std::forward(gmock_p7)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -1404,7 +1404,7 @@ class ActionHelper { + p6(::std::forward(gmock_p6)), \ + p7(::std::forward(gmock_p7)), \ + p8(::std::forward(gmock_p8)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -1513,7 +1513,7 @@ class ActionHelper { + p7(::std::forward(gmock_p7)), \ + p8(::std::forward(gmock_p8)), \ + p9(::std::forward(gmock_p9)) {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +diff --git a/googlemock/include/gmock/gmock-generated-actions.h.pump b/googlemock/include/gmock/gmock-generated-actions.h.pump +index 209603c5a..283abcdc2 100644 +--- a/googlemock/include/gmock/gmock-generated-actions.h.pump ++++ b/googlemock/include/gmock/gmock-generated-actions.h.pump +@@ -395,7 +395,7 @@ $range k 0..n-1 + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +@@ -482,7 +482,7 @@ $var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]] + typedef typename ::testing::internal::Function::ArgumentTuple\ + args_type;\ + [[$if i==1 [[explicit ]]]]gmock_Impl($ctor_param_list)$inits {}\ +- virtual return_type Perform(const args_type& args) {\ ++ return_type Perform(const args_type& args) override {\ + return ::testing::internal::ActionHelper::\ + Perform(this, args);\ + }\ +diff --git a/googlemock/include/gmock/gmock-generated-matchers.h b/googlemock/include/gmock/gmock-generated-matchers.h +index 690a57f1c..61892380c 100644 +--- a/googlemock/include/gmock/gmock-generated-matchers.h ++++ b/googlemock/include/gmock/gmock-generated-matchers.h +@@ -269,13 +269,13 @@ + public:\ + gmock_Impl()\ + {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + private:\ +@@ -318,13 +318,13 @@ + public:\ + explicit gmock_Impl(p0##_type gmock_p0)\ + : p0(::std::move(gmock_p0)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +@@ -371,13 +371,13 @@ + public:\ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ + : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +@@ -431,13 +431,13 @@ + gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ + : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +@@ -495,13 +495,13 @@ + p3##_type gmock_p3)\ + : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +@@ -568,13 +568,13 @@ + : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +@@ -644,13 +644,13 @@ + : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \ + p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +@@ -726,13 +726,13 @@ + p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ + p6(::std::move(gmock_p6)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +@@ -814,13 +814,13 @@ + p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \ + p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ + p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +@@ -909,13 +909,13 @@ + p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ + p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \ + p8(::std::move(gmock_p8)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +@@ -1009,13 +1009,13 @@ + p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \ + p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \ + p8(::std::move(gmock_p8)), p9(::std::move(gmock_p9)) {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\ + p0##_type const p0;\ +diff --git a/googlemock/include/gmock/gmock-generated-matchers.h.pump b/googlemock/include/gmock/gmock-generated-matchers.h.pump +index ae90917cc..69d2ae418 100644 +--- a/googlemock/include/gmock/gmock-generated-matchers.h.pump ++++ b/googlemock/include/gmock/gmock-generated-matchers.h.pump +@@ -302,13 +302,13 @@ $var param_field_decls2 = [[$for j + public:\ + [[$if i==1 [[explicit ]]]]gmock_Impl($impl_ctor_param_list)\ + $impl_inits {}\ +- virtual bool MatchAndExplain(\ ++ bool MatchAndExplain(\ + GTEST_REFERENCE_TO_CONST_(arg_type) arg,\ +- ::testing::MatchResultListener* result_listener) const;\ +- virtual void DescribeTo(::std::ostream* gmock_os) const {\ ++ ::testing::MatchResultListener* result_listener) const override;\ ++ void DescribeTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(false);\ + }\ +- virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ ++ void DescribeNegationTo(::std::ostream* gmock_os) const override {\ + *gmock_os << FormatDescription(true);\ + }\$param_field_decls + private:\ +diff --git a/googletest/include/gtest/gtest-typed-test.h b/googletest/include/gtest/gtest-typed-test.h +index 095ce0580..6b7c9c8a0 100644 +--- a/googletest/include/gtest/gtest-typed-test.h ++++ b/googletest/include/gtest/gtest-typed-test.h +@@ -201,7 +201,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); + private: \ + typedef CaseName TestFixture; \ + typedef gtest_TypeParam_ TypeParam; \ +- virtual void TestBody(); \ ++ void TestBody() override; \ + }; \ + static bool gtest_##CaseName##_##TestName##_registered_ \ + GTEST_ATTRIBUTE_UNUSED_ = \ +@@ -276,7 +276,7 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes); + private: \ + typedef SuiteName TestFixture; \ + typedef gtest_TypeParam_ TypeParam; \ +- virtual void TestBody(); \ ++ void TestBody() override; \ + }; \ + static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \ + GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \ +diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h +index f6433c58a..2b4770ff5 100644 +--- a/googletest/include/gtest/internal/gtest-port.h ++++ b/googletest/include/gtest/internal/gtest-port.h +@@ -1599,7 +1599,7 @@ class ThreadLocal : public ThreadLocalBase { + class DefaultValueHolderFactory : public ValueHolderFactory { + public: + DefaultValueHolderFactory() {} +- virtual ValueHolder* MakeNewHolder() const { return new ValueHolder(); } ++ ValueHolder* MakeNewHolder() const override { return new ValueHolder(); } + + private: + GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultValueHolderFactory); +@@ -1608,7 +1608,7 @@ class ThreadLocal : public ThreadLocalBase { + class InstanceValueHolderFactory : public ValueHolderFactory { + public: + explicit InstanceValueHolderFactory(const T& value) : value_(value) {} +- virtual ValueHolder* MakeNewHolder() const { ++ ValueHolder* MakeNewHolder() const override { + return new ValueHolder(value_); + } + +diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc +index 8312bd10e..d17a15540 100644 +--- a/googletest/test/gtest_unittest.cc ++++ b/googletest/test/gtest_unittest.cc +@@ -6170,7 +6170,7 @@ TEST_F(ParseFlagsTest, WideStrings) { + #if GTEST_USE_OWN_FLAGFILE_FLAG_ + class FlagfileTest : public ParseFlagsTest { + public: +- virtual void SetUp() { ++ void SetUp() override { + ParseFlagsTest::SetUp(); + + testdata_path_.Set(internal::FilePath( +@@ -6180,7 +6180,7 @@ class FlagfileTest : public ParseFlagsTest { + EXPECT_TRUE(testdata_path_.CreateFolder()); + } + +- virtual void TearDown() { ++ void TearDown() override { + testing::internal::posix::RmDir(testdata_path_.c_str()); + ParseFlagsTest::TearDown(); + } diff --git a/recipes/gtest/all/patches/gtest-1.10.0.patch b/recipes/gtest/all/patches/gtest-1.10.0.patch new file mode 100644 index 00000000000000..92d37990ee2c69 --- /dev/null +++ b/recipes/gtest/all/patches/gtest-1.10.0.patch @@ -0,0 +1,13 @@ +diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake +index 2f70f0b0..8cd03693 100644 +--- a/googletest/cmake/internal_utils.cmake ++++ b/googletest/cmake/internal_utils.cmake +@@ -154,7 +154,7 @@ function(cxx_library_with_type name type cxx_flags) + # Generate debug library name with a postfix. + set_target_properties(${name} + PROPERTIES +- DEBUG_POSTFIX "d") ++ DEBUG_POSTFIX "${CUSTOM_DEBUG_POSTFIX}") + # Set the output directory for build artifacts + set_target_properties(${name} + PROPERTIES diff --git a/recipes/gtest/config.yml b/recipes/gtest/config.yml index daa3a213a56fa3..0ca5dd0b1675e7 100644 --- a/recipes/gtest/config.yml +++ b/recipes/gtest/config.yml @@ -1,3 +1,5 @@ versions: "1.12.1": folder: all + "1.10.0": + folder: all From 370351849929c5ce0e5bc5c62f2a201f212df97b Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 1 Nov 2022 18:46:21 +0100 Subject: [PATCH 266/300] (#13853) ninja: do not override `tools.cmake.cmaketoolchain:generator` It's not the responsibility of ninja recipe to set `tools.cmake.cmaketoolchain:generator`, it's a user preference. `CONAN_CMAKE_GENERATOR` is kept for conan v1 to avoid potential breakage. --- recipes/ninja/all/conanfile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/recipes/ninja/all/conanfile.py b/recipes/ninja/all/conanfile.py index 881e7efbf37b88..d1a9ba2c4828ea 100644 --- a/recipes/ninja/all/conanfile.py +++ b/recipes/ninja/all/conanfile.py @@ -45,8 +45,6 @@ def package(self): def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] - self.conf_info.define("tools.cmake.cmaketoolchain:generator", "Ninja") # TODO: to remove in conan v2 if Version(conan_version).major < 2: From f463ff8159709fd0234327dadda3a9b8dce1a9f8 Mon Sep 17 00:00:00 2001 From: Samuel Dowling Date: Wed, 2 Nov 2022 04:37:03 +1030 Subject: [PATCH 267/300] (#13882) [gcc] Bump gcc recipe version to 12.2.0 * Bump GCC recipe version to 12.2.0 * Modify test recipe to use deps_env_info instead of os.environ to extract CC and CXX data. This is because env_info.{CC,CXX} was not being propagated to the run environment and the generated compilers were not being appropriately tested. * Rename the output from the test executable to be "Hello, World!" for consistence with the filename, remove references to Bincrafters Closes #13812. --- recipes/gcc/all/conandata.yml | 3 +++ recipes/gcc/all/test_package/conanfile.py | 4 ++-- recipes/gcc/all/test_package/hello.c | 2 +- recipes/gcc/all/test_package/hello.cpp | 2 +- recipes/gcc/config.yml | 2 ++ 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/recipes/gcc/all/conandata.yml b/recipes/gcc/all/conandata.yml index 393f23096fa91a..dcd31b786fcb02 100644 --- a/recipes/gcc/all/conandata.yml +++ b/recipes/gcc/all/conandata.yml @@ -2,3 +2,6 @@ sources: "10.2.0": sha256: 27e879dccc639cd7b0cc08ed575c1669492579529b53c9ff27b0b96265fa867d url: https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz + "12.2.0": + sha256: ac6b317eb4d25444d87cf29c0d141dedc1323a1833ec9995211b13e1a851261c + url: https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz diff --git a/recipes/gcc/all/test_package/conanfile.py b/recipes/gcc/all/test_package/conanfile.py index 05b3ec8808f4cf..a9e585e6ddfd44 100644 --- a/recipes/gcc/all/test_package/conanfile.py +++ b/recipes/gcc/all/test_package/conanfile.py @@ -11,8 +11,8 @@ def chmod_plus_x(name): if os.name == 'posix': os.chmod(name, os.stat(name).st_mode | 0o111) - cc = os.environ["CC"] - cxx = os.environ["CXX"] + cc = self.deps_env_info["gcc"].CC + cxx = self.deps_env_info["gcc"].CXX hello_c = os.path.join(self.source_folder, "hello.c") hello_cpp = os.path.join(self.source_folder, "hello.cpp") self.run("%s --version" % cc, run_environment=True) diff --git a/recipes/gcc/all/test_package/hello.c b/recipes/gcc/all/test_package/hello.c index d3e2001010e853..52029834a425bb 100644 --- a/recipes/gcc/all/test_package/hello.c +++ b/recipes/gcc/all/test_package/hello.c @@ -2,7 +2,7 @@ int main() { - puts("Bincrafters\n"); + puts("Hello, World!\n"); return 0; } diff --git a/recipes/gcc/all/test_package/hello.cpp b/recipes/gcc/all/test_package/hello.cpp index 1577292fece171..e59b7b15826e33 100644 --- a/recipes/gcc/all/test_package/hello.cpp +++ b/recipes/gcc/all/test_package/hello.cpp @@ -2,7 +2,7 @@ int main() { - std::cout << "Bincrafters\n"; + std::cout << "Hello, World!\n"; return 0; } diff --git a/recipes/gcc/config.yml b/recipes/gcc/config.yml index f434f75e33a4b6..204a7032b0bc44 100644 --- a/recipes/gcc/config.yml +++ b/recipes/gcc/config.yml @@ -1,3 +1,5 @@ versions: "10.2.0": folder: all + "12.2.0": + folder: all From 9265f11f258d6fbc8f07ec683edbcd2a7ddcd1c2 Mon Sep 17 00:00:00 2001 From: Dallas Hart <36043275+Nomalah@users.noreply.github.com> Date: Tue, 1 Nov 2022 14:26:44 -0400 Subject: [PATCH 268/300] (#13919) RangeV3 update to ConanV2 * Update to ConanV2 * Make changes according to review --- recipes/range-v3/all/conandata.yml | 36 +++++----- recipes/range-v3/all/conanfile.py | 66 ++++++++++--------- .../range-v3/all/test_package/CMakeLists.txt | 5 +- .../range-v3/all/test_package/conanfile.py | 20 ++++-- .../all/test_package/test_package.cpp | 1 + .../all/test_v1_package/CMakeLists.txt | 8 +++ .../range-v3/all/test_v1_package/conanfile.py | 18 +++++ recipes/range-v3/config.yml | 12 ++-- 8 files changed, 102 insertions(+), 64 deletions(-) create mode 100644 recipes/range-v3/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/range-v3/all/test_v1_package/conanfile.py diff --git a/recipes/range-v3/all/conandata.yml b/recipes/range-v3/all/conandata.yml index a9d0e694632912..1e7ea8c024212c 100644 --- a/recipes/range-v3/all/conandata.yml +++ b/recipes/range-v3/all/conandata.yml @@ -1,22 +1,22 @@ sources: - "0.3.7": - url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.3.7.tar.gz - sha256: e6b0fb33bfd07ec32d54bcddd3e8d62e995a3cf0b64b34788ec264da62581207 - "0.4.0": - url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.4.0.tar.gz - sha256: 5dbc878b7dfc500fb04b6b9f99d63993a2731ea34b0a4b8d5f670a5a71a18e39 - "0.5.0": - url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.5.0.tar.gz - sha256: 32e30b3be042246030f31d40394115b751431d9d2b4e0f6d58834b2fd5594280 - "0.9.1": - url: https://github.com/ericniebler/range-v3/archive/0.9.1.tar.gz - sha256: 2b5b442d572b5978ea51c650adfaf0796f39f326404d09b83d846e04f571876b - "0.10.0": - url: https://github.com/ericniebler/range-v3/archive/0.10.0.tar.gz - sha256: 5a1cd44e7315d0e8dcb1eee4df6802221456a9d1dbeac53da02ac7bd4ea150cd - "0.11.0": - url: https://github.com/ericniebler/range-v3/archive/0.11.0.tar.gz - sha256: 376376615dbba43d3bef75aa590931431ecb49eb36d07bb726a19f680c75e20c "0.12.0": url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.12.0.tar.gz sha256: 015adb2300a98edfceaf0725beec3337f542af4915cec4d0b89fa0886f4ba9cb + "0.11.0": + url: https://github.com/ericniebler/range-v3/archive/0.11.0.tar.gz + sha256: 376376615dbba43d3bef75aa590931431ecb49eb36d07bb726a19f680c75e20c + "0.10.0": + url: https://github.com/ericniebler/range-v3/archive/0.10.0.tar.gz + sha256: 5a1cd44e7315d0e8dcb1eee4df6802221456a9d1dbeac53da02ac7bd4ea150cd + "0.9.1": + url: https://github.com/ericniebler/range-v3/archive/0.9.1.tar.gz + sha256: 2b5b442d572b5978ea51c650adfaf0796f39f326404d09b83d846e04f571876b + "0.5.0": + url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.5.0.tar.gz + sha256: 32e30b3be042246030f31d40394115b751431d9d2b4e0f6d58834b2fd5594280 + "0.4.0": + url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.4.0.tar.gz + sha256: 5dbc878b7dfc500fb04b6b9f99d63993a2731ea34b0a4b8d5f670a5a71a18e39 + "0.3.7": + url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.3.7.tar.gz + sha256: e6b0fb33bfd07ec32d54bcddd3e8d62e995a3cf0b64b34788ec264da62581207 diff --git a/recipes/range-v3/all/conanfile.py b/recipes/range-v3/all/conanfile.py index 676535e01f13b0..7de33c5e7f88d9 100644 --- a/recipes/range-v3/all/conanfile.py +++ b/recipes/range-v3/all/conanfile.py @@ -1,6 +1,13 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration + + +required_conan_version = ">=1.50.0" class Rangev3Conan(ConanFile): @@ -13,17 +20,12 @@ class Rangev3Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _compilers_minimum_version(self): - rangev3_version = tools.Version(self.version) return { - "gcc": "5" if rangev3_version < "0.10.0" else "6.5", + "gcc": "5" if Version(self.version) < "0.10.0" else "6.5", "Visual Studio": "16", - "clang": "3.6" if rangev3_version < "0.10.0" else "3.9" + "clang": "3.6" if Version(self.version) < "0.10.0" else "3.9" } @property @@ -32,41 +34,45 @@ def _min_cppstd(self): return "17" else: return "14" + + def layout(self): + basic_layout(self) - def configure(self): + def package_id(self): + self.info.clear() + + def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False) if not minimum_version: - self.output.warn("{0} {1} support for range-v3 is unknown, assuming it is supported." - .format(self.settings.compiler, self.settings.compiler.version)) - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("range-v3 {0} requires C++{1} with {2}, which is not supported by {2} {3}" - .format(self.version, - self._min_cppstd, - self.settings.compiler, - self.settings.compiler.version)) + self.output.warn( + f"{self.settings.compiler} {self.settings.compiler.version} support for range-v3 is unknown, assuming it is supported.") + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"range-v3 {self.version} requires C++{self._min_cppstd} with {self.settings.compiler}, which is not supported by {self.settings.compiler} {self.settings.compiler.version}") - def package_id(self): - self.info.header_only() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = self.name + "-" + self.version - os.rename(extracted_folder, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def package(self): - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, "*", dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "LICENSE.txt", dst=os.path.join( + self.package_folder, "licenses"), src=self.source_folder) def package_info(self): self.cpp_info.components["range-v3-meta"].names["cmake_find_package"] = "meta" self.cpp_info.components["range-v3-meta"].names["cmake_find_package_multi"] = "meta" if self.settings.compiler == "Visual Studio": self.cpp_info.components["range-v3-meta"].cxxflags = ["/permissive-"] - version = tools.Version(self.version) - if "0.9.0" <= version and version < "0.11.0": - self.cpp_info.components["range-v3-meta"].cxxflags.append("/experimental:preprocessor") + + if "0.9.0" <= Version(self.version) < "0.11.0": + self.cpp_info.components["range-v3-meta"].cxxflags.append( + "/experimental:preprocessor") self.cpp_info.components["range-v3-concepts"].names["cmake_find_package"] = "concepts" self.cpp_info.components["range-v3-concepts"].names["cmake_find_package_multi"] = "concepts" self.cpp_info.components["range-v3-concepts"].requires = ["range-v3-meta"] diff --git a/recipes/range-v3/all/test_package/CMakeLists.txt b/recipes/range-v3/all/test_package/CMakeLists.txt index da44aa6041cc25..bee80f9c757e85 100644 --- a/recipes/range-v3/all/test_package/CMakeLists.txt +++ b/recipes/range-v3/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.8) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(range-v3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} range-v3::range-v3) -if(MSVC AND ${VERSION} STREQUAL "0.10.0") +if(MSVC AND range-v3_VERSION STREQUAL "0.10.0") set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) else() set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/range-v3/all/test_package/conanfile.py b/recipes/range-v3/all/test_package/conanfile.py index 4454ee38d4f7d6..2a9cace7282801 100644 --- a/recipes/range-v3/all/test_package/conanfile.py +++ b/recipes/range-v3/all/test_package/conanfile.py @@ -1,18 +1,26 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - cmake.definitions["VERSION"] = self.deps_cpp_info["range-v3"].version cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/range-v3/all/test_package/test_package.cpp b/recipes/range-v3/all/test_package/test_package.cpp index 775ca205da6d66..bf050370682ec6 100644 --- a/recipes/range-v3/all/test_package/test_package.cpp +++ b/recipes/range-v3/all/test_package/test_package.cpp @@ -1,5 +1,6 @@ #include #include +#include using namespace ranges; diff --git a/recipes/range-v3/all/test_v1_package/CMakeLists.txt b/recipes/range-v3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/range-v3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/range-v3/all/test_v1_package/conanfile.py b/recipes/range-v3/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..647a78dd800325 --- /dev/null +++ b/recipes/range-v3/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["VERSION"] = self.deps_cpp_info["range-v3"].version + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/range-v3/config.yml b/recipes/range-v3/config.yml index 557dc2ab0564d2..5ed235c09031b8 100644 --- a/recipes/range-v3/config.yml +++ b/recipes/range-v3/config.yml @@ -1,15 +1,15 @@ versions: - "0.3.7": + "0.12.0": folder: all - "0.4.0": + "0.11.0": folder: all - "0.5.0": + "0.10.0": folder: all "0.9.1": folder: all - "0.10.0": + "0.5.0": folder: all - "0.11.0": + "0.4.0": folder: all - "0.12.0": + "0.3.7": folder: all From 71d7a83e104d1c3c07fbdd945ba0cadb313238dd Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 2 Nov 2022 03:46:01 +0900 Subject: [PATCH 269/300] (#13926) bzip3: add version 1.2.0 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/bzip3/all/conandata.yml | 3 +++ recipes/bzip3/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/bzip3/all/conandata.yml b/recipes/bzip3/all/conandata.yml index 41dc4a96c73a94..55785ddc954750 100644 --- a/recipes/bzip3/all/conandata.yml +++ b/recipes/bzip3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.0": + url: "https://github.com/kspalaiologos/bzip3/archive/1.2.0.tar.gz" + sha256: "6f9bd935ac1e845cb49e64ad23969db914e4760dad7feec0995f5cdbd336c10d" "1.1.8": url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.8/bzip3-1.1.8.tar.bz2" sha256: "bc15d0e4599aad18d9ed71ee0f7e859af89051bf5105b0751e8ca3a26117567d" diff --git a/recipes/bzip3/config.yml b/recipes/bzip3/config.yml index c51e66db15fa7b..d1fde8c7bc3b48 100644 --- a/recipes/bzip3/config.yml +++ b/recipes/bzip3/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.0": + folder: all "1.1.8": folder: all "1.1.7": From ce97a71b1f071c79933ffd5f87288248da15dc69 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 1 Nov 2022 20:05:56 +0100 Subject: [PATCH 270/300] (#13925) [docs] Regenerate tables of contents Co-authored-by: conan-center-bot --- docs/faqs.md | 3 ++- docs/how_to_add_packages.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/faqs.md b/docs/faqs.md index 2df8702454f5d1..b6cc50b753e817 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -37,7 +37,8 @@ This section gathers the most common questions from the community related to pac * [Why are version ranges not allowed?](#why-are-version-ranges-not-allowed) * [How to consume a graph of shared libraries?](#how-to-consume-a-graph-of-shared-libraries) * [How to watch only specific recipes?](#how-to-watch-only-specific-recipes) - * [Is it possible to disable Pylint?](#is-it-possible-to-disable-pylint) + * [Is it possible to disable Pylint?](#is-it-possible-to-disable-pylint) + * [How long can I be inactive before being removed from the authorized users list?](#how-long-can-i-be-inactive-before-being-removed-from-the-authorized-users-list) ## What is the policy on recipe name collisions? diff --git a/docs/how_to_add_packages.md b/docs/how_to_add_packages.md index b73ca6d23ce6fe..07a6d187e8baba 100644 --- a/docs/how_to_add_packages.md +++ b/docs/how_to_add_packages.md @@ -11,6 +11,7 @@ You can follow the three steps (:one: :two: :three:) described below! :tada: ## Contents * [Request access](#request-access) + * [Inactivity and user removal](#inactivity-and-user-removal) * [Submitting a Package](#submitting-a-package) * [The Build Service](#the-build-service) * [Recipe files structure](#recipe-files-structure) From dd279c4e575cbd42e47e468aefe7b0b37a1c0d71 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 2 Nov 2022 04:26:27 +0900 Subject: [PATCH 271/300] (#13927) lcms: add version 2.14 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/lcms/all/conandata.yml | 3 +++ recipes/lcms/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/lcms/all/conandata.yml b/recipes/lcms/all/conandata.yml index 001dd1633b7af0..55991f5faffdb9 100644 --- a/recipes/lcms/all/conandata.yml +++ b/recipes/lcms/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.14": + url: "https://github.com/mm2/Little-CMS/archive/lcms2.14.tar.gz" + sha256: "05869269f14e589b0b6d05a76f510c68c67fabb304904d16c6bd818abec80a83" "2.13.1": url: "https://github.com/mm2/Little-CMS/archive/refs/tags/lcms2.13.1.tar.gz" sha256: "6f84c942ecde1b4852b5a051894502ac8c98d010acb3400dec958c6db1bc94ef" diff --git a/recipes/lcms/config.yml b/recipes/lcms/config.yml index 788637aaa677ba..82126a56f46e64 100644 --- a/recipes/lcms/config.yml +++ b/recipes/lcms/config.yml @@ -1,4 +1,6 @@ versions: + "2.14": + folder: all "2.13.1": folder: all "2.12": From 439eafd70b7f484fe3b4d9d8f6461aa85881d0b6 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 1 Nov 2022 23:05:58 +0100 Subject: [PATCH 272/300] (#13936) hdrhistogram-c: bump zlib --- recipes/hdrhistogram-c/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/hdrhistogram-c/all/conanfile.py b/recipes/hdrhistogram-c/all/conanfile.py index 1aa5b94776c551..4166d96c192f3f 100644 --- a/recipes/hdrhistogram-c/all/conanfile.py +++ b/recipes/hdrhistogram-c/all/conanfile.py @@ -50,7 +50,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def source(self): get(self, **self.conan_data["sources"][self.version], From 74780a46086f40ea456ea8d6abce0ac82c9d2941 Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 2 Nov 2022 10:08:44 +0900 Subject: [PATCH 273/300] (#13944) objectbox: add version 0.18.0 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/objectbox/all/conandata.yml | 6 ++++++ recipes/objectbox/config.yml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/recipes/objectbox/all/conandata.yml b/recipes/objectbox/all/conandata.yml index dd393e6697d168..c17f9834922b31 100644 --- a/recipes/objectbox/all/conandata.yml +++ b/recipes/objectbox/all/conandata.yml @@ -1,9 +1,15 @@ sources: + "0.18.0": + url: "https://github.com/objectbox/objectbox-c/archive/v0.18.0.tar.gz" + sha256: "e86e921d59c6c36a4a0c0ddc5a2b641789bfa012e0824506c285feb4e9285ae7" "0.17.0": url: "https://github.com/objectbox/objectbox-c/archive/refs/tags/v0.17.0.tar.gz" sha256: "3b936b3352ae0c8ea3706cc0a1790d2714a415cdce16007c2caca367ead5af8d" patches: + "0.18.0": + - patch_file: "patches/0001-fix-cmake.patch" + base_path: "source_subfolder" "0.17.0": - patch_file: "patches/0001-fix-cmake.patch" base_path: "source_subfolder" diff --git a/recipes/objectbox/config.yml b/recipes/objectbox/config.yml index 60a00f1b4d5794..5bf98d20ca9eb8 100644 --- a/recipes/objectbox/config.yml +++ b/recipes/objectbox/config.yml @@ -1,3 +1,5 @@ versions: + "0.18.0": + folder: all "0.17.0": folder: all From b979e467d629e95e80bf40ab76121e002d3684b9 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 2 Nov 2022 05:06:59 +0100 Subject: [PATCH 274/300] (#13945) leptonica: bump zlib & pkgconf --- recipes/leptonica/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/leptonica/all/conanfile.py b/recipes/leptonica/all/conanfile.py index 4bdb50093b6edb..399ac8b097d489 100644 --- a/recipes/leptonica/all/conanfile.py +++ b/recipes/leptonica/all/conanfile.py @@ -73,7 +73,7 @@ def layout(self): def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_gif: self.requires("giflib/5.2.1") if self.options.with_jpeg == "libjpeg": @@ -96,7 +96,7 @@ def validate(self): def build_requirements(self): if self.options.with_webp or self.options.with_openjpeg: - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/1.9.3") def source(self): get(self, **self.conan_data["sources"][self.version], From 4859b553981a3e77639caee1362d17ddbe1b67eb Mon Sep 17 00:00:00 2001 From: toge Date: Wed, 2 Nov 2022 15:06:43 +0900 Subject: [PATCH 275/300] (#13950) glaze: add version 0.1.3 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/glaze/all/conandata.yml | 3 +++ recipes/glaze/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/glaze/all/conandata.yml b/recipes/glaze/all/conandata.yml index 4d798c50cbfc4e..99c6c16c7c2620 100644 --- a/recipes/glaze/all/conandata.yml +++ b/recipes/glaze/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.3": + url: "https://github.com/stephenberry/glaze/archive/v0.1.3.tar.gz" + sha256: "291e71244bf6fde5e57daf53d8e2fdd4793a7e93fe68c546f746f43a0e534d07" "0.1.2": url: "https://github.com/stephenberry/glaze/archive/v0.1.2.tar.gz" sha256: "5de894dbad95a773a7b1e3c43eeb42ec79bf30bc04355d4d055db0cba1ae52db" diff --git a/recipes/glaze/config.yml b/recipes/glaze/config.yml index 9f71c0e5cdfaea..02450ffc6bc09c 100644 --- a/recipes/glaze/config.yml +++ b/recipes/glaze/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.3": + folder: all "0.1.2": folder: all "0.1.0": From 06e31ea8bfd1068f8f6bbbb822f408af9bdbf567 Mon Sep 17 00:00:00 2001 From: Michael Keck Date: Wed, 2 Nov 2022 08:09:15 +0100 Subject: [PATCH 276/300] (#13923) openssl: add 3.0.7 + 1.1.1s * openssl: add 3.0.7 + 1.1.1s * openssl: Update Conan conventions Automatically created by bincrafters-conventions 1.1.0 * Fix 1.1.1s checksum * Fix version Co-authored-by: bincrafters-user --- recipes/openssl/1.x.x/conandata.yml | 45 +++++++++++++---------------- recipes/openssl/3.x.x/conandata.yml | 6 ++-- recipes/openssl/3.x.x/conanfile.py | 2 +- recipes/openssl/config.yml | 8 ++--- 4 files changed, 28 insertions(+), 33 deletions(-) diff --git a/recipes/openssl/1.x.x/conandata.yml b/recipes/openssl/1.x.x/conandata.yml index f5decdd72359f3..87f7543e6bbd64 100644 --- a/recipes/openssl/1.x.x/conandata.yml +++ b/recipes/openssl/1.x.x/conandata.yml @@ -1,44 +1,39 @@ sources: 1.0.2u: sha256: ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16 - url: [ - "https://www.openssl.org/source/openssl-1.0.2u.tar.gz", - "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz" - ] + url: + - "https://www.openssl.org/source/openssl-1.0.2u.tar.gz" + - "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz" 1.1.0l: sha256: 74a2f756c64fd7386a29184dc0344f4831192d61dc2481a93a4c5dd727f41148 - url: [ - "https://www.openssl.org/source/openssl-1.1.0l.tar.gz", - "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0l.tar.gz" - ] - 1.1.1o: - sha256: 9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f - url: [ - "https://www.openssl.org/source/openssl-1.1.1o.tar.gz", - "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1o.tar.gz" - ] + url: + - "https://www.openssl.org/source/openssl-1.1.0l.tar.gz" + - "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0l.tar.gz" 1.1.1p: sha256: bf61b62aaa66c7c7639942a94de4c9ae8280c08f17d4eac2e44644d9fc8ace6f - url: [ - "https://www.openssl.org/source/openssl-1.1.1p.tar.gz", - "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1p.tar.gz" - ] + url: + - "https://www.openssl.org/source/openssl-1.1.1p.tar.gz" + - "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1p.tar.gz" 1.1.1q: sha256: d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca - url: [ - "https://www.openssl.org/source/openssl-1.1.1q.tar.gz", - "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1q.tar.gz" - ] + url: + - "https://www.openssl.org/source/openssl-1.1.1q.tar.gz" + - "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1q.tar.gz" + 1.1.1s: + sha256: c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa + url: + - "https://www.openssl.org/source/openssl-1.1.1s.tar.gz" + - "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1s.tar.gz" patches: 1.0.2u: - patch_file: patches/1.0.2u-darwin-arm64.patch base_path: source_subfolder - 1.1.1o: - - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder 1.1.1p: - patch_file: patches/1.1.1-tvos-watchos.patch base_path: source_subfolder 1.1.1q: - patch_file: patches/1.1.1-tvos-watchos.patch base_path: source_subfolder + 1.1.1s: + - patch_file: patches/1.1.1-tvos-watchos.patch + base_path: source_subfolder diff --git a/recipes/openssl/3.x.x/conandata.yml b/recipes/openssl/3.x.x/conandata.yml index f83e18460ec0f3..fda0f1e1cf28a0 100644 --- a/recipes/openssl/3.x.x/conandata.yml +++ b/recipes/openssl/3.x.x/conandata.yml @@ -1,10 +1,10 @@ sources: + 3.0.7: + url: https://www.openssl.org/source/openssl-3.0.7.tar.gz + sha256: 83049d042a260e696f62406ac5c08bf706fd84383f945cf21bd61e9ed95c396e 3.0.5: url: https://www.openssl.org/source/openssl-3.0.5.tar.gz sha256: aa7d8d9bef71ad6525c55ba11e5f4397889ce49c2c9349dcea6d3e4f0b024a7a 3.0.4: url: https://www.openssl.org/source/openssl-3.0.4.tar.gz sha256: 2831843e9a668a0ab478e7020ad63d2d65e51f72977472dc73efcefbafc0c00f - 3.0.3: - url: https://www.openssl.org/source/openssl-3.0.3.tar.gz - sha256: ee0078adcef1de5f003c62c80cc96527721609c6f3bb42b7795df31f8b558c0b diff --git a/recipes/openssl/3.x.x/conanfile.py b/recipes/openssl/3.x.x/conanfile.py index ee14c8c94d4df0..05de257a52c5ff 100644 --- a/recipes/openssl/3.x.x/conanfile.py +++ b/recipes/openssl/3.x.x/conanfile.py @@ -120,7 +120,7 @@ def configure(self): def requirements(self): if not self.options.no_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def build_requirements(self): if self._settings_build.os == "Windows": diff --git a/recipes/openssl/config.yml b/recipes/openssl/config.yml index 5b14d0aab6ab7d..3cb5a6e3ab8f4d 100644 --- a/recipes/openssl/config.yml +++ b/recipes/openssl/config.yml @@ -1,19 +1,19 @@ versions: # 3.0.x releases + 3.0.7: + folder: "3.x.x" 3.0.5: folder: "3.x.x" 3.0.4: folder: "3.x.x" - 3.0.3: - folder: "3.x.x" # 1.1.1x releases + 1.1.1s: + folder: "1.x.x" 1.1.1q: folder: "1.x.x" 1.1.1p: folder: "1.x.x" - 1.1.1o: - folder: "1.x.x" # 1.1.0x releases 1.1.0l: folder: "1.x.x" From e08d116d3a5e4c2ca7b6862172d6c0259db09f6e Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Wed, 2 Nov 2022 04:22:22 -0700 Subject: [PATCH 277/300] (#13848) docs: Use new Conan 1.53 features * Use new Conan 1.53 features since it's now available * Apply suggestions from code review Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- .../autotools_package/all/conanfile.py | 18 ++++-------------- .../cmake_package/all/conanfile.py | 18 ++++-------------- .../meson_package/all/conanfile.py | 18 ++++-------------- .../msbuild_package/all/conanfile.py | 18 ++++-------------- .../prebuilt_tool_package/all/conanfile.py | 6 +----- docs/packaging_policy.md | 11 ----------- 6 files changed, 17 insertions(+), 72 deletions(-) diff --git a/docs/package_templates/autotools_package/all/conanfile.py b/docs/package_templates/autotools_package/all/conanfile.py index 2d54c220a5dd79..6620e517ff6db5 100644 --- a/docs/package_templates/autotools_package/all/conanfile.py +++ b/docs/package_templates/autotools_package/all/conanfile.py @@ -10,7 +10,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" # # INFO: Please, remove all comments before pushing your PR! @@ -58,20 +58,10 @@ def config_options(self): def configure(self): if self.options.shared: - try: - # once removed by config_options, need try..except for a second del - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") # for plain C projects only - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): # src_folder must use the same source folder name the project diff --git a/docs/package_templates/cmake_package/all/conanfile.py b/docs/package_templates/cmake_package/all/conanfile.py index af351727d56bf5..cd585482a5bfe7 100644 --- a/docs/package_templates/cmake_package/all/conanfile.py +++ b/docs/package_templates/cmake_package/all/conanfile.py @@ -9,7 +9,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" # # INFO: Please, remove all comments before pushing your PR! @@ -60,20 +60,10 @@ def config_options(self): def configure(self): if self.options.shared: - try: - # once removed by config_options, need try..except for a second del - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") # for plain C projects only - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): # src_folder must use the same source folder name the project diff --git a/docs/package_templates/meson_package/all/conanfile.py b/docs/package_templates/meson_package/all/conanfile.py index 53a839176b8f24..3e9e0431e7ed95 100644 --- a/docs/package_templates/meson_package/all/conanfile.py +++ b/docs/package_templates/meson_package/all/conanfile.py @@ -12,7 +12,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" # # INFO: Please, remove all comments before pushing your PR! @@ -63,20 +63,10 @@ def config_options(self): def configure(self): if self.options.shared: - try: - # once removed by config_options, need try..except for a second del - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") # for plain C projects only - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): # src_folder must use the same source folder name the project diff --git a/docs/package_templates/msbuild_package/all/conanfile.py b/docs/package_templates/msbuild_package/all/conanfile.py index 5954e93a4051ef..d1bf82b2aaaa38 100644 --- a/docs/package_templates/msbuild_package/all/conanfile.py +++ b/docs/package_templates/msbuild_package/all/conanfile.py @@ -6,7 +6,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class PackageConan(ConanFile): @@ -40,20 +40,10 @@ def config_options(self): def configure(self): if self.options.shared: - try: - # once removed by config_options, need try..except for a second del - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") # for plain C projects only - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): # src_folder must use the same source folder name the project diff --git a/docs/package_templates/prebuilt_tool_package/all/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/conanfile.py index 92e54d11b0db48..c8a5ae117ab52b 100644 --- a/docs/package_templates/prebuilt_tool_package/all/conanfile.py +++ b/docs/package_templates/prebuilt_tool_package/all/conanfile.py @@ -59,10 +59,6 @@ def package_info(self): self.cpp_info.resdirs = [] self.cpp_info.includedirs = [] - bin_folder = os.path.join(self.package_folder, "bin") - # In case need to find packaged tools when building a package - self.buildenv_info.append("PATH", bin_folder) - # In case need to find packaged tools at runtime - self.runenv_info.append("PATH", bin_folder) # TODO: Legacy, to be removed on Conan 2.0 + bin_folder = os.path.join(self.package_folder, "bin") self.env_info.PATH.append(bin_folder) diff --git a/docs/packaging_policy.md b/docs/packaging_policy.md index 9c58b5482b075e..986c5982994b0e 100644 --- a/docs/packaging_policy.md +++ b/docs/packaging_policy.md @@ -135,17 +135,6 @@ Usage of each option should follow the rules: if self.settings.os == "Windows": del self.options.fPIC - def configure(self): - if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - ``` - - Starting with Conan 1.53 this can be simplified to - - ```py def configure(self): if self.options.shared: self.options.rm_safe("fPIC") From 42b51fa9716617e992e8255f978a213f56b37c49 Mon Sep 17 00:00:00 2001 From: Chris Mc Date: Wed, 2 Nov 2022 04:50:15 -0700 Subject: [PATCH 278/300] (#13753) [config] Update conan version to 1.53.0 Co-authored-by: danimtb --- .c3i/config_v1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.c3i/config_v1.yml b/.c3i/config_v1.yml index 84e2b27b4e6495..62fb9cd6f57c47 100644 --- a/.c3i/config_v1.yml +++ b/.c3i/config_v1.yml @@ -3,7 +3,7 @@ id: 'conan-io/conan-center-index' conan: - version: 1.52.0 + version: 1.53.0 artifactory: url: "https://c3i.jfrog.io/c3i" From 8a917bcf4524ca525933607dc514b1542c410fe6 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 2 Nov 2022 13:06:39 +0100 Subject: [PATCH 279/300] (#13855) vulkan-validationlayers: 1.3.231.1 + conan v2 support * modernize more * add vulkan-validationlayers/1.3.231.1 * properly handle xorg & wayland on Linux * typo * no Werror in 1.3.231.1 --- .../all/CMakeLists.txt | 5 +- .../vulkan-validationlayers/all/conandata.yml | 15 ++- .../vulkan-validationlayers/all/conanfile.py | 126 +++++++++++------- .../dependencies/dependencies-1.3.231.1.yml | 2 + .../patches/1.3.231.1-cmake-no-werror.patch | 13 ++ .../all/test_v1_package/CMakeLists.txt | 11 +- recipes/vulkan-validationlayers/config.yml | 2 + 7 files changed, 109 insertions(+), 65 deletions(-) create mode 100644 recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.231.1.yml create mode 100644 recipes/vulkan-validationlayers/all/patches/1.3.231.1-cmake-no-werror.patch diff --git a/recipes/vulkan-validationlayers/all/CMakeLists.txt b/recipes/vulkan-validationlayers/all/CMakeLists.txt index d4a511891ccf31..3206840c13b9fd 100644 --- a/recipes/vulkan-validationlayers/all/CMakeLists.txt +++ b/recipes/vulkan-validationlayers/all/CMakeLists.txt @@ -1,13 +1,10 @@ cmake_minimum_required(VERSION 3.1) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - if(NOT TARGET glslang) add_library(glslang INTERFACE) # fake target for upstream CMakeLists (glslang required by tests only) endif() find_package(SPIRV-Tools REQUIRED CONFIG) -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/vulkan-validationlayers/all/conandata.yml b/recipes/vulkan-validationlayers/all/conandata.yml index 4dfdd2518953a3..9df896ac76970a 100644 --- a/recipes/vulkan-validationlayers/all/conandata.yml +++ b/recipes/vulkan-validationlayers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.231.1": + url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "ea40af0f499e7e97a86ee54410c5c78e7f7bac40f65ae09a1549773b6501bf4d" "1.3.224.1": url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.224.1.tar.gz" sha256: "49c00e0119e3bc11e13c0c740e57c76b582b14f754f3779b85508c4d90d9df85" @@ -24,21 +27,19 @@ sources: url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/sdk-1.2.154.0.tar.gz" sha256: "8898ab05d0d8dec04fbba03d0ed2e79a1eb5c0382e5c89d4c737b45a6648f7f9" patches: + "1.3.231.1": + - patch_file: "patches/1.3.231.1-cmake-no-werror.patch" + patch_description: "Allow to disable Werror for old gcc/clang versions" + patch_type: "portability" + sha256: "14678800b649c54dee25ee06d8c379f7abca2ae8a580a7fa64d4eb06b5080ecd" "1.2.198.0": - patch_file: "patches/0005-fix-cmake-1.2.198.0.patch" - base_path: "source_subfolder" "1.2.189.2": - patch_file: "patches/0005-fix-cmake-1.2.189.2.patch" - base_path: "source_subfolder" "1.2.182": - patch_file: "patches/0005-fix-cmake-1.2.182.patch" - base_path: "source_subfolder" "1.2.154.0": - patch_file: "patches/0001-duplicated-declaration.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-mingw.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-disable-nortti-and-warnings-as-errors.patch" - base_path: "source_subfolder" - patch_file: "patches/0004-fix-installation.patch" - base_path: "source_subfolder" diff --git a/recipes/vulkan-validationlayers/all/conanfile.py b/recipes/vulkan-validationlayers/all/conanfile.py index 67e1dc62d199e7..cf06f5e8ad1355 100644 --- a/recipes/vulkan-validationlayers/all/conanfile.py +++ b/recipes/vulkan-validationlayers/all/conanfile.py @@ -1,16 +1,18 @@ from conan import ConanFile from conan.errors import ConanException, ConanInvalidConfiguration from conan.tools.build import check_min_cppstd -from conan.tools.files import apply_conandata_patches, copy, get, mkdir, rename, replace_in_file, rm +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, rename, replace_in_file, rm +from conan.tools.gnu import PkgConfigDeps from conan.tools.scm import Version -from conans import CMake import functools import glob import os import shutil import yaml -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.52.0" class VulkanValidationLayersConan(ConanFile): @@ -34,11 +36,6 @@ class VulkanValidationLayersConan(ConanFile): } short_paths = True - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _dependencies_filename(self): @@ -53,13 +50,22 @@ def _dependencies_versions(self): cached_dependencies = yaml.safe_load(open(dependencies_filepath)) return cached_dependencies + @property + def _needs_wayland_for_build(self): + return self.options.get_safe("with_wsi_wayland") and Version(self.version) < "1.3.231" + + @property + def _needs_pkg_config(self): + return self.options.get_safe("with_wsi_xcb") or \ + self.options.get_safe("with_wsi_xlib") or \ + self._needs_wayland_for_build + def export(self): copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder) def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os not in ["Linux", "FreeBSD"]: @@ -67,27 +73,19 @@ def config_options(self): del self.options.with_wsi_xlib del self.options.with_wsi_wayland - @staticmethod - def _greater_equal_semver(v1, v2): - lv1 = [int(v) for v in v1.split(".")] - lv2 = [int(v) for v in v2.split(".")] - diff_len = len(lv2) - len(lv1) - if diff_len > 0: - lv1.extend([0] * diff_len) - elif diff_len < 0: - lv2.extend([0] * -diff_len) - return lv1 >= lv2 + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): # TODO: set private=True, once the issue is resolved https://github.com/conan-io/conan/issues/9390 self.requires(self._require("spirv-tools"), private=not hasattr(self, "settings_build")) self.requires(self._require("vulkan-headers")) # TODO: use Version comparison once https://github.com/conan-io/conan/issues/10000 is fixed - if self._greater_equal_semver(self.version, "1.2.173"): + if Version(self.version) >= "1.2.173": self.requires("robin-hood-hashing/3.11.5") if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"): self.requires("xorg/system") - if self.options.get_safe("with_wsi_wayland"): + if self._needs_wayland_for_build: self.requires("wayland/1.21.0") def _require(self, recipe_name): @@ -105,44 +103,78 @@ def validate(self): if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 is not supported") + def build_requirements(self): + if self._needs_pkg_config and not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = CMakeToolchain(self) + tc.variables["VULKAN_HEADERS_INSTALL_DIR"] = self.dependencies["vulkan-headers"].package_folder.replace("\\", "/") + tc.variables["USE_CCACHE"] = False + if self.settings.os in ["Linux", "FreeBSD"]: + tc.variables["BUILD_WSI_XCB_SUPPORT"] = self.options.with_wsi_xcb + tc.variables["BUILD_WSI_XLIB_SUPPORT"] = self.options.with_wsi_xlib + tc.variables["BUILD_WSI_WAYLAND_SUPPORT"] = self.options.with_wsi_wayland + tc.variables["BUILD_WERROR"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["INSTALL_TESTS"] = False + tc.variables["BUILD_LAYERS"] = True + tc.variables["BUILD_LAYER_SUPPORT_FILES"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + if self._needs_pkg_config: + deps = PkgConfigDeps(self) + deps.generate() + # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuildenv_pkg_config_path") def _patch_sources(self): apply_conandata_patches(self) - replace_in_file(self, os.path.join(self._source_subfolder, "cmake", "FindVulkanHeaders.cmake"), + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + # Unusual but prefer custom FindVulkanHeaders.cmake from upstream instead of config file of conan + replace_in_file(self, cmakelists, + "find_package(VulkanHeaders REQUIRED)", + "find_package(VulkanHeaders REQUIRED MODULE)") + replace_in_file(self, os.path.join(self.source_folder, "cmake", "FindVulkanHeaders.cmake"), "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry", "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry") + # Ensure to use upstream FindWayland.cmake + if self._needs_wayland_for_build: + replace_in_file(self, cmakelists, + "find_package(Wayland REQUIRED)", + "find_package(Wayland REQUIRED MODULE)") + # Useless and may fail + if Version(self.version) >= "1.3.231": + replace_in_file(self, cmakelists, "include(VVLGenerateSourceCode)", "") # FIXME: two CMake module/config files should be generated (SPIRV-ToolsConfig.cmake and SPIRV-Tools-optConfig.cmake), # but it can't be modeled right now in spirv-tools recipe - if not os.path.exists("SPIRV-Tools-optConfig.cmake"): - shutil.copy("SPIRV-ToolsConfig.cmake", "SPIRV-Tools-optConfig.cmake") + if not os.path.exists(os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake")): + shutil.copy( + os.path.join(self.generators_folder, "SPIRV-ToolsConfig.cmake"), + os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake"), + ) - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + self._patch_sources() cmake = CMake(self) - cmake.definitions["VULKAN_HEADERS_INSTALL_DIR"] = self.deps_cpp_info["vulkan-headers"].rootpath - cmake.definitions["USE_CCACHE"] = False - if self.settings.os in ["Linux", "FreeBSD"]: - cmake.definitions["BUILD_WSI_XCB_SUPPORT"] = self.options.with_wsi_xcb - cmake.definitions["BUILD_WSI_XLIB_SUPPORT"] = self.options.with_wsi_xlib - cmake.definitions["BUILD_WSI_WAYLAND_SUPPORT"] = self.options.with_wsi_wayland - cmake.definitions["BUILD_WERROR"] = False - cmake.definitions["BUILD_TESTS"] = False - cmake.definitions["INSTALL_TESTS"] = False - cmake.definitions["BUILD_LAYERS"] = True - cmake.definitions["BUILD_LAYER_SUPPORT_FILES"] = True - cmake.configure() - return cmake + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() def package(self): - copy(self, "LICENSE.txt", src=os.path.join(self.source_folder, self._source_subfolder), dst=os.path.join(self.package_folder, "licenses")) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() if self.settings.os == "Windows": # import lib is useless, validation layers are loaded at runtime diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.231.1.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.231.1.yml new file mode 100644 index 00000000000000..bfd00812c52119 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.231.1.yml @@ -0,0 +1,2 @@ +spirv-tools: "1.3.231.1" +vulkan-headers: "1.3.231.1" diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.231.1-cmake-no-werror.patch b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-cmake-no-werror.patch new file mode 100644 index 00000000000000..5d410a8c7a09e9 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-cmake-no-werror.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -171,9 +171,7 @@ if(${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)") + -fno-builtin-memcmp) + + # Treat warnings as errors for versions of GCC and c++11-compliant Clang versions that are shipped on Ubuntu 18.04 or older. +- if(BUILD_WERROR OR +- (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 7.3.0) OR +- (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0.0)) ++ if(BUILD_WERROR) + add_compile_options(-Werror) + endif() + diff --git a/recipes/vulkan-validationlayers/all/test_v1_package/CMakeLists.txt b/recipes/vulkan-validationlayers/all/test_v1_package/CMakeLists.txt index 1960fb72b8cf49..0d20897301b68b 100644 --- a/recipes/vulkan-validationlayers/all/test_v1_package/CMakeLists.txt +++ b/recipes/vulkan-validationlayers/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(vulkan-validationlayers REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE vulkan-validationlayers::vulkan-validationlayers) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vulkan-validationlayers/config.yml b/recipes/vulkan-validationlayers/config.yml index b3ac3789c4b5fe..cc5317034e1207 100644 --- a/recipes/vulkan-validationlayers/config.yml +++ b/recipes/vulkan-validationlayers/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.231.1": + folder: all "1.3.224.1": folder: all "1.3.216.0": From c2eadcbd698154ee7a94434d624379f87a8b1a3f Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 2 Nov 2022 14:05:58 +0100 Subject: [PATCH 280/300] (#13862) libxlsxwriter: conan v2 support + fix MinGW --- recipes/libxlsxwriter/all/CMakeLists.txt | 7 -- recipes/libxlsxwriter/all/conandata.yml | 18 ++- recipes/libxlsxwriter/all/conanfile.py | 111 ++++++++++-------- .../all/patches/1.0.0-0001-fix-cmake.patch | 38 ++++++ .../1.0.0/001-patch-cmake-conan-targets.patch | 33 ------ .../all/patches/1.1.3-0001-fix-cmake.patch | 41 +++++++ .../1.1.3/001-patch-cmake-conan-targets.patch | 43 ------- .../all/test_package/CMakeLists.txt | 9 +- .../all/test_package/conanfile.py | 24 ++-- .../{example.c => test_package.c} | 0 .../all/test_v1_package/CMakeLists.txt | 8 ++ .../all/test_v1_package/conanfile.py | 17 +++ 12 files changed, 196 insertions(+), 153 deletions(-) delete mode 100644 recipes/libxlsxwriter/all/CMakeLists.txt create mode 100644 recipes/libxlsxwriter/all/patches/1.0.0-0001-fix-cmake.patch delete mode 100644 recipes/libxlsxwriter/all/patches/1.0.0/001-patch-cmake-conan-targets.patch create mode 100644 recipes/libxlsxwriter/all/patches/1.1.3-0001-fix-cmake.patch delete mode 100644 recipes/libxlsxwriter/all/patches/1.1.3/001-patch-cmake-conan-targets.patch rename recipes/libxlsxwriter/all/test_package/{example.c => test_package.c} (100%) create mode 100644 recipes/libxlsxwriter/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libxlsxwriter/all/test_v1_package/conanfile.py diff --git a/recipes/libxlsxwriter/all/CMakeLists.txt b/recipes/libxlsxwriter/all/CMakeLists.txt deleted file mode 100644 index 30c065f03128e9..00000000000000 --- a/recipes/libxlsxwriter/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libxlsxwriter/all/conandata.yml b/recipes/libxlsxwriter/all/conandata.yml index cd8028139a3903..b6ef8ccb7684dc 100644 --- a/recipes/libxlsxwriter/all/conandata.yml +++ b/recipes/libxlsxwriter/all/conandata.yml @@ -10,11 +10,17 @@ sources: sha256: "8b353379333c323d14a9d265cd2491d3a6c0032c8d6ec2141f10b82ab66a087c" patches: "1.1.4": - - base_path: "source_subfolder" - patch_file: "patches/1.1.3/001-patch-cmake-conan-targets.patch" + - patch_file: "patches/1.1.3-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + sha256: "54bf92c1f9423d9c7b3820122ff806679e254392d66ae72696f58e7d36e4b16f" "1.1.3": - - base_path: "source_subfolder" - patch_file: "patches/1.1.3/001-patch-cmake-conan-targets.patch" + - patch_file: "patches/1.1.3-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + sha256: "54bf92c1f9423d9c7b3820122ff806679e254392d66ae72696f58e7d36e4b16f" "1.0.0": - - base_path: "source_subfolder" - patch_file: "patches/1.0.0/001-patch-cmake-conan-targets.patch" + - patch_file: "patches/1.0.0-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + sha256: "d310313e55f4819db7401e1dc27795481b4a3b258fbba19f9eb5211141b09972" diff --git a/recipes/libxlsxwriter/all/conanfile.py b/recipes/libxlsxwriter/all/conanfile.py index 92136ebd9d6334..6cf2bdfa2351ca 100644 --- a/recipes/libxlsxwriter/all/conanfile.py +++ b/recipes/libxlsxwriter/all/conanfile.py @@ -1,17 +1,23 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" + class LibxlsxwriterConan(ConanFile): name = "libxlsxwriter" license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jmcnamara/libxlsxwriter" - topics = ("conan", "Excel", "XLSX") + topics = ("excel", "xlsx") description = "A C library for creating Excel XLSX files" - settings = "os", "compiler", "build_type", "arch" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,14 +34,9 @@ class LibxlsxwriterConan(ConanFile): "fmemopen": False, "dtoa": False, } - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,59 +46,65 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - - def validate(self): - if tools.Version(self.version) <= "1.0.5" and self.options.md5 == "openssl": - raise ConanInvalidConfiguration("{0}:md5=openssl is not suppported in {0}/{1}".format(self.name, self.version)) + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("minizip/1.2.12") - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.md5 == "openssl": self.requires("openssl/1.1.1q") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["USE_STATIC_MSVC_RUNTIME"] = (self.settings.os == "Windows" and "MT" in str(self.settings.compiler.runtime)) - self._cmake.definitions["USE_SYSTEM_MINIZIP"] = True - self._cmake.definitions["USE_STANDARD_TMPFILE"] = self.options.tmpfile - - if self.options.md5 == False: - self._cmake.definitions["USE_NO_MD5"] = True - elif self.options.md5 == "openssl": - self._cmake.definitions["USE_OPENSSL_MD5"] = True - - self._cmake.definitions["USE_FMEMOPEN"] = self.options.get_safe("fmemopen", False) - self._cmake.definitions["USE_DTOA_LIBRARY"] = self.options.dtoa + def validate(self): + if Version(self.version) < "1.0.6" and self.info.options.md5 == "openssl": + raise ConanInvalidConfiguration(f"{self.name}:md5=openssl is not suppported in {self.ref}") - self._cmake.configure() - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["USE_SYSTEM_MINIZIP"] = True + tc.variables["USE_STANDARD_TMPFILE"] = self.options.tmpfile + tc.variables["USE_NO_MD5"] = not bool(self.options.md5) + if Version(self.version) >= "1.0.6": + tc.variables["USE_OPENSSL_MD5"] = self.options.md5 == "openssl" + tc.variables["USE_FMEMOPEN"] = self.options.get_safe("fmemopen", False) + tc.variables["USE_DTOA_LIBRARY"] = self.options.dtoa + if is_msvc(self): + tc.variables["USE_STATIC_MSVC_RUNTIME"] = is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("License.txt", src=self._source_subfolder, dst="licenses") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pc") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "xlsxwriter") self.cpp_info.libs = ["xlsxwriter"] diff --git a/recipes/libxlsxwriter/all/patches/1.0.0-0001-fix-cmake.patch b/recipes/libxlsxwriter/all/patches/1.0.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..ea03f6ee126bac --- /dev/null +++ b/recipes/libxlsxwriter/all/patches/1.0.0-0001-fix-cmake.patch @@ -0,0 +1,38 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -153,9 +153,8 @@ endif() + + if(NOT BUILD_SHARED_LIBS) + if(UNIX) +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + elseif(MINGW OR MSYS) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -Wno-char-subscripts -Wno-long-long") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts -Wno-long-long") + list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_FILE32API) + elseif(MSVC) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"") +@@ -183,13 +182,13 @@ enable_language(CXX) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + + # ZLIB +-find_package(ZLIB REQUIRED "1.0") ++find_package(ZLIB REQUIRED) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) + message("zlib version: " ${ZLIB_VERSION}) + + # MINIZIP + if (USE_SYSTEM_MINIZIP) +- find_package(MINIZIP REQUIRED "1.0") ++ find_package(minizip REQUIRED CONFIG) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) + endif() + +@@ -237,7 +236,7 @@ target_sources(${PROJECT_NAME} + PRIVATE ${LXW_SOURCES} + PUBLIC ${LXW_HEADERS} + ) +-target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES}) ++target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB minizip::minizip) + target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) + + # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/all/patches/1.0.0/001-patch-cmake-conan-targets.patch b/recipes/libxlsxwriter/all/patches/1.0.0/001-patch-cmake-conan-targets.patch deleted file mode 100644 index 974e55ba8f8d54..00000000000000 --- a/recipes/libxlsxwriter/all/patches/1.0.0/001-patch-cmake-conan-targets.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2359933..955563c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -180,16 +180,16 @@ endif() - # INCLUDES - # -------- - enable_language(CXX) --list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -+#list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - - # ZLIB --find_package(ZLIB REQUIRED "1.0") -+#find_package(ZLIB REQUIRED "1.0") - list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) - message("zlib version: " ${ZLIB_VERSION}) - - # MINIZIP - if (USE_SYSTEM_MINIZIP) -- find_package(MINIZIP REQUIRED "1.0") -+ #find_package(MINIZIP REQUIRED "1.0") - list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) - endif() - -@@ -237,7 +237,7 @@ target_sources(${PROJECT_NAME} - PRIVATE ${LXW_SOURCES} - PUBLIC ${LXW_HEADERS} - ) --target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES}) -+target_link_libraries(${PROJECT_NAME} LINK_PUBLIC CONAN_PKG::zlib CONAN_PKG::minizip) - target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) - - # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/all/patches/1.1.3-0001-fix-cmake.patch b/recipes/libxlsxwriter/all/patches/1.1.3-0001-fix-cmake.patch new file mode 100644 index 00000000000000..473fc10337147e --- /dev/null +++ b/recipes/libxlsxwriter/all/patches/1.1.3-0001-fix-cmake.patch @@ -0,0 +1,41 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -175,9 +175,8 @@ endif() + + if(NOT BUILD_SHARED_LIBS) + if(UNIX) +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + elseif(MINGW OR MSYS) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -Wno-char-subscripts -Wno-long-long") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts -Wno-long-long") + list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_FILE32API) + elseif(MSVC) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"") +@@ -216,13 +215,13 @@ enable_language(CXX) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + + # ZLIB +-find_package(ZLIB REQUIRED "1.0") ++find_package(ZLIB REQUIRED) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) + message("zlib version: " ${ZLIB_VERSION}) + + # MINIZIP + if (USE_SYSTEM_MINIZIP) +- find_package(MINIZIP REQUIRED "1.0") ++ find_package(minizip REQUIRED CONFIG) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) + endif() + +@@ -278,7 +277,10 @@ target_sources(${PROJECT_NAME} + PRIVATE ${LXW_SOURCES} + PUBLIC ${LXW_HEADERS} + ) +-target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY}) ++target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB minizip::minizip) ++if(USE_OPENSSL_MD5) ++ target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::Crypto) ++endif() + target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) + + # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/all/patches/1.1.3/001-patch-cmake-conan-targets.patch b/recipes/libxlsxwriter/all/patches/1.1.3/001-patch-cmake-conan-targets.patch deleted file mode 100644 index ae1aad6ac2782a..00000000000000 --- a/recipes/libxlsxwriter/all/patches/1.1.3/001-patch-cmake-conan-targets.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt -index 66505b5..d63cc96 100644 ---- a/a/CMakeLists.txt -+++ b/b/CMakeLists.txt -@@ -213,16 +213,16 @@ configure_file(dev/release/pkg-config.txt xlsxwriter.pc @ONLY) - # INCLUDES - # -------- - enable_language(CXX) --list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -+#list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - - # ZLIB - find_package(ZLIB REQUIRED "1.0") --list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) -+#list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) - message("zlib version: " ${ZLIB_VERSION}) - - # MINIZIP - if (USE_SYSTEM_MINIZIP) -- find_package(MINIZIP REQUIRED "1.0") -+# find_package(MINIZIP REQUIRED "1.0") - list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) - endif() - -@@ -259,7 +259,7 @@ if(NOT USE_OPENSSL_MD5 AND NOT USE_NO_MD5) - endif() - - if(USE_OPENSSL_MD5) -- find_package(OpenSSL REQUIRED) -+# find_package(OpenSSL REQUIRED) - if(OpenSSL_FOUND) - include_directories(${OPENSSL_INCLUDE_DIR}) - message(STATUS "OpenSSL version: ${OPENSSL_VERSION}") -@@ -278,7 +278,8 @@ target_sources(${PROJECT_NAME} - PRIVATE ${LXW_SOURCES} - PUBLIC ${LXW_HEADERS} - ) --target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY}) -+#target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY}) -+target_link_libraries(${PROJECT_NAME} LINK_PUBLIC CONAN_PKG::zlib CONAN_PKG::minizip) - target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) - - # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/all/test_package/CMakeLists.txt b/recipes/libxlsxwriter/all/test_package/CMakeLists.txt index 37195b5e1f9031..267b50e398033e 100644 --- a/recipes/libxlsxwriter/all/test_package/CMakeLists.txt +++ b/recipes/libxlsxwriter/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(libxlsxwriter REQUIRED CONFIG) -add_executable(example example.c) -target_link_libraries(example CONAN_PKG::libxlsxwriter) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libxlsxwriter::libxlsxwriter) diff --git a/recipes/libxlsxwriter/all/test_package/conanfile.py b/recipes/libxlsxwriter/all/test_package/conanfile.py index 5a6b132236463b..0a6bc68712d901 100644 --- a/recipes/libxlsxwriter/all/test_package/conanfile.py +++ b/recipes/libxlsxwriter/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class LibxlsxwriterTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libxlsxwriter/all/test_package/example.c b/recipes/libxlsxwriter/all/test_package/test_package.c similarity index 100% rename from recipes/libxlsxwriter/all/test_package/example.c rename to recipes/libxlsxwriter/all/test_package/test_package.c diff --git a/recipes/libxlsxwriter/all/test_v1_package/CMakeLists.txt b/recipes/libxlsxwriter/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libxlsxwriter/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libxlsxwriter/all/test_v1_package/conanfile.py b/recipes/libxlsxwriter/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libxlsxwriter/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 32d5813e0bf69da99551ab4d08b89f6d9f9551b7 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 2 Nov 2022 14:26:12 +0100 Subject: [PATCH 281/300] (#13863) minizip: add 1.2.13 + conan v2 support * conan v2 support * add minizip/1.2.13 --- recipes/minizip/all/CMakeLists.txt | 82 +++++++++---------- recipes/minizip/all/conandata.yml | 9 +- recipes/minizip/all/conanfile.py | 82 ++++++++++--------- .../minizip/all/test_package/CMakeLists.txt | 9 +- recipes/minizip/all/test_package/conanfile.py | 22 +++-- .../minizip/all/test_package/test_package.c | 1 - .../all/test_v1_package/CMakeLists.txt | 8 ++ .../minizip/all/test_v1_package/conanfile.py | 17 ++++ recipes/minizip/config.yml | 2 + 9 files changed, 133 insertions(+), 99 deletions(-) create mode 100644 recipes/minizip/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/minizip/all/test_v1_package/conanfile.py diff --git a/recipes/minizip/all/CMakeLists.txt b/recipes/minizip/all/CMakeLists.txt index 951dd69554eab6..c17b5f7dd7466a 100644 --- a/recipes/minizip/all/CMakeLists.txt +++ b/recipes/minizip/all/CMakeLists.txt @@ -1,75 +1,75 @@ -# This CMake file has been extracted from VCPKG and is under MIT license: -# https://github.com/microsoft/vcpkg/blob/master/ports/minizip/CMakeLists.txt cmake_minimum_required(VERSION 3.4) -project(minizip C) +project(minizip LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -option(ENABLE_BZIP2 "Build minizip with bzip2 support" ON) -option(BUILD_TOOLS "Build minizip tool" OFF) +option(MINIZIP_ENABLE_BZIP2 "Build minizip with bzip2 support" ON) +option(MINIZIP_BUILD_TOOLS "Build minizip tool" OFF) include(GNUInstallDirs) -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") -set(MIN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/contrib/minizip") -include_directories(${MIN_SRC}) +find_package(ZLIB REQUIRED) +if(MINIZIP_ENABLE_BZIP2) + find_package(BZip2 REQUIRED) +endif() set(SOURCE_FILES - ${MIN_SRC}/ioapi.c - ${MIN_SRC}/unzip.c - ${MIN_SRC}/zip.c - ${MIN_SRC}/mztools.c + ${MINIZIP_SRC_DIR}/ioapi.c + ${MINIZIP_SRC_DIR}/unzip.c + ${MINIZIP_SRC_DIR}/zip.c + ${MINIZIP_SRC_DIR}/mztools.c ) if(WIN32) - list(APPEND SOURCE_FILES ${MIN_SRC}/iowin32.c) + list(APPEND SOURCE_FILES ${MINIZIP_SRC_DIR}/iowin32.c) endif() set(HEADER_FILES - ${MIN_SRC}/ioapi.h - ${MIN_SRC}/unzip.h - ${MIN_SRC}/zip.h - ${MIN_SRC}/mztools.h + ${MINIZIP_SRC_DIR}/ioapi.h + ${MINIZIP_SRC_DIR}/unzip.h + ${MINIZIP_SRC_DIR}/zip.h + ${MINIZIP_SRC_DIR}/mztools.h ) if(WIN32) - list(APPEND HEADER_FILES ${MIN_SRC}/iowin32.h) + list(APPEND HEADER_FILES ${MINIZIP_SRC_DIR}/iowin32.h) endif() add_library(minizip ${SOURCE_FILES}) -target_link_libraries(minizip PUBLIC ${CONAN_LIBS}) +target_link_libraries(minizip PUBLIC ZLIB::ZLIB) target_compile_definitions(minizip PRIVATE -D_ZLIB_H) +target_include_directories(minizip PUBLIC ${MINIZIP_SRC_DIR}) +set_target_properties(minizip PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) -if(ENABLE_BZIP2) - target_compile_definitions(minizip PRIVATE -DHAVE_BZIP2=1) +if(MINIZIP_ENABLE_BZIP2) + target_compile_definitions(minizip PUBLIC HAVE_BZIP2=1) + target_link_libraries(minizip PUBLIC BZip2::BZip2) endif() if(MSVC) - target_compile_options(minizip PUBLIC /W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) + target_compile_options(minizip PRIVATE /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) endif() -if (BUILD_TOOLS) - add_executable(minizip_bin ${MIN_SRC}/minizip.c) - add_executable(miniunz_bin ${MIN_SRC}/miniunz.c) +install( + TARGETS minizip + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/minizip) + +if(MINIZIP_BUILD_TOOLS) + add_executable(minizip_bin ${MINIZIP_SRC_DIR}/minizip.c) + add_executable(miniunz_bin ${MINIZIP_SRC_DIR}/miniunz.c) - target_link_libraries(minizip_bin minizip ${CONAN_LIBS}) - target_link_libraries(miniunz_bin minizip ${CONAN_LIBS}) + target_link_libraries(minizip_bin PRIVATE minizip) + target_link_libraries(miniunz_bin PRIVATE minizip) set_target_properties(minizip_bin PROPERTIES OUTPUT_NAME minizip) set_target_properties(miniunz_bin PROPERTIES OUTPUT_NAME miniunz) if(MSVC) - target_compile_options(minizip_bin PUBLIC /W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) - target_compile_options(miniunz_bin PUBLIC /W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) + target_compile_options(minizip_bin PRIVATE /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) + target_compile_options(miniunz_bin PRIVATE /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) endif() install(TARGETS minizip_bin miniunz_bin DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() - -install( - TARGETS minizip - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -) - -install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/minizip) diff --git a/recipes/minizip/all/conandata.yml b/recipes/minizip/all/conandata.yml index 5bf7501fd7ca5b..9a323696f005fc 100644 --- a/recipes/minizip/all/conandata.yml +++ b/recipes/minizip/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.13": + url: "https://github.com/madler/zlib/archive/refs/tags/v1.2.13.tar.gz" + sha256: "1525952a0a567581792613a9723333d7f8cc20b87a81f920fb8bc7e3f2251428" "1.2.12": url: "https://github.com/madler/zlib/archive/refs/tags/v1.2.12.tar.gz" sha256: "d8688496ea40fb61787500e863cc63c9afcbc524468cedeb478068924eb54932" @@ -6,13 +9,11 @@ sources: url: "https://github.com/madler/zlib/archive/v1.2.11.tar.gz" sha256: "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff" patches: + "1.2.13": + - patch_file: "patches/minizip.patch" "1.2.12": - patch_file: "patches/minizip.patch" - base_path: "source_subfolder" - patch_file: "patches/ioapi.patch" - base_path: "source_subfolder" "1.2.11": - patch_file: "patches/minizip.patch" - base_path: "source_subfolder" - patch_file: "patches/miniunz.patch" - base_path: "source_subfolder" diff --git a/recipes/minizip/all/conanfile.py b/recipes/minizip/all/conanfile.py index 02e4e854caf969..8786a7f6a46e76 100644 --- a/recipes/minizip/all/conanfile.py +++ b/recipes/minizip/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile -from conan.tools import files -from conans import CMake -import functools +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, save +import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class MinizipConan(ConanFile): @@ -28,16 +28,9 @@ class MinizipConan(ConanFile): "tools": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,51 +38,60 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.bzip2: self.requires("bzip2/1.0.8") def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ENABLE_BZIP2"] = self.options.bzip2 - cmake.definitions["BUILD_TOOLS"] = self.options.tools - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MINIZIP_SRC_DIR"] = os.path.join(self.source_folder, "contrib", "minizip").replace("\\", "/") + tc.variables["MINIZIP_ENABLE_BZIP2"] = self.options.bzip2 + tc.variables["MINIZIP_BUILD_TOOLS"] = self.options.tools + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - files.apply_conandata_patches(self) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def _extract_license(self): - with files.chdir(self, f"{self.source_folder}/{self._source_subfolder}"): - tmp = files.load(self, "zlib.h") - license_contents = tmp[2:tmp.find("*/", 1)] - files.save(self, "LICENSE", license_contents) + zlib_h = load(self, os.path.join(self.source_folder, "zlib.h")) + return zlib_h[2:zlib_h.find("*/", 1)] def package(self): - self._extract_license() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["minizip"] - self.cpp_info.includedirs = ["include", "include/minizip"] + self.cpp_info.includedirs.append(os.path.join("include", "minizip")) if self.options.bzip2: self.cpp_info.defines.append("HAVE_BZIP2") if self.options.tools: - bin_path = f"{self.package_folder}/bin" - self.output.info(f"Appending PATH environment variable: {bin_path}") - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/minizip/all/test_package/CMakeLists.txt b/recipes/minizip/all/test_package/CMakeLists.txt index cd42f4ee7bc25c..b56bb073cf6064 100644 --- a/recipes/minizip/all/test_package/CMakeLists.txt +++ b/recipes/minizip/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(minizip REQUIRED CONFIG) -add_executable(test_package test_package.c) -target_link_libraries(test_package minizip::minizip) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE minizip::minizip) diff --git a/recipes/minizip/all/test_package/conanfile.py b/recipes/minizip/all/test_package/conanfile.py index 13a71350a8761d..0a6bc68712d901 100644 --- a/recipes/minizip/all/test_package/conanfile.py +++ b/recipes/minizip/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/minizip/all/test_package/test_package.c b/recipes/minizip/all/test_package/test_package.c index a75ed1b9680209..46d12fc8ea16c2 100644 --- a/recipes/minizip/all/test_package/test_package.c +++ b/recipes/minizip/all/test_package/test_package.c @@ -50,4 +50,3 @@ int main(int argc, char** argv) { return EXIT_SUCCESS; } - diff --git a/recipes/minizip/all/test_v1_package/CMakeLists.txt b/recipes/minizip/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/minizip/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/minizip/all/test_v1_package/conanfile.py b/recipes/minizip/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/minizip/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/minizip/config.yml b/recipes/minizip/config.yml index a92270f2d870ad..351c06f68201f8 100644 --- a/recipes/minizip/config.yml +++ b/recipes/minizip/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.13": + folder: all "1.2.12": folder: all "1.2.11": From 74ebd7fb91de0bb9696520704407ff43f914b232 Mon Sep 17 00:00:00 2001 From: Dallas Hart <36043275+Nomalah@users.noreply.github.com> Date: Wed, 2 Nov 2022 09:45:21 -0400 Subject: [PATCH 282/300] (#13407) Add RuntimeQml Package * First attempt at making runtimeqml package * Finished recipe * format * Fix lint * New changes * Update according to uilianries advice * add qt5 version of package and add hash version * Add back test package * update for conan v2 * Remove latest and rename qt5 * Condense test package * Change default to configure * Apply suggestions from code review Co-authored-by: Uilian Ries * Fix missing things from files * Add test_v1_package * Lint fixing * Remove options set as advised * Format & adjust from review * remove dynamically allocated in test * Add missing import Co-authored-by: Uilian Ries --- recipes/runtimeqml/all/CMakeLists.txt | 34 ++++++ recipes/runtimeqml/all/conandata.yml | 7 ++ recipes/runtimeqml/all/conanfile.py | 105 ++++++++++++++++++ .../all/test_package/CMakeLists.txt | 8 ++ .../runtimeqml/all/test_package/conanfile.py | 25 +++++ .../all/test_package/test_package.cpp | 12 ++ .../all/test_v1_package/CMakeLists.txt | 8 ++ .../all/test_v1_package/conanfile.py | 18 +++ recipes/runtimeqml/config.yml | 5 + 9 files changed, 222 insertions(+) create mode 100644 recipes/runtimeqml/all/CMakeLists.txt create mode 100644 recipes/runtimeqml/all/conandata.yml create mode 100644 recipes/runtimeqml/all/conanfile.py create mode 100644 recipes/runtimeqml/all/test_package/CMakeLists.txt create mode 100644 recipes/runtimeqml/all/test_package/conanfile.py create mode 100644 recipes/runtimeqml/all/test_package/test_package.cpp create mode 100644 recipes/runtimeqml/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/runtimeqml/all/test_v1_package/conanfile.py create mode 100644 recipes/runtimeqml/config.yml diff --git a/recipes/runtimeqml/all/CMakeLists.txt b/recipes/runtimeqml/all/CMakeLists.txt new file mode 100644 index 00000000000000..36a7ff24d11b85 --- /dev/null +++ b/recipes/runtimeqml/all/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.21.1) + +project(runtimeqml LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + + +find_package(Qt5 CONFIG) +find_package(Qt6 CONFIG) +if (Qt6_FOUND) + set(HEADERS runtimeqml.hpp) + add_library(${PROJECT_NAME} runtimeqml.hpp runtimeqml.cpp) +elseif(Qt5_FOUND) + set(HEADERS runtimeqml.h) + add_library(${PROJECT_NAME} runtimeqml.h runtimeqml.cpp) +else() + message(FATAL_ERROR "Qt was not found") +endif() + +target_link_libraries(${PROJECT_NAME} PUBLIC qt::qt) +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADERS}" C_VISIBILITY_PRESET hidden) +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/recipes/runtimeqml/all/conandata.yml b/recipes/runtimeqml/all/conandata.yml new file mode 100644 index 00000000000000..a3ea3f95e86825 --- /dev/null +++ b/recipes/runtimeqml/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "cci.20220923": + url: https://github.com/GIPdA/runtimeqml/archive/3ae5dadcf6548a2e59e83c21d84fd50575df79bf.zip + sha256: "18bf63ab2692e6cb8ed6e0dbfcd2390dc65769eaed43b66c4da9dd7a55598603" + "cci.20211220": + url: https://github.com/GIPdA/runtimeqml/archive/ac0cbfc49ae215dd0df5ac8ecb79ca7008de5486.zip + sha256: "57c6d50f0fd281c0984daae65f3559942f58d11de8ff406c150d54fd7ff0d076" diff --git a/recipes/runtimeqml/all/conanfile.py b/recipes/runtimeqml/all/conanfile.py new file mode 100644 index 00000000000000..8ed18efdf54c96 --- /dev/null +++ b/recipes/runtimeqml/all/conanfile.py @@ -0,0 +1,105 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.microsoft import is_msvc, check_min_vs +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.files import get, copy +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.50.0" + + +class RuntimeQml(ConanFile): + name = "runtimeqml" + homepage = "https://github.com/GIPdA/runtimeqml" + description = "Enables hot-reloading qml files" + topics = ("qt", "hot-reload", "qml", "gui") + url = "https://github.com/conan-io/conan-center-index" + license = "BSD-3-Clause" + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False] + } + default_options = { + "shared": False, + "fPIC": True + } + + @property + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, + self.export_sources_folder) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self) + + def requirements(self): + if Version(self.version) <= "cci.20211220": + self.requires("qt/5.15.5") + else: + self.requires("qt/6.3.1") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + qt = self.dependencies["qt"] + if not qt.options.qtdeclarative: + raise ConanInvalidConfiguration( + f"{self.ref} requires option qt:qtdeclarative=True") + + def source(self): + get(self, **self.conan_data["sources"][str(self.version)], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), keep_path=False) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["runtimeqml"] diff --git a/recipes/runtimeqml/all/test_package/CMakeLists.txt b/recipes/runtimeqml/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..0abdc1edf18c8a --- /dev/null +++ b/recipes/runtimeqml/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(runtimeqml REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE runtimeqml::runtimeqml) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/runtimeqml/all/test_package/conanfile.py b/recipes/runtimeqml/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fbb7f5431620 --- /dev/null +++ b/recipes/runtimeqml/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/runtimeqml/all/test_package/test_package.cpp b/recipes/runtimeqml/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..091aa9a1945367 --- /dev/null +++ b/recipes/runtimeqml/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include + +#include + +int main(int argc, char* argv[]) { + QApplication app(argc, argv); + QQmlApplicationEngine engine; + + RuntimeQml rt{ &engine }; + return app.exec(); +} diff --git a/recipes/runtimeqml/all/test_v1_package/CMakeLists.txt b/recipes/runtimeqml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/runtimeqml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/runtimeqml/all/test_v1_package/conanfile.py b/recipes/runtimeqml/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..f44ea85fbe3ebe --- /dev/null +++ b/recipes/runtimeqml/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/runtimeqml/config.yml b/recipes/runtimeqml/config.yml new file mode 100644 index 00000000000000..4efb1871959761 --- /dev/null +++ b/recipes/runtimeqml/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20220923": + folder: "all" + "cci.20211220": + folder: "all" From f030779da4bc72b896b9470b047d7663794817ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maro=C5=A1=20Matisko?= Date: Wed, 2 Nov 2022 15:46:05 +0100 Subject: [PATCH 283/300] (#13847) feat: Modernize function2 recipe to reach conan v2 compatibility * feat: Modernize function2 recipe to reach conan v2 compatibility * Add missing EOF newline, clear duplicate import * fix linking library into test package --- recipes/function2/all/conanfile.py | 62 ++++++++++++------- .../function2/all/test_package/CMakeLists.txt | 17 ++--- .../function2/all/test_package/conanfile.py | 19 ++++-- .../all/test_v1_package/CMakeLists.txt | 14 +++++ .../all/test_v1_package/conanfile.py | 18 ++++++ 5 files changed, 91 insertions(+), 39 deletions(-) create mode 100644 recipes/function2/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/function2/all/test_v1_package/conanfile.py diff --git a/recipes/function2/all/conanfile.py b/recipes/function2/all/conanfile.py index 7dfb1cbbe32531..e29faac1dac09e 100644 --- a/recipes/function2/all/conanfile.py +++ b/recipes/function2/all/conanfile.py @@ -1,7 +1,12 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.50.0" class Function2Conan(ConanFile): @@ -11,42 +16,53 @@ class Function2Conan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Naios/function2" license = "BSL-1.0" - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - def configure(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + def _min_cppstd(self): + return 14 + + @property + def _compiler_minimal_version(self): + return { "gcc": "5", "clang": "3.4", "apple-clang": "10", "Visual Studio": "14" } + + def layout(self): + basic_layout(self) + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) compiler = str(self.settings.compiler) - if compiler not in minimal_version: + if compiler not in self._compiler_minimal_version: self.output.warn( "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + "%s requires a compiler that supports at least C++%s" % (self.name, self._min_cppstd)) return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + version = Version(self.settings.compiler.version) + if version < self._compiler_minimal_version[compiler]: + raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, self._min_cppstd)) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "function2-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst=os.path.join("include", "function2"), src=os.path.join(self._source_subfolder, "include", "function2")) + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/function2/all/test_package/CMakeLists.txt b/recipes/function2/all/test_package/CMakeLists.txt index bf79ed31264232..85a339e09a26c4 100644 --- a/recipes/function2/all/test_package/CMakeLists.txt +++ b/recipes/function2/all/test_package/CMakeLists.txt @@ -1,16 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.10) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package CXX) -add_executable(${PROJECT_NAME} test_package.cpp) +find_package(function2 REQUIRED CONFIG) -set_target_properties( - ${PROJECT_NAME} PROPERTIES +add_executable(${PROJECT_NAME} test_package.cpp) - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON -) +target_link_libraries(${PROJECT_NAME} PRIVATE function2::function2) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/function2/all/test_package/conanfile.py b/recipes/function2/all/test_package/conanfile.py index bd7165a553cf41..b4a4c168002894 100644 --- a/recipes/function2/all/test_package/conanfile.py +++ b/recipes/function2/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/function2/all/test_v1_package/CMakeLists.txt b/recipes/function2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..5816ff152bbfe3 --- /dev/null +++ b/recipes/function2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.10) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(function2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE function2::function2) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/function2/all/test_v1_package/conanfile.py b/recipes/function2/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..8037a9296cc42b --- /dev/null +++ b/recipes/function2/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 160c3664e6bad73fd8274c8d7b110123bf9e0eb5 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 2 Nov 2022 16:07:41 +0100 Subject: [PATCH 284/300] (#13954) cmake: bump openssl --- recipes/cmake/3.x.x/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index 6fa70380c571e5..5656b96c3744a9 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -35,7 +35,7 @@ def config_options(self): def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def validate(self): if self.settings.os == "Macos" and self.settings.arch == "x86": From 070f5da04867c647852d361727227fe4b40f7abc Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 2 Nov 2022 16:46:48 +0100 Subject: [PATCH 285/300] (#13957) libxlsxwriter: bump minizip & openssl --- recipes/libxlsxwriter/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/libxlsxwriter/all/conanfile.py b/recipes/libxlsxwriter/all/conanfile.py index 6cf2bdfa2351ca..467437938757a7 100644 --- a/recipes/libxlsxwriter/all/conanfile.py +++ b/recipes/libxlsxwriter/all/conanfile.py @@ -63,10 +63,10 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("minizip/1.2.12") + self.requires("minizip/1.2.13") self.requires("zlib/1.2.13") if self.options.md5 == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def validate(self): if Version(self.version) < "1.0.6" and self.info.options.md5 == "openssl": From 3fd954f03c13571dbaecadf97bd20759dbe91485 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 2 Nov 2022 20:47:13 +0100 Subject: [PATCH 286/300] (#13614) yder: add yder/1.4.18 recipe --- recipes/yder/all/conandata.yml | 9 + recipes/yder/all/conanfile.py | 149 +++++++ .../1.4.18-0001-shared-static-conan.patch | 406 ++++++++++++++++++ recipes/yder/all/test_package/CMakeLists.txt | 13 + recipes/yder/all/test_package/conanfile.py | 31 ++ recipes/yder/all/test_package/test_package.c | 13 + .../yder/all/test_v1_package/CMakeLists.txt | 16 + recipes/yder/all/test_v1_package/conanfile.py | 18 + recipes/yder/config.yml | 3 + 9 files changed, 658 insertions(+) create mode 100644 recipes/yder/all/conandata.yml create mode 100644 recipes/yder/all/conanfile.py create mode 100644 recipes/yder/all/patches/1.4.18-0001-shared-static-conan.patch create mode 100644 recipes/yder/all/test_package/CMakeLists.txt create mode 100644 recipes/yder/all/test_package/conanfile.py create mode 100644 recipes/yder/all/test_package/test_package.c create mode 100644 recipes/yder/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/yder/all/test_v1_package/conanfile.py create mode 100644 recipes/yder/config.yml diff --git a/recipes/yder/all/conandata.yml b/recipes/yder/all/conandata.yml new file mode 100644 index 00000000000000..f6c79182d9b12f --- /dev/null +++ b/recipes/yder/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.4.18": + url: "https://github.com/babelouest/yder/archive/refs/tags/v1.4.18.tar.gz" + sha256: "b69cc81f6630f66468595d151446c00c90abed058f03f82e151591b8598a7598" +patches: + "1.4.18": + - patch_file: "patches/1.4.18-0001-shared-static-conan.patch" + patch_description: "Build shared and static libraries" + patch_type: "portability" diff --git a/recipes/yder/all/conanfile.py b/recipes/yder/all/conanfile.py new file mode 100644 index 00000000000000..d027f053ed062e --- /dev/null +++ b/recipes/yder/all/conanfile.py @@ -0,0 +1,149 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +import os +import textwrap + +required_conan_version = ">=1.52.0" + + +class YderConan(ConanFile): + name = "yder" + description = "Logging library for C applications" + homepage = "https://github.com/babelouest/yder" + topics = ("logging", "stdout", "file", "journald", "systemd") + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_libsystemd": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_libsystemd": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + del self.options.with_libsystemd + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def requirements(self): + self.requires("orcania/2.3.1") + if self.options.get_safe("with_libsystemd"): + self.requires("libsystemd/251.4") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["DOWNLOAD_DEPENDENCIES"] = False + tc.variables["WITH_JOURNALD"] = self.options.get_safe("with_libsystemd", False) + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if self.options.shared: + if not self.dependencies["orcania"].options.shared: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "Orcania::Orcania", "Orcania::Orcania-static") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + save(self, os.path.join(self.package_folder, self._variable_file_rel_path), + textwrap.dedent(f"""\ + set(YDER_VERSION_STRING "{self.version}") + """)) + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {} if self.options.shared else {"Yder::Yder-static": "Yder::Yder"} + ) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + @property + def _variable_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + def package_info(self): + libname = "yder" + if is_msvc(self) and not self.options.shared: + libname += "-static" + self.cpp_info.libs = [libname] + + target_name = "Yder::Yder" if self.options.shared else "Yder::Yder-static" + self.cpp_info.set_property("cmake_file_name", "Yder") + self.cpp_info.set_property("cmake_target_name", target_name) + self.cpp_info.set_property("cmake_module_file_name", "Yder") + self.cpp_info.set_property("cmake_module_target_name", target_name) + self.cpp_info.set_property("pkg_config_name", "libyder") + self.cpp_info.set_property("cmake_build_modules", [self._variable_file_rel_path]) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "Yder" + self.cpp_info.filenames["cmake_find_package_multi"] = "Yder" + self.cpp_info.names["cmake_find_package"] = "Yder" + self.cpp_info.names["cmake_find_package_multi"] = "Yder" + self.cpp_info.names["pkg_config"] = "libyder" + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path, self._variable_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path, self._variable_file_rel_path] diff --git a/recipes/yder/all/patches/1.4.18-0001-shared-static-conan.patch b/recipes/yder/all/patches/1.4.18-0001-shared-static-conan.patch new file mode 100644 index 00000000000000..0cfb8663d74962 --- /dev/null +++ b/recipes/yder/all/patches/1.4.18-0001-shared-static-conan.patch @@ -0,0 +1,406 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dd30696..2bbd279 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -65,6 +65,7 @@ list(APPEND CMAKE_MODULE_PATH "${Y_CMAKE_MODULE_PATH}") + + include(GNUInstallDirs) + include(CheckSymbolExists) ++include(CMakePackageConfigHelpers) + + # check if _GNU_SOURCE is available + +@@ -94,83 +95,126 @@ set(LIB_SRC + + # dependencies + +-option(WITH_JOURNALD "Check journald." ON) ++set(WITH_JOURNALD_DEFAULT ON) ++if(WIN32) ++ set(WITH_JOURNALD_DEFAULT OFF) ++endif() ++option(WITH_JOURNALD "Check journald." ${WITH_JOURNALD_DEFAULT}) + + if (WITH_JOURNALD) +- include(FindSystemd) + find_package(Systemd REQUIRED) +- if (SYSTEMD_FOUND) +- set(SYSTEMD_LIBRARIES systemd) +- include_directories(${SYSTEMD_INCLUDE_DIRS}) +- set(Y_DISABLE_JOURNALD OFF) +- endif () ++ set(SYSTEMD_LIBRARIES Systemd::Systemd) ++ set(Y_DISABLE_JOURNALD OFF) + else() + set(Y_DISABLE_JOURNALD ON) ++ set(SYSTEMD_LIBRARIES ) + endif () + +-# shared library ++option(BUILD_SHARED "Build shared library." ON) ++option(BUILD_STATIC "Build static library." OFF) + +-add_library(yder SHARED ${LIB_SRC}) +-if (NOT MSVC) +- set_target_properties(yder PROPERTIES +- COMPILE_OPTIONS -Wextra +- PUBLIC_HEADER "${INC_DIR}/yder.h;${PROJECT_BINARY_DIR}/yder-cfg.h" +- VERSION "${LIBRARY_VERSION}" +- SOVERSION "${LIBRARY_SOVERSION}") +-endif() +-if (WIN32) +- set_target_properties(yder PROPERTIES SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll") ++if (NOT BUILD_SHARED AND NOT BUILD_STATIC) ++ message(FATAL_ERROR "BUILD_SHARED and BUILD_STATIC cannot be both disabled") + endif () + + # static library + +-option(BUILD_STATIC "Build static library." OFF) +- + if (BUILD_STATIC) + add_library(yder_static STATIC ${LIB_SRC}) +- target_compile_definitions(yder_static PUBLIC -DO_STATIC_LIBRARY) ++ add_library(Yder::Yder-static ALIAS yder_static) ++ target_include_directories(yder_static ++ PUBLIC "$" ++ PUBLIC "$" ++ PUBLIC "$") ++ target_compile_definitions(yder_static PUBLIC O_STATIC_LIBRARY) + set_target_properties(yder_static PROPERTIES +- OUTPUT_NAME yder) ++ PUBLIC_HEADER "${INC_DIR}/yder.h;${PROJECT_BINARY_DIR}/yder-cfg.h" ++ OUTPUT_NAME yder ++ EXPORT_NAME Yder-static) ++ if (MSVC) ++ set_target_properties(yder_static PROPERTIES ++ OUTPUT_NAME yder-static) ++ else () ++ target_compile_options(yder_static PRIVATE -Wextra) ++ endif () ++ set(yder_lib yder_static) + endif () + ++# shared library ++ ++if (BUILD_SHARED) ++ add_library(yder SHARED ${LIB_SRC}) ++ add_library(Yder::Yder ALIAS yder) ++ target_include_directories(yder ++ PUBLIC "$" ++ PUBLIC "$" ++ PUBLIC "$") ++ set_target_properties(yder PROPERTIES ++ PUBLIC_HEADER "${INC_DIR}/yder.h;${PROJECT_BINARY_DIR}/yder-cfg.h" ++ VERSION "${LIBRARY_VERSION}" ++ SOVERSION "${LIBRARY_SOVERSION}" ++ WINDOWS_EXPORT_ALL_SYMBOLS TRUE ++ EXPORT_NAME Yder) ++ if (WIN32) ++ set_target_properties(yder PROPERTIES ++ SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll") ++ endif () ++ if (NOT MSVC) ++ target_compile_options(yder PRIVATE -Wextra) ++ endif () ++ set(yder_lib yder) ++endif() ++ + option(DOWNLOAD_DEPENDENCIES "Download required dependencies" ON) + + option(SEARCH_ORCANIA "Search for Orcania library" ON) + if (SEARCH_ORCANIA) +- set(Orcania_FIND_QUIETLY ON) # force to find Orcania quietly +- include(FindOrcania) + find_package(Orcania ${ORCANIA_VERSION_REQUIRED} QUIET) # try to find orcania +- if (NOT ORCANIA_FOUND) ++ if (NOT Orcania_FOUND) + if (DOWNLOAD_DEPENDENCIES) + include(DownloadProject) + download_project(PROJ orcania # ... otherwise, download archive +- URL "https://github.com/babelouest/orcania/archive/v${ORCANIA_VERSION_REQUIRED}.tar.gz" +- QUIET) ++ URL "https://github.com/babelouest/orcania/archive/v${ORCANIA_VERSION_REQUIRED}.tar.gz" ++ QUIET) + add_subdirectory(${orcania_SOURCE_DIR} ${orcania_BINARY_DIR}) +- include_directories(${orcania_SOURCE_DIR}/include) +- include_directories(${orcania_BINARY_DIR}) +- add_dependencies(yder orcania) +- set(ORCANIA_LIBRARIES orcania) +- set(LIBS ${LIBS} ${ORCANIA_LIBRARIES}) ++ if (NOT TARGET Orcania::Orcania) ++ add_library(Orcania::Orcania ALIAS orcania) ++ endif () ++ if (NOT TARGET Orcania::Orcania-static AND TARGET orcania_static) ++ add_library(Orcania::Orcania-static ALIAS orcania_static) ++ endif () + else () + message( FATAL_ERROR "Orcania not found") + endif () + else() +- message(STATUS "Orcania found") +- set(LIBS ${LIBS} ${ORCANIA_LIBRARIES}) +- include_directories(${ORCANIA_INCLUDE_DIRS}) +- include_directories(${orcania_BINARY_DIR}) ++ if ("${ORCANIA_VERSION_STRING}" VERSION_GREATER_EQUAL "${ORCANIA_VERSION_REQUIRED}") ++ message(STATUS "Orcania found: ${ORCANIA_VERSION_STRING}") ++ else () ++ message( FATAL_ERROR "Orcania version required: ${ORCANIA_VERSION_REQUIRED} - version installed: ${ORCANIA_VERSION_STRING}") ++ endif () ++ endif () ++else () ++ if (NOT TARGET Orcania:: Orcania) ++ add_library(Orcania::Orcania IMPORTED UNKNOWN) ++ set_target_properties(Orcania::Orcania PROPERTIES IMPORTED_LOCATION "orcania") + endif () + endif () + +-target_link_libraries(yder ${LIBS} ${ORCANIA_LIBRARIES} ${SYSTEMD_LIBRARIES}) ++if (BUILD_SHARED) ++ target_link_libraries(yder PRIVATE $ ${SYSTEMD_LIBRARIES}) ++endif () ++if (BUILD_STATIC) ++ if(TARGET Orcania::Orcania-static) ++ target_link_libraries(yder_static PRIVATE $ ${SYSTEMD_LIBRARIES}) ++ else() ++ target_link_libraries(yder_static PRIVATE $ ${SYSTEMD_LIBRARIES}) ++ endif() ++endif () + ++set(PKGCONF_REQ_PRIVATE "liborcania") ++set(PKGCONF_REQ "") + if (WITH_JOURNALD) +- set(PKGCONF_REQ "") +- set(PKGCONF_REQ_PRIVATE "libsystemd, liborcania") +-else () +- set(PKGCONF_REQ "") +- set(PKGCONF_REQ_PRIVATE "liborcania") ++ string(APPEND PKGCONF_REQ_PRIVATE ", libsystemd") + endif () + + # documentation +@@ -205,11 +249,9 @@ include_directories(${PROJECT_BINARY_DIR}) + option(BUILD_YDER_TESTING "Build the testing tree." OFF) # because we don not use include(CTest) + + if (BUILD_YDER_TESTING) +- include(FindCheck) + find_package(Check) + if (CHECK_FOUND) + if (NOT WIN32 AND NOT APPLE) +- include(FindSubunit) + find_package(Subunit REQUIRED) + endif () + +@@ -218,16 +260,16 @@ if (BUILD_YDER_TESTING) + set(CMAKE_CTEST_COMMAND ctest -V) + + set(TST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test) +- set(LIBS yder ${LIBS} ${CHECK_LIBRARIES} ${ORCANIA_LIBRARIES}) ++ set(TEST_LIBS ${yder_lib} Check::Check) + if (NOT WIN32) + find_package(Threads REQUIRED) +- set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT} m) ++ list(APPEND TEST_LIBS ${CMAKE_THREAD_LIBS_INIT} m) + endif () + if (NOT APPLE) +- set(LIBS ${LIBS} rt) ++ list(APPEND TEST_LIBS rt) + endif () + if (NOT WIN32 AND NOT APPLE) +- set(LIBS ${LIBS} ${SUBUNIT_LIBRARIES}) ++ list(APPEND TEST_LIBS Subunit::Subunit) + endif () + + set(TESTS yder_test) +@@ -239,8 +281,8 @@ if (BUILD_YDER_TESTING) + + foreach (t ${TESTS}) + add_executable(${t} EXCLUDE_FROM_ALL ${TST_DIR}/${t}.c) +- target_include_directories(${t} PUBLIC ${TST_DIR}) +- target_link_libraries(${t} PUBLIC ${LIBS}) ++ target_include_directories(${t} PRIVATE ${TST_DIR}) ++ target_link_libraries(${t} PUBLIC ${TEST_LIBS}) + add_test(NAME ${t} + WORKING_DIRECTORY ${TST_DIR} + COMMAND ${t}) +@@ -269,13 +311,16 @@ configure_file(libyder.pc.in libyder.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libyder.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +-set(TARGETS yder) ++set(TARGETS ) ++if (BUILD_SHARED) ++ list(APPEND TARGETS yder) ++endif () + if (BUILD_STATIC) +- set(TARGETS ${TARGETS} yder_static) ++ list(APPEND TARGETS yder_static) + endif () + + if (INSTALL_HEADER) +- install(TARGETS ${TARGETS} ++ install(TARGETS ${TARGETS} EXPORT YderExports + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +@@ -285,12 +330,33 @@ if (INSTALL_HEADER) + install(FILES README.md + DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT runtime) + else () +- install(TARGETS ${TARGETS} ++ install(TARGETS ${TARGETS} EXPORT YderExports + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif () + ++set(YDER_INSTALL_CMAKEDIR_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake/Yder") ++if (WIN32 AND NOT MINGW) ++ set(YDER_INSTALL_CMAKEDIR_DEFAULT "cmake") ++endif () ++set(YDER_INSTALL_CMAKEDIR ${YDER_INSTALL_CMAKEDIR_DEFAULT} CACHE STRING "Location where to install the cmake config files") ++ ++install(EXPORT YderExports DESTINATION "${YDER_INSTALL_CMAKEDIR}" ++ NAMESPACE "Yder::" ++ FILE "YderTargets.cmake") ++ ++configure_package_config_file(cmake-modules/YderConfig.cmake.in YderConfig.cmake ++ INSTALL_DESTINATION "${YDER_INSTALL_CMAKEDIR}") ++write_basic_package_version_file(YderConfigVersion.cmake ++ COMPATIBILITY AnyNewerVersion) ++ ++install(FILES ++ cmake-modules/FindSystemd.cmake ++ "${PROJECT_BINARY_DIR}/YderConfig.cmake" ++ "${PROJECT_BINARY_DIR}/YderConfigVersion.cmake" ++ DESTINATION "${YDER_INSTALL_CMAKEDIR}") ++ + # uninstall target + + if (NOT TARGET uninstall) +@@ -357,6 +423,7 @@ add_custom_target(dist_y + COMMAND ${CMAKE_MAKE_PROGRAM} package_source) + + message(STATUS "Journald support: ${WITH_JOURNALD}") ++message(STATUS "Build shared library: ${BUILD_SHARED}") + message(STATUS "Build static library: ${BUILD_STATIC}") + message(STATUS "Build testing tree: ${BUILD_YDER_TESTING}") + message(STATUS "Install the header files: ${INSTALL_HEADER}") +diff --git a/cmake-modules/FindCheck.cmake b/cmake-modules/FindCheck.cmake +index 4aad6bc..16d73ef 100644 +--- a/cmake-modules/FindCheck.cmake ++++ b/cmake-modules/FindCheck.cmake +@@ -68,6 +68,12 @@ find_package_handle_standard_args(Check + if (CHECK_FOUND) + set(CHECK_LIBRARIES ${CHECK_LIBRARY}) + set(CHECK_INCLUDE_DIRS ${CHECK_INCLUDE_DIR}) ++ if (NOT TARGET Check::Check) ++ add_library(Check::Check UNKNOWN IMPORTED) ++ set_target_properties(Check::Check PROPERTIES ++ IMPORTED_LOCATION "${CHECK_LIBRARY}" ++ INTERFACE_INCLUDE_DIRECTORIES "${CHECK_INCLUDE_DIR}") ++ endif () + endif () + + mark_as_advanced(CHECK_INCLUDE_DIR CHECK_LIBRARY) +\ No newline at end of file +diff --git a/cmake-modules/FindOrcania.cmake b/cmake-modules/FindOrcania.cmake +index 0d40a07..1a42c07 100644 +--- a/cmake-modules/FindOrcania.cmake ++++ b/cmake-modules/FindOrcania.cmake +@@ -39,7 +39,7 @@ find_path(ORCANIA_INCLUDE_DIR + HINTS ${PC_ORCANIA_INCLUDEDIR} ${PC_ORCANIA_INCLUDE_DIRS}) + + find_library(ORCANIA_LIBRARY +- NAMES orcania liborcania ++ NAMES orcania liborcania orcania-static + HINTS ${PC_ORCANIA_LIBDIR} ${PC_ORCANIA_LIBRARY_DIRS}) + + set(ORCANIA_VERSION_STRING 0.0.0) +@@ -72,6 +72,12 @@ endif () + if (ORCANIA_FOUND) + set(ORCANIA_LIBRARIES ${ORCANIA_LIBRARY}) + set(ORCANIA_INCLUDE_DIRS ${ORCANIA_INCLUDE_DIR}) ++ if (NOT TARGET Orcania::Orcania) ++ add_library(Orcania::Orcania UNKNOWN IMPORTED) ++ set_target_properties(Orcania::Orcania PROPERTIES ++ IMPORTED_LOCATION "${ORCANIA_LIBRARY}" ++ INTERFACE_INCLUDE_DIRECTORIES "${ORCANIA_INCLUDE_DIR}") ++ endif () + endif () + + mark_as_advanced(ORCANIA_INCLUDE_DIR ORCANIA_LIBRARY) +diff --git a/cmake-modules/FindSubunit.cmake b/cmake-modules/FindSubunit.cmake +index 4ce3a24..700b5bc 100644 +--- a/cmake-modules/FindSubunit.cmake ++++ b/cmake-modules/FindSubunit.cmake +@@ -54,6 +54,12 @@ find_package_handle_standard_args(Subunit + if (SUBUNIT_FOUND) + set(SUBUNIT_LIBRARIES ${SUBUNIT_LIBRARY}) + set(SUBUNIT_INCLUDE_DIRS ${SUBUNIT_INCLUDE_DIR}) ++ if (NOT TARGET Subunit::Subunit) ++ add_library(Subunit::Subunit UNKNOWN IMPORTED) ++ set_target_properties(Subunit::Subunit PROPERTIES ++ IMPORTED_LOCATION "${SUBUNIT_LIBRARY}" ++ INTERFACE_INCLUDE_DIRECTORIES "${SUBUNIT_INCLUDE_DIR}") ++ endif () + endif () + + mark_as_advanced(SUBUNIT_INCLUDE_DIR SUBUNIT_LIBRARY) +\ No newline at end of file +diff --git a/cmake-modules/FindSystemd.cmake b/cmake-modules/FindSystemd.cmake +index e212b95..3a28697 100644 +--- a/cmake-modules/FindSystemd.cmake ++++ b/cmake-modules/FindSystemd.cmake +@@ -50,5 +50,11 @@ find_package_handle_standard_args(Systemd + if (SYSTEMD_FOUND) + set(SYSTEMD_LIBRARIES ${SYSTEMD_LIBRARY}) + set(SYSTEMD_INCLUDE_DIRS ${SYSTEMD_INCLUDE_DIR}) ++ if (NOT TARGET Systemd:Systemd) ++ add_library(Systemd::Systemd IMPORTED UNKNOWN) ++ set_target_properties(Systemd::Systemd PROPERTIES ++ IMPORTED_LOCATION "${SYSTEMD_LIBRARY}" ++ INTERFACE_INCLUDE_DIRECTORIES "${SYSTEMD_INCLUDE_DIR}") ++ endif () + endif () + mark_as_advanced(SYSTEMD_INCLUDE_DIR SYSTEMD_LIBRARY) +diff --git a/cmake-modules/YderConfig.cmake.in b/cmake-modules/YderConfig.cmake.in +new file mode 100644 +index 0000000..eaa89da +--- /dev/null ++++ b/cmake-modules/YderConfig.cmake.in +@@ -0,0 +1,32 @@ ++@PACKAGE_INIT@ ++ ++include("${CMAKE_CURRENT_LIST_DIR}/YderTargets.cmake") ++ ++set(YDER_JOURNALD @WITH_JOURNALD@) ++ ++set(CMAKE_CURRENT_LIST_DIR ${_original_cmake_module_path}) ++ ++if(TARGET Yder::Yder-static) ++ set(ORCANIA_INCLUDE_DIRS $) ++ set(ORCANIA_LIBRARIES Yder::Yder-static) ++endif() ++ ++if(TARGET Yder::Yder) ++ set(ORCANIA_INCLUDE_DIRS $) ++ set(ORCANIA_LIBRARIES Yder::Yder) ++endif() ++ ++include(CMakeFindDependencyMacro) ++ ++set(_original_cmake_module_path ${CMAKE_MODULE_PATH}) ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") ++ ++find_dependency(Orcania) ++set(YDER_VERSION_STRING "@PACKAGE_VERSION@") ++if(TARGET Yder::Yder-static) ++ if(YDER_JOURNALD) ++ find_dependency(Systemd) ++ endif() ++endif() ++set(CMAKE_MODULE_PATH ${_original_cmake_module_path}) ++set(Yder_FOUND TRUE) +diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg +index e8f2b8b..8ac5f16 100644 diff --git a/recipes/yder/all/test_package/CMakeLists.txt b/recipes/yder/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..604a54d72e91ea --- /dev/null +++ b/recipes/yder/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Yder REQUIRED CONFIG) + +option(YDER_SHARED "Yder is built as a shared library") + +add_executable(${PROJECT_NAME} test_package.c) +if(YDER_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Yder::Yder) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Yder::Yder-static) +endif() diff --git a/recipes/yder/all/test_package/conanfile.py b/recipes/yder/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0585cd25bd7ad7 --- /dev/null +++ b/recipes/yder/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["YDER_SHARED"] = self.dependencies["yder"].options.shared + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/yder/all/test_package/test_package.c b/recipes/yder/all/test_package/test_package.c new file mode 100644 index 00000000000000..0892f7d0a7c3ae --- /dev/null +++ b/recipes/yder/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#include +#include + +int main() { + y_init_logs("test_package", Y_LOG_MODE_CONSOLE, Y_LOG_LEVEL_DEBUG, NULL, "Logging started"); + y_log_message(Y_LOG_LEVEL_INFO, "We started"); + y_log_message(Y_LOG_LEVEL_DEBUG, "Are we really?"); + y_log_message(Y_LOG_LEVEL_WARNING, "We have nothing to do!"); + y_log_message(Y_LOG_LEVEL_ERROR, "Oops!"); + y_log_message(Y_LOG_LEVEL_INFO, "Bye then!"); + y_close_logs(); + return 0; +} diff --git a/recipes/yder/all/test_v1_package/CMakeLists.txt b/recipes/yder/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..376a5ed06c20aa --- /dev/null +++ b/recipes/yder/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(Yder REQUIRED CONFIG) + +option(YDER_SHARED "Yder is built as a shared library") + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +if(YDER_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Yder::Yder) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Yder::Yder-static) +endif() diff --git a/recipes/yder/all/test_v1_package/conanfile.py b/recipes/yder/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..af01824ff624e1 --- /dev/null +++ b/recipes/yder/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["YDER_SHARED"] = self.options["yder"].shared + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/yder/config.yml b/recipes/yder/config.yml new file mode 100644 index 00000000000000..76bddfaab892de --- /dev/null +++ b/recipes/yder/config.yml @@ -0,0 +1,3 @@ +versions: + "1.4.18": + folder: all From 035bcfd48626a689614e2be2dac3e53d9aa09aa2 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Wed, 2 Nov 2022 21:27:19 +0100 Subject: [PATCH 287/300] (#13662) tensorpipe: conan v2 support --- recipes/tensorpipe/all/CMakeLists.txt | 7 - recipes/tensorpipe/all/conanfile.py | 120 ++++++++++-------- .../all/test_package/CMakeLists.txt | 11 +- .../tensorpipe/all/test_package/conanfile.py | 19 ++- .../all/test_v1_package/CMakeLists.txt | 11 ++ .../all/test_v1_package/conanfile.py | 17 +++ 6 files changed, 111 insertions(+), 74 deletions(-) delete mode 100644 recipes/tensorpipe/all/CMakeLists.txt create mode 100644 recipes/tensorpipe/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/tensorpipe/all/test_v1_package/conanfile.py diff --git a/recipes/tensorpipe/all/CMakeLists.txt b/recipes/tensorpipe/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb93..00000000000000 --- a/recipes/tensorpipe/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/tensorpipe/all/conanfile.py b/recipes/tensorpipe/all/conanfile.py index c6fddca6669691..6b75a2b9a55d19 100644 --- a/recipes/tensorpipe/all/conanfile.py +++ b/recipes/tensorpipe/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.3" class TensorpipeConan(ConanFile): @@ -37,14 +41,6 @@ class TensorpipeConan(ConanFile): "cma": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "pkg_config" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os != "Linux": del self.options.ibv @@ -57,80 +53,94 @@ def configure(self): if not self.options.cuda: del self.options.cuda_ipc + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): self.requires("libnop/cci.20200728") - self.requires("libuv/1.42.0") - if self.options.cuda: - raise ConanInvalidConfiguration("cuda recipe not yet available in CCI") - self.requires("cuda/11.2") + self.requires("libuv/1.44.1") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("tensorpipe doesn't support Windows") - - def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + if self.info.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Windows") + if self.info.options.cuda: + raise ConanInvalidConfiguration("cuda recipe not yet available in CCI") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TP_USE_CUDA"] = self.options.cuda - self._cmake.definitions["TP_ENABLE_IBV"] = self.options.get_safe("ibv", False) - self._cmake.definitions["TP_ENABLE_SHM"] = self.options.get_safe("shm", False) - self._cmake.definitions["TP_ENABLE_CMA"] = self.options.get_safe("cma", False) - self._cmake.definitions["TP_ENABLE_CUDA_IPC"] = self.options.get_safe("cuda_ipc", False) - self._cmake.definitions["TP_BUILD_BENCHMARK"] = False - self._cmake.definitions["TP_BUILD_PYTHON"] = False - self._cmake.definitions["TP_BUILD_TESTING"] = False - self._cmake.definitions["TP_BUILD_LIBUV"] = False - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TP_USE_CUDA"] = self.options.cuda + tc.variables["TP_ENABLE_IBV"] = self.options.get_safe("ibv", False) + tc.variables["TP_ENABLE_SHM"] = self.options.get_safe("shm", False) + tc.variables["TP_ENABLE_CMA"] = self.options.get_safe("cma", False) + tc.variables["TP_ENABLE_CUDA_IPC"] = self.options.get_safe("cuda_ipc", False) + tc.variables["TP_BUILD_BENCHMARK"] = False + tc.variables["TP_BUILD_PYTHON"] = False + tc.variables["TP_BUILD_TESTING"] = False + tc.variables["TP_BUILD_LIBUV"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + cmakelists = os.path.join(self.source_folder, "tensorpipe", "CMakeLists.txt") + replace_in_file(self, cmakelists, "find_package(uv REQUIRED)", "find_package(libuv REQUIRED CONFIG)") + replace_in_file( + self, + cmakelists, + "target_link_libraries(tensorpipe PRIVATE uv::uv)", + "target_link_libraries(tensorpipe PRIVATE $,uv,uv_a>)", + ) + replace_in_file( + self, + cmakelists, + "target_include_directories(tensorpipe PUBLIC $)", + "find_package(libnop REQUIRED CONFIG)\ntarget_link_libraries(tensorpipe PUBLIC libnop::libnop)", + ) def build(self): - with tools.run_environment(self): - cmake = self._configure_cmake() - cmake.build() + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - with tools.run_environment(self): - cmake = self._configure_cmake() - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"tensorpipe": "Tensorpipe::Tensorpipe"}, ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "Tensorpipe") self.cpp_info.set_property("cmake_target_name", "tensorpipe") self.cpp_info.libs = ["tensorpipe"] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.frameworks = ["CoreFoundation", "IOKit"] # TODO: to remove in conan v2 once cmake_find_package* generators removed diff --git a/recipes/tensorpipe/all/test_package/CMakeLists.txt b/recipes/tensorpipe/all/test_package/CMakeLists.txt index a5db988ae91b5f..b5d4b3c8d26da7 100644 --- a/recipes/tensorpipe/all/test_package/CMakeLists.txt +++ b/recipes/tensorpipe/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Tensorpipe REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tensorpipe) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE tensorpipe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/tensorpipe/all/test_package/conanfile.py b/recipes/tensorpipe/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/tensorpipe/all/test_package/conanfile.py +++ b/recipes/tensorpipe/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tensorpipe/all/test_v1_package/CMakeLists.txt b/recipes/tensorpipe/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..a071eb41c6bdd4 --- /dev/null +++ b/recipes/tensorpipe/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Tensorpipe REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tensorpipe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/tensorpipe/all/test_v1_package/conanfile.py b/recipes/tensorpipe/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/tensorpipe/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 002ca72ec1e7aec8145a93c95d1e9e66bebf971c Mon Sep 17 00:00:00 2001 From: Conan Center Index Bot <54393557+conan-center-bot@users.noreply.github.com> Date: Wed, 2 Nov 2022 22:15:18 +0100 Subject: [PATCH 288/300] (#13805) [bot] Add Access Request users (2022-10-27) Co-authored-by: Chris Mc --- .c3i/authorized_users.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index 9bc560565c9434..a5ae861e06aaee 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -962,3 +962,4 @@ authorized_users: - "ramin-raeisi" - "schoetbi" - "psyinf" + - "Novakov" From 3adeb9c87428ff2ccdf56e57222a973745675965 Mon Sep 17 00:00:00 2001 From: psyinf Date: Thu, 3 Nov 2022 11:33:38 +0100 Subject: [PATCH 289/300] (#13674) Add GMTL - Generic Math Template Library recipe * Add GMTL - Generic Math Template Library recipe * Fixed line trailing spaces * Apply suggestions from code review Co-authored-by: Jordan Williams * processed review remarks and corrected referenced source * Removed comment * remove superficial import * Update recipes/gmtl/all/conanfile.py Co-authored-by: Jordan Williams * Renamed package according to suggestions to indicate that this is a fork * Renamed package according to suggestions to indicate that this is a fork * adapted cmake imported packages to fork-name * Update recipes/psyinf-gmtl/all/conandata.yml Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/conandata.yml Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/test_package/CMakeLists.txt Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/test_v1_package/conanfile.py Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/config.yml Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/conanfile.py Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/test_package/CMakeLists.txt Co-authored-by: Chris Mc * Update recipes/psyinf-gmtl/all/test_package/conanfile.py Co-authored-by: Chris Mc * Fixed small issues from suggestions Co-authored-by: Jordan Williams Co-authored-by: Chris Mc --- recipes/psyinf-gmtl/all/conandata.yml | 4 ++ recipes/psyinf-gmtl/all/conanfile.py | 46 +++++++++++++++++++ .../all/test_package/CMakeLists.txt | 8 ++++ .../psyinf-gmtl/all/test_package/conanfile.py | 26 +++++++++++ .../all/test_package/test_package.cpp | 16 +++++++ .../all/test_v1_package/CMakeLists.txt | 11 +++++ .../all/test_v1_package/conanfile.py | 18 ++++++++ recipes/psyinf-gmtl/config.yml | 3 ++ 8 files changed, 132 insertions(+) create mode 100644 recipes/psyinf-gmtl/all/conandata.yml create mode 100644 recipes/psyinf-gmtl/all/conanfile.py create mode 100644 recipes/psyinf-gmtl/all/test_package/CMakeLists.txt create mode 100644 recipes/psyinf-gmtl/all/test_package/conanfile.py create mode 100644 recipes/psyinf-gmtl/all/test_package/test_package.cpp create mode 100644 recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/psyinf-gmtl/all/test_v1_package/conanfile.py create mode 100644 recipes/psyinf-gmtl/config.yml diff --git a/recipes/psyinf-gmtl/all/conandata.yml b/recipes/psyinf-gmtl/all/conandata.yml new file mode 100644 index 00000000000000..ff448e2751be91 --- /dev/null +++ b/recipes/psyinf-gmtl/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.7.1": + url: "https://github.com/psyinf/gmtl/archive/refs/tags/0.7.1.tar.gz" + sha256: "64e36b8c41b1829933921cd5a2f2825111840010b6d0e3aaa82c023c8fd7ebd5" diff --git a/recipes/psyinf-gmtl/all/conanfile.py b/recipes/psyinf-gmtl/all/conanfile.py new file mode 100644 index 00000000000000..dfdf4b08eb11fe --- /dev/null +++ b/recipes/psyinf-gmtl/all/conanfile.py @@ -0,0 +1,46 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "psyinf-gmtl" + description = "The Generic Math Template Library. A math library designed to be high-performance, extensible, and generic." + license = "LGPL-2.1-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/psyinf/gmtl" + topics = ("linear-algebra", "collision", "vector", "matrix", "template", "math", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "gmtl") + self.cpp_info.set_property("cmake_target_name", "gmtl") + self.cpp_info.set_property("pkg_config_name", "gmtl") + + diff --git a/recipes/psyinf-gmtl/all/test_package/CMakeLists.txt b/recipes/psyinf-gmtl/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..774f46c1940864 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(gmtl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gmtl) diff --git a/recipes/psyinf-gmtl/all/test_package/conanfile.py b/recipes/psyinf-gmtl/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/psyinf-gmtl/all/test_package/test_package.cpp b/recipes/psyinf-gmtl/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..221f6d72428d5d --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include "gmtl/gmtl.h" + + +int main(void) { + + gmtl::Vec4f homogeneousVec; + gmtl::Vec4f homogeneousVec2; + gmtl::Matrix44f mat; + + homogeneousVec2 = mat * homogeneousVec; + + gmtl::xform(homogeneousVec2, mat, homogeneousVec); + return EXIT_SUCCESS; +} diff --git a/recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt b/recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..37a3e26d7064ab --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(psyinf-gmtl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE psyinf-gmtl::psyinf-gmtl) diff --git a/recipes/psyinf-gmtl/all/test_v1_package/conanfile.py b/recipes/psyinf-gmtl/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/psyinf-gmtl/config.yml b/recipes/psyinf-gmtl/config.yml new file mode 100644 index 00000000000000..5232c857fcc806 --- /dev/null +++ b/recipes/psyinf-gmtl/config.yml @@ -0,0 +1,3 @@ +versions: + "0.7.1": + folder: all From 4d16dfe4d7fe33f920b9968dfbeb63dbc213697c Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 3 Nov 2022 19:47:42 +0900 Subject: [PATCH 290/300] (#13829) simdutf: add version 2.0.2 and support conan v2 * simdutf: add version 2.0.0 * remove CMakeLists.txt * disable bench tools and add cxx flags for gcc8 * add patch for gcc9 * update 2.0.2 * remove patch file for gcc9 * apply gcc8 workaround to gcc9 partially * link math lib --- recipes/simdutf/all/CMakeLists.txt | 9 --- recipes/simdutf/all/conandata.yml | 16 ++++- recipes/simdutf/all/conanfile.py | 68 +++++++++++-------- .../all/patches/2.0.2-0001-fix-cmake.patch | 55 +++++++++++++++ .../2.0.2-0002-add-workaround-gcc9.patch | 35 ++++++++++ .../simdutf/all/test_package/CMakeLists.txt | 9 +-- recipes/simdutf/all/test_package/conanfile.py | 20 ++++-- .../all/test_v1_package/CMakeLists.txt | 10 +++ .../simdutf/all/test_v1_package/conanfile.py | 18 +++++ recipes/simdutf/config.yml | 2 + 10 files changed, 192 insertions(+), 50 deletions(-) delete mode 100644 recipes/simdutf/all/CMakeLists.txt create mode 100644 recipes/simdutf/all/patches/2.0.2-0001-fix-cmake.patch create mode 100644 recipes/simdutf/all/patches/2.0.2-0002-add-workaround-gcc9.patch create mode 100644 recipes/simdutf/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/simdutf/all/test_v1_package/conanfile.py diff --git a/recipes/simdutf/all/CMakeLists.txt b/recipes/simdutf/all/CMakeLists.txt deleted file mode 100644 index 7d5ba25565b0ab..00000000000000 --- a/recipes/simdutf/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/simdutf/all/conandata.yml b/recipes/simdutf/all/conandata.yml index 806e62129d6cff..212cf39fd9b61e 100644 --- a/recipes/simdutf/all/conandata.yml +++ b/recipes/simdutf/all/conandata.yml @@ -1,10 +1,22 @@ sources: + "2.0.2": + url: "https://github.com/simdutf/simdutf/archive/refs/tags/v2.0.2.tar.gz" + sha256: "ae02a923434c32a9c800e6b136ac039708838ba1f7f6d338175ecb35bf959173" "1.0.1": url: "https://github.com/simdutf/simdutf/archive/refs/tags/v1.0.1.tar.gz" sha256: "e7832ba58fb95fe00de76dbbb2f17d844a7ad02a6f5e3e9e5ce9520e820049a0" patches: + "2.0.2": + - patch_file: "patches/2.0.2-0001-fix-cmake.patch" + patch_description: "remove static build, stop to link static libc++ and enable rpath on macOS" + patch_type: "conan" + - patch_file: "patches/2.0.2-0002-add-workaround-gcc9.patch" + patch_description: "apply gcc8 workaround to gcc9" + patch_type: "portability" "1.0.1": - patch_file: "patches/1.0.1-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "disable test and benchmark build and enable rpath on macOS" + patch_type: "conan" - patch_file: "patches/1.0.1-0002-remove-static.patch" - base_path: "source_subfolder" + patch_description: "remove static build only" + patch_type: "conan" diff --git a/recipes/simdutf/all/conanfile.py b/recipes/simdutf/all/conanfile.py index 13ae8e7b6b61e7..81323a7aa41555 100644 --- a/recipes/simdutf/all/conanfile.py +++ b/recipes/simdutf/all/conanfile.py @@ -1,16 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version + import os -import functools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class SimdutfConan(ConanFile): name = "simdutf" description = "Unicode routines (UTF8, UTF16): billions of characters per second." license = ("Apache-2.0", "MIT") - topics = ("unicode", "transcoding", "neon", "simd", "avx2", "sse2", "utf8", "utf16", ) - homepage = "https://github.com/simdutf/simdutf" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/simdutf/simdutf" + topics = ("unicode", "transcoding", "neon", "simd", "avx2", "sse2", "utf8", "utf16", ) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -20,16 +24,13 @@ class SimdutfConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake", @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,33 +38,46 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SIMDUTF_BENCHMARKS"] = False + tc.variables["BUILD_TESTING"] = False + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) == "8": + tc.variables["CMAKE_CXX_FLAGS"] = " -mavx512f" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs = ["simdutf"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/simdutf/all/patches/2.0.2-0001-fix-cmake.patch b/recipes/simdutf/all/patches/2.0.2-0001-fix-cmake.patch new file mode 100644 index 00000000000000..3721ff5c027be5 --- /dev/null +++ b/recipes/simdutf/all/patches/2.0.2-0001-fix-cmake.patch @@ -0,0 +1,55 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3a41c60..9b66f11 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -34,11 +34,6 @@ else() + endif(BUILD_TESTING) + + +-if(CMAKE_CXX_COMPILER_ID MATCHES GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) +- message(STATUS "The benchmark tool requires GCC 8.0 or better.") +-else() +- add_subdirectory(tools) +-endif() + + if (SIMDUTF_BENCHMARKS) + if((CMAKE_CXX_COMPILER_ID MATCHES GNU) AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0")) +diff --git a/cmake/simdutf-flags.cmake b/cmake/simdutf-flags.cmake +index 9263a7f..39f5a8c 100644 +--- a/cmake/simdutf-flags.cmake ++++ b/cmake/simdutf-flags.cmake +@@ -16,4 +16,4 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake") + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) +-set(CMAKE_MACOSX_RPATH OFF) ++set(CMAKE_MACOSX_RPATH ON) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index f3ede1e..91a1bdd 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -3,7 +3,7 @@ target_include_directories(simdutf-include-sourceâ–½g INTERFACE $/simdutf.cpp) + target_link_libraries(simdutf-source INTERFACE simdutf-include-source) +-add_library(simdutf STATIC simdutf.cpp) ++add_library(simdutf simdutf.cpp) + target_include_directories(simdutf PRIVATE $ ) + target_include_directories(simdutf PUBLIC "$") + +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index 3af1e39..e1223c1 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -17,11 +17,6 @@ else(Iconv_FOUND) + message(STATUS "Iconv was not found!") + endif(Iconv_FOUND) + +-if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")) +- target_link_options(sutf PRIVATE "-static-libstdc++") +- target_link_options(sutf PRIVATE "-Wl,--gc-sections") +- endif() +- + set_property(TARGET sutf PROPERTY CXX_STANDARD 17) + set_property(TARGET sutf PROPERTY CXX_STANDARD_REQUIRED ON) + diff --git a/recipes/simdutf/all/patches/2.0.2-0002-add-workaround-gcc9.patch b/recipes/simdutf/all/patches/2.0.2-0002-add-workaround-gcc9.patch new file mode 100644 index 00000000000000..0ea0932649144c --- /dev/null +++ b/recipes/simdutf/all/patches/2.0.2-0002-add-workaround-gcc9.patch @@ -0,0 +1,35 @@ +diff --git a/src/icelake/icelake_utf8_common.inl.cpp b/src/icelake/icelake_utf8_common.inl.cpp +index 475fb0c..883547e 100644 +--- a/src/icelake/icelake_utf8_common.inl.cpp ++++ b/src/icelake/icelake_utf8_common.inl.cpp +@@ -439,12 +439,12 @@ __m512i prev(__m512i input, __m512i previous) { + static_assert(N<=32, "N must be no larger than 32"); + const __m512i movemask = _mm512_setr_epi32(28,29,30,31,0,1,2,3,4,5,6,7,8,9,10,11); + const __m512i rotated = _mm512_permutex2var_epi32(input, movemask, previous); +-#if SIMDUTF_GCC8 +- constexpr int shift = 16-N; // workaround for GCC8 ++#if SIMDUTF_GCC8 || SIMDUTF_GCC9 ++ constexpr int shift = 16-N; // workaround for GCC8,9 + return _mm512_alignr_epi8(input, rotated, shift); + #else + return _mm512_alignr_epi8(input, rotated, 16-N); +-#endif // SIMDUTF_GCC8 ++#endif // SIMDUTF_GCC8 || SIMDUTF_GCC9 + } + + template +diff --git a/src/simdutf/icelake/intrinsics.h b/src/simdutf/icelake/intrinsics.h +index c71a085..edcd289 100644 +--- a/src/simdutf/icelake/intrinsics.h ++++ b/src/simdutf/icelake/intrinsics.h +@@ -64,7 +64,9 @@ + #if defined(__GNUC__) && !defined(__clang__) + #if __GNUC__ == 8 + #define SIMDUTF_GCC8 1 +-#endif // __GNUC__ == 8 ++#elif __GNUC__ == 9 ++#define SIMDUTF_GCC9 1 ++#endif // __GNUC__ == 8 || __GNUC__ == 9 + #endif // defined(__GNUC__) && !defined(__clang__) + + #if SIMDUTF_GCC8 diff --git a/recipes/simdutf/all/test_package/CMakeLists.txt b/recipes/simdutf/all/test_package/CMakeLists.txt index 1760e67432f8ef..ac41d27abf2c8b 100644 --- a/recipes/simdutf/all/test_package/CMakeLists.txt +++ b/recipes/simdutf/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(simdutf REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} simdutf::simdutf) +target_link_libraries(${PROJECT_NAME} PRIVATE simdutf::simdutf) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/simdutf/all/test_package/conanfile.py b/recipes/simdutf/all/test_package/conanfile.py index 38f4483872d47f..a9fbb7f5431620 100644 --- a/recipes/simdutf/all/test_package/conanfile.py +++ b/recipes/simdutf/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/simdutf/all/test_v1_package/CMakeLists.txt b/recipes/simdutf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..b4c2f89fe6420a --- /dev/null +++ b/recipes/simdutf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(simdutf REQUIRED CONFIG) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/simdutf/all/test_v1_package/conanfile.py b/recipes/simdutf/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/simdutf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/simdutf/config.yml b/recipes/simdutf/config.yml index 715e55357a17be..b7e2d4a8d4264c 100644 --- a/recipes/simdutf/config.yml +++ b/recipes/simdutf/config.yml @@ -1,3 +1,5 @@ versions: + "2.0.2": + folder: all "1.0.1": folder: all From 8c538e031b46eee5359267626eda34f774f12c8b Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 3 Nov 2022 20:28:44 +0900 Subject: [PATCH 291/300] (#13841) wasmtime-cpp: add version 2.0.0 * wasmtime-cpp: add version 2.0.0 * revert min_cppstd * fix license copy * remove conan_version Co-authored-by: Chris Mc * use self.settings instead of self._info Co-authored-by: Chris Mc --- recipes/wasmtime-cpp/all/conandata.yml | 3 +++ recipes/wasmtime-cpp/all/conanfile.py | 22 +++++++++++++--------- recipes/wasmtime-cpp/config.yml | 2 ++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/recipes/wasmtime-cpp/all/conandata.yml b/recipes/wasmtime-cpp/all/conandata.yml index 0942b813968675..7b4bdc1509a606 100644 --- a/recipes/wasmtime-cpp/all/conandata.yml +++ b/recipes/wasmtime-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.0": + url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/refs/tags/v2.0.0.tar.gz" + sha256: "27dcf8fbbc8dbe0387bde2d38e9d78a829b649a0bf86750c5d2a1327a5971b18" "1.0.0": url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/refs/tags/v1.0.0.tar.gz" sha256: "246e1d7f8f7f61170296d68c6f44ba53232d1549807633da366ca70b19089a7a" diff --git a/recipes/wasmtime-cpp/all/conanfile.py b/recipes/wasmtime-cpp/all/conanfile.py index 460095d0e84a70..482036a9eeb0c9 100644 --- a/recipes/wasmtime-cpp/all/conanfile.py +++ b/recipes/wasmtime-cpp/all/conanfile.py @@ -19,7 +19,7 @@ class WasmtimeCppConan(ConanFile): no_copy_source = True @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 17 @property @@ -48,22 +48,26 @@ def package_id(self): self.info.clear() def validate(self): - if self.settings.get_safe("compiler.cppstd"): - check_min_cppstd(self, self._minimum_cpp_standard) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version and Version(self.settings.get_safe("compiler.version")) < minimum_version: - raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - copy(self, pattern="*.hh", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) - self.copy('LICENSE', dst='licenses', src=self.source_folder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, + pattern="*.hh", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include") + ) def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/wasmtime-cpp/config.yml b/recipes/wasmtime-cpp/config.yml index 3c8b013220755d..a6def847495c78 100644 --- a/recipes/wasmtime-cpp/config.yml +++ b/recipes/wasmtime-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.0": + folder: all "1.0.0": folder: all "0.39.0": From dce721cc144cdbe196a05e2794558dc1b3440f5d Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 3 Nov 2022 13:06:19 +0100 Subject: [PATCH 292/300] (#13869) iir1: conan v2 support --- recipes/iir1/all/CMakeLists.txt | 7 -- recipes/iir1/all/conandata.yml | 31 ++++-- recipes/iir1/all/conanfile.py | 101 ++++++++---------- ...rt-headers-for-shared-and-static-lib.patch | 32 ------ .../1.9.0-0001-no-export-static-win.patch | 14 +++ ...-0002-Add-runtime-export-to-install.patch} | 0 .../1.9.0-0003-disable-test-demo.patch | 12 +++ recipes/iir1/all/test_package/CMakeLists.txt | 9 +- recipes/iir1/all/test_package/conanfile.py | 22 ++-- .../iir1/all/test_package/test_package.cpp | 1 - .../iir1/all/test_v1_package/CMakeLists.txt | 8 ++ recipes/iir1/all/test_v1_package/conanfile.py | 17 +++ recipes/iir1/config.yml | 4 +- 13 files changed, 138 insertions(+), 120 deletions(-) delete mode 100644 recipes/iir1/all/CMakeLists.txt delete mode 100644 recipes/iir1/all/patches/0001-Different-export-headers-for-shared-and-static-lib.patch create mode 100644 recipes/iir1/all/patches/1.9.0-0001-no-export-static-win.patch rename recipes/iir1/all/patches/{0002-Add-runtime-export-to-install.patch => 1.9.0-0002-Add-runtime-export-to-install.patch} (100%) create mode 100644 recipes/iir1/all/patches/1.9.0-0003-disable-test-demo.patch create mode 100644 recipes/iir1/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/iir1/all/test_v1_package/conanfile.py diff --git a/recipes/iir1/all/CMakeLists.txt b/recipes/iir1/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d4..00000000000000 --- a/recipes/iir1/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/iir1/all/conandata.yml b/recipes/iir1/all/conandata.yml index e2bfb35acdf25b..dcf07a8d3050e4 100644 --- a/recipes/iir1/all/conandata.yml +++ b/recipes/iir1/all/conandata.yml @@ -1,11 +1,30 @@ sources: - "1.9.0": - url: "https://github.com/berndporr/iir1/archive/refs/tags/1.9.0.tar.gz" - sha256: "BF2C3CD819151D5B85E84CC8349C1AA9DD5E4157A7070BDD143130278B4375E8" "1.9.1": url: "https://github.com/berndporr/iir1/archive/refs/tags/1.9.1.tar.gz" - sha256: "97B4A7D62FA4859AC0D80283696B0D91C320B61EC2A455CDD3D8CFBB2BE3AD9A" + sha256: "97b4a7d62fa4859ac0d80283696b0d91c320b61ec2a455cdd3d8cfbb2be3ad9a" + "1.9.0": + url: "https://github.com/berndporr/iir1/archive/refs/tags/1.9.0.tar.gz" + sha256: "bf2c3cd819151d5b85e84cc8349c1aa9dd5e4157a7070bdd143130278b4375e8" patches: + "1.9.1": + - patch_file: "patches/1.9.0-0001-no-export-static-win.patch" + patch_description: "Avoid to define __declspec(dllexport) on windows at consume time & in static lib" + patch_type: "portability" + sha256: "b29a0a2f4e6f76c57b7a8e4051173a0e82d7d154571377a0fbd75fd73e4fa73c" + - patch_file: "patches/1.9.0-0003-disable-test-demo.patch" + patch_description: "Do not build test & demo" + patch_type: "conan" + sha256: "5b866e0a6d536f12386ecc212c47a993b9e891584879fd507f8b86f596f97cdd" "1.9.0": - - patch_file: "patches/0002-Add-runtime-export-to-install.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.9.0-0001-no-export-static-win.patch" + patch_description: "Avoid to define __declspec(dllexport) on windows at consume time & in static lib" + patch_type: "portability" + sha256: "b29a0a2f4e6f76c57b7a8e4051173a0e82d7d154571377a0fbd75fd73e4fa73c" + - patch_file: "patches/1.9.0-0002-Add-runtime-export-to-install.patch" + patch_description: "Install dll to bin folder" + patch_type: "portability" + sha256: "2f423eb1ee633a03c30d60f58a125f118cf9323402983c908708e7a6478e4bf6" + - patch_file: "patches/1.9.0-0003-disable-test-demo.patch" + patch_description: "Do not build test & demo" + patch_type: "conan" + sha256: "5b866e0a6d536f12386ecc212c47a993b9e891584879fd507f8b86f596f97cdd" diff --git a/recipes/iir1/all/conanfile.py b/recipes/iir1/all/conanfile.py index a88241de2f4099..07124a82ae39d5 100644 --- a/recipes/iir1/all/conanfile.py +++ b/recipes/iir1/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class Iir1Conan(ConanFile): @@ -17,7 +20,7 @@ class Iir1Conan(ConanFile): homepage = "https://github.com/berndporr/iir1" topics = ("dsp", "signals", "filtering") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -29,94 +32,74 @@ class Iir1Conan(ConanFile): "noexceptions": False, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _min_cppstd(self): return "11" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "1.9.1": + if Version(self.version) < "1.9.1": del self.options.noexceptions def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._min_cppstd) + def layout(self): + cmake_layout(self, src_folder="src") - compiler_version = tools.Version(self.settings.compiler.version) - if self.settings.compiler == "gcc" and compiler_version <= 5: - raise ConanInvalidConfiguration("GCC version < 5 not supported") + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - self._cmake = CMake(self) - self._cmake.definitions['IIR1_NO_EXCEPTIONS'] = self.options.get_safe("noexceptions", False) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + if self.options.get_safe("noexceptions"): + tc.preprocessor_definitions["IIR1_NO_EXCEPTIONS"] = "1" + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy('COPYING', dst='licenses', src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "libiir_static.*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "iir_static.*") + rm(self, "*iir_static.*", os.path.join(self.package_folder, "lib")) else: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "iir.*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "iir.*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "libiir.*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "libiir.*") + rmdir(self, os.path.join(self.package_folder, "bin")) + rm(self, "*iir.*", os.path.join(self.package_folder, "lib")) def package_info(self): name = "iir" if self.options.shared else "iir_static" self.cpp_info.set_property("cmake_file_name", "iir") - self.cpp_info.set_property("cmake_target_name", "iir::{}".format(name)) + self.cpp_info.set_property("cmake_target_name", f"iir::{name}") self.cpp_info.set_property("pkg_config_name", "iir") + # TODO: back to global scope in conan v2 + self.cpp_info.components["iir"].libs = [name] + if self.options.get_safe("noexceptions"): + self.cpp_info.components["iir"].defines.append("IIR1_NO_EXCEPTIONS") + # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "iir" self.cpp_info.names["cmake_find_package_multi"] = "iir" - self.cpp_info.names["pkg_config"] = "iir" self.cpp_info.components["iir"].names["cmake_find_package"] = name self.cpp_info.components["iir"].names["cmake_find_package_multi"] = name - self.cpp_info.components["iir"].set_property("cmake_target_name", "iir::{}".format(name)) - - self.cpp_info.components["iir"].libs = [name] - - if self.options.get_safe("noexceptions", False): - self.cpp_info.components["iir"].defines.append("IIR1_NO_EXCEPTIONS") - + self.cpp_info.components["iir"].set_property("cmake_target_name", f"iir::{name}") diff --git a/recipes/iir1/all/patches/0001-Different-export-headers-for-shared-and-static-lib.patch b/recipes/iir1/all/patches/0001-Different-export-headers-for-shared-and-static-lib.patch deleted file mode 100644 index 8635952f9cf528..00000000000000 --- a/recipes/iir1/all/patches/0001-Different-export-headers-for-shared-and-static-lib.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0ddff567ef8f513462f0846bcdd481774a01da95 Mon Sep 17 00:00:00 2001 -From: Wouter Zirkzee -Date: Thu, 25 Nov 2021 23:25:17 +0100 -Subject: [PATCH 1/2] Different export headers for shared and static lib - ---- - iir/Common.h | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/iir/Common.h b/iir/Common.h -index 71c24d6..8d66155 100644 ---- a/iir/Common.h -+++ b/iir/Common.h -@@ -46,8 +46,14 @@ - - // This exports the classes/structures to the windows DLL - #ifdef _WIN32 --#define DllExport __declspec( dllexport ) - #define _CRT_SECURE_NO_WARNINGS -+#ifdef iir_EXPORTS -+#define DllExport __declspec( dllexport ) -+#elif iir_SHARED -+#define DllExport __declspec( dllimport ) -+#else -+#define DllExport -+#endif - #else - #define DllExport - #endif --- -2.25.1 - diff --git a/recipes/iir1/all/patches/1.9.0-0001-no-export-static-win.patch b/recipes/iir1/all/patches/1.9.0-0001-no-export-static-win.patch new file mode 100644 index 00000000000000..d704a63ab7b586 --- /dev/null +++ b/recipes/iir1/all/patches/1.9.0-0001-no-export-static-win.patch @@ -0,0 +1,14 @@ +--- a/iir/Common.h ++++ b/iir/Common.h +@@ -46,7 +46,11 @@ + + // This exports the classes/structures to the windows DLL + #ifdef _WIN32 ++#ifdef iir_EXPORTS + #define DllExport __declspec( dllexport ) ++#else ++#define DllExport ++#endif + #define _CRT_SECURE_NO_WARNINGS + #else + #define DllExport diff --git a/recipes/iir1/all/patches/0002-Add-runtime-export-to-install.patch b/recipes/iir1/all/patches/1.9.0-0002-Add-runtime-export-to-install.patch similarity index 100% rename from recipes/iir1/all/patches/0002-Add-runtime-export-to-install.patch rename to recipes/iir1/all/patches/1.9.0-0002-Add-runtime-export-to-install.patch diff --git a/recipes/iir1/all/patches/1.9.0-0003-disable-test-demo.patch b/recipes/iir1/all/patches/1.9.0-0003-disable-test-demo.patch new file mode 100644 index 00000000000000..18bc682ab4948c --- /dev/null +++ b/recipes/iir1/all/patches/1.9.0-0003-disable-test-demo.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,9 +12,6 @@ cmake_policy(SET CMP0048 NEW) # set VERSION in project() + cmake_policy(SET CMP0042 NEW) # enable MACOSX_RPATH by default + + include(GNUInstallDirs) +-add_subdirectory(test) +-add_subdirectory(demo) +-enable_testing () + + if (MSVC) + add_compile_options(/W4) diff --git a/recipes/iir1/all/test_package/CMakeLists.txt b/recipes/iir1/all/test_package/CMakeLists.txt index 0b931fcced8122..bfb108d7d91988 100644 --- a/recipes/iir1/all/test_package/CMakeLists.txt +++ b/recipes/iir1/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(iir REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - if(TARGET iir::iir) target_link_libraries(${PROJECT_NAME} PRIVATE iir::iir) else() target_link_libraries(${PROJECT_NAME} PRIVATE iir::iir_static) endif() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/iir1/all/test_package/conanfile.py b/recipes/iir1/all/test_package/conanfile.py index 9e186c01878a1f..0a6bc68712d901 100644 --- a/recipes/iir1/all/test_package/conanfile.py +++ b/recipes/iir1/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/iir1/all/test_package/test_package.cpp b/recipes/iir1/all/test_package/test_package.cpp index 5e09ad6b478110..3746899f046a09 100644 --- a/recipes/iir1/all/test_package/test_package.cpp +++ b/recipes/iir1/all/test_package/test_package.cpp @@ -9,4 +9,3 @@ int main() return 0; } - diff --git a/recipes/iir1/all/test_v1_package/CMakeLists.txt b/recipes/iir1/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/iir1/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/iir1/all/test_v1_package/conanfile.py b/recipes/iir1/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/iir1/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/iir1/config.yml b/recipes/iir1/config.yml index ea8e29b6207561..8e492271b1dfd8 100644 --- a/recipes/iir1/config.yml +++ b/recipes/iir1/config.yml @@ -1,5 +1,5 @@ versions: - "1.9.0": - folder: "all" "1.9.1": folder: "all" + "1.9.0": + folder: "all" From 7306fad7d39dc6618e0d23cf8fdca20340126c82 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 3 Nov 2022 13:26:05 +0100 Subject: [PATCH 293/300] (#13880) libzen: conan v2 support --- recipes/libzen/all/CMakeLists.txt | 11 --- recipes/libzen/all/conandata.yml | 2 - recipes/libzen/all/conanfile.py | 89 +++++++++---------- .../libzen/all/test_package/CMakeLists.txt | 11 +-- recipes/libzen/all/test_package/conanfile.py | 19 ++-- .../libzen/all/test_v1_package/CMakeLists.txt | 8 ++ .../libzen/all/test_v1_package/conanfile.py | 17 ++++ 7 files changed, 86 insertions(+), 71 deletions(-) delete mode 100644 recipes/libzen/all/CMakeLists.txt create mode 100644 recipes/libzen/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libzen/all/test_v1_package/conanfile.py diff --git a/recipes/libzen/all/CMakeLists.txt b/recipes/libzen/all/CMakeLists.txt deleted file mode 100644 index 81aa48abdc8fbe..00000000000000 --- a/recipes/libzen/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory(source_subfolder/Project/CMake) diff --git a/recipes/libzen/all/conandata.yml b/recipes/libzen/all/conandata.yml index 40a3c7bd86016c..c0b761db1ccf71 100644 --- a/recipes/libzen/all/conandata.yml +++ b/recipes/libzen/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "0.4.38": - patch_file: "patches/0001-enable-WIN32-shared-libraries.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-export-data-in-windows-dlls.patch" - base_path: "source_subfolder" diff --git a/recipes/libzen/all/conanfile.py b/recipes/libzen/all/conanfile.py index f5c678b4efb25d..1a994b7d1e4701 100644 --- a/recipes/libzen/all/conanfile.py +++ b/recipes/libzen/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class LibzenConan(ConanFile): @@ -11,9 +14,9 @@ class LibzenConan(ConanFile): homepage = "https://github.com/MediaArea/ZenLib" url = "https://github.com/conan-io/conan-center-index" description = "Small C++ derivate classes to have an easier life" - topics = ("libzen", "c++", "helper", "util") + topics = ("c++", "helper", "util") - settings = "os", "arch", "compiler", "build_type" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,17 +30,8 @@ class LibzenConan(ConanFile): "enable_large_files": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,39 +39,43 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_UNICODE"] = self.options.enable_unicode - self._cmake.definitions["LARGE_FILES"] = self.options.enable_large_files + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_UNICODE"] = self.options.enable_unicode + tc.variables["LARGE_FILES"] = self.options.enable_large_files + # Export symbols for msvc shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True # To install relocatable shared libs on Macos - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - self._cmake.configure() - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "Project", "CMake")) cmake.build() def package(self): - self.copy("License.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -85,21 +83,20 @@ def package(self): {"zen": "ZenLib::ZenLib"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "ZenLib") @@ -109,9 +106,9 @@ def package_info(self): if self.settings.build_type == "Debug": if self.settings.os == "Windows": suffix = "d" - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): suffix = "_debug" - self.cpp_info.libs = ["zen{}".format(suffix)] + self.cpp_info.libs = [f"zen{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread"]) if self.options.enable_unicode: diff --git a/recipes/libzen/all/test_package/CMakeLists.txt b/recipes/libzen/all/test_package/CMakeLists.txt index debeb0617c7a5d..761c4f457a6d2b 100644 --- a/recipes/libzen/all/test_package/CMakeLists.txt +++ b/recipes/libzen/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(ZenLib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} zen) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE zen) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libzen/all/test_package/conanfile.py b/recipes/libzen/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/libzen/all/test_package/conanfile.py +++ b/recipes/libzen/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libzen/all/test_v1_package/CMakeLists.txt b/recipes/libzen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libzen/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libzen/all/test_v1_package/conanfile.py b/recipes/libzen/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libzen/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 5d25e7edfa6946bb39053c5cc8033b015e9c8c5f Mon Sep 17 00:00:00 2001 From: toge Date: Thu, 3 Nov 2022 21:46:11 +0900 Subject: [PATCH 294/300] (#13874) trompeloeil: add version 43 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) Co-authored-by: Quentin Chateau via Conan Center Bot --- recipes/trompeloeil/all/conandata.yml | 3 +++ recipes/trompeloeil/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/trompeloeil/all/conandata.yml b/recipes/trompeloeil/all/conandata.yml index 6e066732fc58ca..bb27ac3c59d8a7 100644 --- a/recipes/trompeloeil/all/conandata.yml +++ b/recipes/trompeloeil/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "43": + url: "https://github.com/rollbear/trompeloeil/archive/v43.tar.gz" + sha256: "86a0afa2e97347202a0a883ab43da78c1d4bfff0d6cb93205cfc433d0d9eb9eb" "42": url: "https://github.com/rollbear/trompeloeil/archive/v42.tar.gz" sha256: "96f3b518eeb609216f8f5ba5cf9314181d1d340ebbf25a73ee63a482a669cc4c" diff --git a/recipes/trompeloeil/config.yml b/recipes/trompeloeil/config.yml index b9d0c4e351e683..26645b05ba8da8 100644 --- a/recipes/trompeloeil/config.yml +++ b/recipes/trompeloeil/config.yml @@ -1,4 +1,6 @@ versions: + "43": + folder: all "42": folder: all "41": From 811b68b95847c002ed178348e8f8dfab56102da6 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 3 Nov 2022 14:06:03 +0100 Subject: [PATCH 295/300] (#13584) gnu-config: conan v2 support * conan v2 support * win_bash outside of build_requirements in test package * check_type str for tools.microsoft.bash:path Co-authored-by: Uilian Ries * minor changes Co-authored-by: Uilian Ries --- recipes/gnu-config/all/conanfile.py | 40 ++++++++++++------- .../gnu-config/all/test_package/conanfile.py | 19 +++++---- .../all/test_v1_package/conanfile.py | 22 ++++++++++ 3 files changed, 59 insertions(+), 22 deletions(-) create mode 100644 recipes/gnu-config/all/test_v1_package/conanfile.py diff --git a/recipes/gnu-config/all/conanfile.py b/recipes/gnu-config/all/conanfile.py index 2f551028dfad44..58814fbffa9e07 100644 --- a/recipes/gnu-config/all/conanfile.py +++ b/recipes/gnu-config/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.files import copy, get, load, save +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class GnuConfigConan(ConanFile): @@ -12,21 +14,24 @@ class GnuConfigConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" topics = ("gnu", "config", "autotools", "canonical", "host", "build", "target", "triplet") license = "GPL-3.0-or-later", "autoconf-special-exception" + os = "arch", "compiler", "build_type", "arch" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def _extract_license(self): - txt_lines = tools.load(os.path.join(self.source_folder, self._source_subfolder, "config.guess")).splitlines() + txt_lines = load(self, os.path.join(self.source_folder, "config.guess")).splitlines() start_index = None end_index = None for line_i, line in enumerate(txt_lines): @@ -41,14 +46,19 @@ def _extract_license(self): return "\n".join(txt_lines[start_index:end_index]) def package(self): - tools.save(os.path.join(self.package_folder, "licenses", "COPYING"), self._extract_license()) - self.copy("config.guess", src=self._source_subfolder, dst="bin") - self.copy("config.sub", src=self._source_subfolder, dst="bin") + save(self, os.path.join(self.package_folder, "licenses", "COPYING"), self._extract_license()) + copy(self, "config.guess", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) + copy(self, "config.sub", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.conf_info.define("user.gnu-config:config_guess", os.path.join(bin_path, "config.guess")) + self.conf_info.define("user.gnu-config:config_sub", os.path.join(bin_path, "config.sub")) + # TODO: to remove in conan v2 self.user_info.CONFIG_GUESS = os.path.join(bin_path, "config.guess") self.user_info.CONFIG_SUB = os.path.join(bin_path, "config.sub") + self.env_info.PATH.append(bin_path) diff --git a/recipes/gnu-config/all/test_package/conanfile.py b/recipes/gnu-config/all/test_package/conanfile.py index dd2dd2675f1007..d50d33bfc8962d 100644 --- a/recipes/gnu-config/all/test_package/conanfile.py +++ b/recipes/gnu-config/all/test_package/conanfile.py @@ -1,22 +1,27 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanException +from conans import tools as tools_legacy class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + win_bash = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def test(self): - triplet = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) - self.run("config.guess", run_environment=True, win_bash=tools.os_info.is_windows) + self.run("config.guess") try: - self.run("config.sub {}".format(triplet), run_environment=True, win_bash=tools.os_info.is_windows) + triplet = tools_legacy.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) + self.run(f"config.sub {triplet}") except ConanException: self.output.info("Current configuration is not supported by GNU config.\nIgnoring...") diff --git a/recipes/gnu-config/all/test_v1_package/conanfile.py b/recipes/gnu-config/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..f98dcb17dfac39 --- /dev/null +++ b/recipes/gnu-config/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, tools +from conans.errors import ConanException + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + def test(self): + self.run("config.guess", run_environment=True, win_bash=tools.os_info.is_windows) + try: + triplet = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) + self.run(f"config.sub {triplet}", run_environment=True, win_bash=tools.os_info.is_windows) + except ConanException: + self.output.info("Current configuration is not supported by GNU config.\nIgnoring...") From f4b60619caf84cb28cb193b92c3eb9a7966284b7 Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Thu, 3 Nov 2022 08:27:18 -0500 Subject: [PATCH 296/300] (#13902) glib: Improve test package * glib: Improve test package Fixes issues discussed in #13347. * Remove unused import --- recipes/glib/all/test_package/conanfile.py | 11 +++-------- recipes/glib/all/test_v1_package/conanfile.py | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/recipes/glib/all/test_package/conanfile.py b/recipes/glib/all/test_package/conanfile.py index 8349dc46848c72..22973c4baccc5b 100644 --- a/recipes/glib/all/test_package/conanfile.py +++ b/recipes/glib/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import can_run, cross_building +from conan.tools.build import can_run from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv from conan.tools.gnu import PkgConfig, PkgConfigDeps @@ -22,8 +22,9 @@ def build_requirements(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["CMAKE_CROSSCOMPILING"] = cross_building(self) tc.generate() + virtual_run_env = VirtualRunEnv(self) + virtual_run_env.generate() if self.settings.os == "Windows": deps = CMakeDeps(self) deps.generate() @@ -33,15 +34,10 @@ def generate(self): env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) envvars = env.vars(self) envvars.save_script("pkg_config") - virtual_build_env = VirtualBuildEnv(self) virtual_build_env.generate() - virtual_run_env = VirtualRunEnv(self) - virtual_run_env.generate() pkg_config_deps = PkgConfigDeps(self) pkg_config_deps.generate() - cmake_deps = CMakeDeps(self) - cmake_deps.generate() def build(self): cmake = CMake(self) @@ -57,4 +53,3 @@ def test(self): pkg_config = PkgConfig(self, "gio-2.0", pkg_config_path=self.generators_folder) gdbus_codegen = pkg_config.variables["gdbus_codegen"] self.run(f"{gdbus_codegen} -h", env="conanrun") - diff --git a/recipes/glib/all/test_v1_package/conanfile.py b/recipes/glib/all/test_v1_package/conanfile.py index f8dd4972dff881..ed236807fcf7e8 100644 --- a/recipes/glib/all/test_v1_package/conanfile.py +++ b/recipes/glib/all/test_v1_package/conanfile.py @@ -11,7 +11,7 @@ def build_requirements(self): self.build_requires("pkgconf/1.9.3") def build(self): - if not tools.cross_building(self) and self.settings.os != "Windows": + if self.settings.os != "Windows": with tools.environment_append({'PKG_CONFIG_PATH': "."}): pkg_config = tools.PkgConfig("gio-2.0") self.run(f"{pkg_config.variables['gdbus_codegen']} -h", run_environment=True) From 8f199949c94ed24a37cefad3147bf7fb0c4a6fc4 Mon Sep 17 00:00:00 2001 From: Samuel Roberts Date: Fri, 4 Nov 2022 01:38:10 +1100 Subject: [PATCH 297/300] (#13912) Add opentelemetry/1.7.0 and missing libraries * Add opentelemetry/1.7.0 and missing libraries * Restrict versions for some libraries * Remove zlib requirement * PR feedback --- recipes/opentelemetry-cpp/all/conandata.yml | 31 ++++++---- recipes/opentelemetry-cpp/all/conanfile.py | 62 +++++++++++++++++-- .../all/patches/1.7.0-0001-fix-cmake.patch | 27 ++++++++ recipes/opentelemetry-cpp/config.yml | 2 + 4 files changed, 104 insertions(+), 18 deletions(-) create mode 100644 recipes/opentelemetry-cpp/all/patches/1.7.0-0001-fix-cmake.patch diff --git a/recipes/opentelemetry-cpp/all/conandata.yml b/recipes/opentelemetry-cpp/all/conandata.yml index ff38a16b0e5feb..89d461c779342e 100644 --- a/recipes/opentelemetry-cpp/all/conandata.yml +++ b/recipes/opentelemetry-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.7.0": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.7.0.tar.gz" + sha256: "2ad0911cdc94fe84a93334773bef4789a38bd1f01e39560cabd4a5c267e823c3" "1.6.1": url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.6.1.tar.gz" sha256: "1fc371be049b3220b8b9571c8b713f03e9a84f3c5684363f64ccc814638391a5" @@ -19,27 +22,31 @@ sources: sha256: "32f12ff15ec257e3462883f84bc291c2d5dc30055604c12ec4b46a36dfa3f189" patches: + "1.7.0": + - patch_file: "patches/1.7.0-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.6.1": - patch_file: "patches/1.6.1-0001-fix-cmake.patch" - patch_description: "fix lack of linking libraries" - patch_type: "backport" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.4.1": - patch_file: "patches/1.4.0-0001-fix-cmake.patch" - patch_description: "fix lack of linking libraries" - patch_type: "backport" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.4.0": - patch_file: "patches/1.4.0-0001-fix-cmake.patch" - patch_description: "fix lack of linking libraries" - patch_type: "backport" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.3.0": - patch_file: "patches/1.3.0-0001-fix-cmake.patch" - patch_description: "fix lack of linking libraries" - patch_type: "backport" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.2.0": - patch_file: "patches/1.2.0-0001-fix-cmake.patch" - patch_description: "fix lack of linking libraries" - patch_type: "backport" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.0.1": - patch_file: "patches/1.0.1-0001-fix-cmake.patch" - patch_description: "fix lack of linking libraries" - patch_type: "backport" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index 47723bf6d9c506..e8717c1870f72a 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -173,6 +173,23 @@ def _otel_libraries(self): "opentelemetry_trace", "opentelemetry_version", ] + + if Version(self.version) >= "1.1.0": + libraries.append("opentelemetry_exporter_otlp_http_client") + + if Version(self.version) >= "1.2.0": + libraries.append("opentelemetry_metrics") + + if Version(self.version) >= "1.4.0": + libraries.append("opentelemetry_exporter_ostream_metrics") + + if Version(self.version) >= "1.5.0": + libraries.append("opentelemetry_exporter_otlp_grpc_metrics") + libraries.append("opentelemetry_exporter_otlp_http_metric") + + if Version(self.version) >= "1.7.0": + libraries.append("opentelemetry_exporter_otlp_grpc_client") + if self.settings.os == "Windows": libraries.extend([ "opentelemetry_exporter_etw", @@ -216,18 +233,51 @@ def package_info(self): "opentelemetry_trace", ]) - self.cpp_info.components["opentelemetry_exporter_otlp_grpc"].requires.extend([ - "grpc::grpc++", - "opentelemetry_otlp_recordable", - "protobuf::protobuf", + self.cpp_info.components["opentelemetry_exporter_otlp_http_client"].requires.extend([ + self._http_client_name, + "nlohmann_json::nlohmann_json", + "opentelemetry_proto", ]) self.cpp_info.components["opentelemetry_exporter_otlp_http"].requires.extend([ - self._http_client_name, - "nlohmann_json::nlohmann_json", "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_http_client", ]) + if Version(self.version) >= "1.5.0": + self.cpp_info.components["opentelemetry_exporter_otlp_http_metric"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_http_client" + ]) + + if Version(self.version) >= "1.5.0" and Version(self.version) < "1.7.0": + self.cpp_info.components["opentelemetry_exporter_otlp_grpc_metrics"].requires.extend([ + "grpc::grpc++", + "opentelemetry_otlp_recordable", + ]) + + if Version(self.version) <= "1.7.0": + self.cpp_info.components["opentelemetry_exporter_otlp_grpc"].requires.extend([ + "grpc::grpc++", + "opentelemetry_otlp_recordable", + ]) + + if Version(self.version) >= "1.7.0": + self.cpp_info.components["opentelemetry_exporter_otlp_grpc_client"].requires.extend([ + "grpc::grpc++", + "opentelemetry_proto", + ]) + + self.cpp_info.components["opentelemetry_exporter_otlp_grpc"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_grpc_client" + ]) + + self.cpp_info.components["opentelemetry_exporter_otlp_grpc_metrics"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_grpc_client" + ]) + self.cpp_info.components["opentelemetry_exporter_zipkin_trace"].requires.extend([ self._http_client_name, "nlohmann_json::nlohmann_json", diff --git a/recipes/opentelemetry-cpp/all/patches/1.7.0-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.7.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..e5e3898386303e --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.7.0-0001-fix-cmake.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e7597fc8..d880a90d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -217,7 +217,6 @@ if(WITH_JAEGER) + find_package(Thrift QUIET) + if(Thrift_FOUND) + find_package(Boost REQUIRED) +- include_directories(${Boost_INCLUDE_DIR}) + else() + # Install Thrift and propagate via vcpkg toolchain file + if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 629ea815..3b09b92e 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -242,6 +242,10 @@ else() # cmake 3.8 or lower + target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(BUILD_SHARED_LIBS) + set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() diff --git a/recipes/opentelemetry-cpp/config.yml b/recipes/opentelemetry-cpp/config.yml index d9469bdd59f649..6c4770afa8cf57 100644 --- a/recipes/opentelemetry-cpp/config.yml +++ b/recipes/opentelemetry-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "1.7.0": + folder: all "1.6.1": folder: all "1.4.1": From 1fcccb9d3946d754c841ebea1a1e61125babe70d Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 4 Nov 2022 00:52:42 +0900 Subject: [PATCH 298/300] (#13807) picosha2: add recipe * picosha2: add recipe * add licnese for 1.0.0 * remove conan_version Co-authored-by: Chris Mc * revert info instead of _info Co-authored-by: Chris Mc * revert info instead of _info Co-authored-by: Chris Mc * use self.settings instead of self.info.settings Co-authored-by: Chris Mc --- recipes/picosha2/all/conandata.yml | 7 +++ recipes/picosha2/all/conanfile.py | 59 +++++++++++++++++++ .../picosha2/all/test_package/CMakeLists.txt | 8 +++ .../picosha2/all/test_package/conanfile.py | 26 ++++++++ .../all/test_package/test_package.cpp | 14 +++++ .../all/test_v1_package/CMakeLists.txt | 8 +++ .../picosha2/all/test_v1_package/conanfile.py | 18 ++++++ recipes/picosha2/config.yml | 5 ++ 8 files changed, 145 insertions(+) create mode 100644 recipes/picosha2/all/conandata.yml create mode 100644 recipes/picosha2/all/conanfile.py create mode 100644 recipes/picosha2/all/test_package/CMakeLists.txt create mode 100644 recipes/picosha2/all/test_package/conanfile.py create mode 100644 recipes/picosha2/all/test_package/test_package.cpp create mode 100644 recipes/picosha2/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/picosha2/all/test_v1_package/conanfile.py create mode 100644 recipes/picosha2/config.yml diff --git a/recipes/picosha2/all/conandata.yml b/recipes/picosha2/all/conandata.yml new file mode 100644 index 00000000000000..22dc3aff4c7d21 --- /dev/null +++ b/recipes/picosha2/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "cci.20220808": + url: "https://github.com/okdshin/PicoSHA2/archive/27fcf6979298949e8a462e16d09a0351c18fcaf2.tar.gz" + sha256: "18d82bb79c021ccf4ce58125b64691accef54237ba5194462740bacf8b39d8a9" + "1.0.0": + url: "https://github.com/okdshin/PicoSHA2/archive/refs/tags/v1.0.0.tar.gz" + sha256: "dec99b43440157847cf5dadfad060b9154749523da28eb1599872f87d1ea8e4b" diff --git a/recipes/picosha2/all/conanfile.py b/recipes/picosha2/all/conanfile.py new file mode 100644 index 00000000000000..dbbe31f41d82dd --- /dev/null +++ b/recipes/picosha2/all/conanfile.py @@ -0,0 +1,59 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, load, save +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class PicoSHA2Conan(ConanFile): + name = "picosha2" + description = "a header-file-only, SHA256 hash generator in C++ " + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/okdshin/PicoSHA2" + topics = ("sha256", "hash", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 11 + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + if Version(self.version) == "1.0.0": + filename = os.path.join(self.source_folder, self.source_folder, "picosha2.h") + file_content = load(save, filename) + license_start = "/*" + license_end = "*/" + license_contents = file_content[file_content.find(license_start)+len(license_start):file_content.find(license_end)] + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + else: + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/picosha2/all/test_package/CMakeLists.txt b/recipes/picosha2/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..9a40eed23da8b0 --- /dev/null +++ b/recipes/picosha2/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(picosha2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE picosha2::picosha2) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/picosha2/all/test_package/conanfile.py b/recipes/picosha2/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/picosha2/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/picosha2/all/test_package/test_package.cpp b/recipes/picosha2/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..8c12c7c779d206 --- /dev/null +++ b/recipes/picosha2/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include "picosha2.h" + +void CalcAndOutput(const std::string& src){ + std::cout << "src : \"" << src << "\"\n"; + std::cout << "hash: " << picosha2::hash256_hex_string(src) << "\n" << std::endl; +} + +int main(int argc, char* argv[]) +{ + CalcAndOutput(""); + + return 0; +} diff --git a/recipes/picosha2/all/test_v1_package/CMakeLists.txt b/recipes/picosha2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..145dcc03e0f3d1 --- /dev/null +++ b/recipes/picosha2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/picosha2/all/test_v1_package/conanfile.py b/recipes/picosha2/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/picosha2/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/picosha2/config.yml b/recipes/picosha2/config.yml new file mode 100644 index 00000000000000..ce51ba5c3a9f5c --- /dev/null +++ b/recipes/picosha2/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20220808": + folder: all + "1.0.0": + folder: all From e50aa14f6452fb754c9a90abdcd200a3e7a22a5a Mon Sep 17 00:00:00 2001 From: Jordan Williams Date: Thu, 3 Nov 2022 11:26:43 -0500 Subject: [PATCH 299/300] (#13858) libselinux: Support Conan V2 * libselinux: Support Conan V2 * Fix finding pcre2 * Find config * Use correct FindPackage generator for test v1 package * Add dl system library --- recipes/libselinux/all/conanfile.py | 113 +++++++++++------- .../all/test_package/CMakeLists.txt | 7 +- .../libselinux/all/test_package/conanfile.py | 19 ++- .../all/test_v1_package/CMakeLists.txt | 8 ++ .../all/test_v1_package/conanfile.py | 17 +++ 5 files changed, 114 insertions(+), 50 deletions(-) create mode 100644 recipes/libselinux/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/libselinux/all/test_v1_package/conanfile.py diff --git a/recipes/libselinux/all/conanfile.py b/recipes/libselinux/all/conanfile.py index c55bc85f7d135a..3583de7934d4e5 100644 --- a/recipes/libselinux/all/conanfile.py +++ b/recipes/libselinux/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.32.0" +required_conan_version = ">=1.52.0" class LibSELinuxConan(ConanFile): @@ -15,8 +20,7 @@ class LibSELinuxConan(ConanFile): topics = ("selinux", "security-enhanced linux") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/SELinuxProject/selinux" - license = "Unlicense" # This library (libselinux) is public domain software, i.e. not copyrighted - + license = "Unlicense" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,74 +32,101 @@ class LibSELinuxConan(ConanFile): } def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def configure(self): if self.options.shared: del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def requirements(self): self.requires("pcre2/10.40") def validate(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux is supported") + if self.info.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.build_requires("flex/2.6.4") + self.tool_requires("flex/2.6.4") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + + def layout(self): + basic_layout(self, src_folder="src") def source(self): for download in self.conan_data["sources"][self.version]: - tools.get(**download) + get(self, **download, destination=self.source_folder) @property def _sepol_soversion(self): - return "2" if tools.Version(self.version) >= "3.2" else "1" + return "2" if Version(self.version) >= "3.2" else "1" @property def _selinux_soversion(self): return "1" @property - def _subfolders(self): - _sepol_subfolder = "libsepol-%s" % self.version - _selinux_subfolder = "libselinux-%s" % self.version - return _sepol_subfolder, _selinux_subfolder + def _sepol_library_target(self): + return f"libsepol.so.{self._sepol_soversion}" if self.options.shared else "libsepol.a" + + @property + def _selinux_library_target(self): + return f"libselinux.so.{self._selinux_soversion}" if self.options.shared else "libselinux.a" + + @property + def _sepol_source_folder(self): + return os.path.join(self.source_folder, f"libsepol-{self.version}") + + @property + def _selinux_source_folder(self): + return os.path.join(self.source_folder, f"libselinux-{self.version}") + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + tc = AutotoolsToolchain(self) + sepol_include_folder = os.path.join(self._sepol_source_folder, "include") + tc.extra_cflags.append(f"-I{sepol_include_folder}") + sepol_lib_folder = os.path.join(self._sepol_source_folder, "src") + tc.extra_ldflags.append(f"-L{sepol_lib_folder}") + tc.make_args.append("USE_PCRE2=y") + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - _sepol_subfolder, _selinux_subfolder = self._subfolders - pcre_inc = os.path.join(self.deps_cpp_info["pcre2"].rootpath, - self.deps_cpp_info["pcre2"].includedirs[0]) - pcre_libs = ' '.join(["-l%s" % lib for lib in self.deps_cpp_info["pcre2"].libs]) - sepol_inc = os.path.join(self.source_folder, _sepol_subfolder, "include") - with tools.chdir(os.path.join(_sepol_subfolder, "src")): - args = ["libsepol.so.{}".format(self._sepol_soversion) if self.options.shared else "libsepol.a"] - env_build = AutoToolsBuildEnvironment(self) - env_build.make(args=args) - with tools.chdir(os.path.join(_selinux_subfolder, "src")): - args = ["libselinux.so.{}".format(self._selinux_soversion) if self.options.shared else "libselinux.a", - 'PCRE_CFLAGS=-DPCRE2_CODE_UNIT_WIDTH=8 -DUSE_PCRE2=1 -I%s -I%s' % (pcre_inc, sepol_inc), - 'PCRE_LDLIBS=%s' % pcre_libs] - env_build = AutoToolsBuildEnvironment(self) - env_build.make(args=args) + apply_conandata_patches(self) + autotools = Autotools(self) + with chdir(self, os.path.join(self._sepol_source_folder, "src")): + autotools.make(self._sepol_library_target) + with chdir(self, os.path.join(self._selinux_source_folder)): + autotools.make() def package(self): - _sepol_subfolder, _selinux_subfolder = self._subfolders - self.copy(pattern="LICENSE", dst="licenses", src=_selinux_subfolder) - for library in [_sepol_subfolder, _selinux_subfolder]: - self.copy(pattern="*.h", dst="include", src=os.path.join(library, "include"), keep_path=True) - self.copy(pattern="*.so*", dst="lib", src=library, keep_path=False, symlinks=True) - self.copy(pattern="*.a", dst="lib", src=library, keep_path=False) + copy(self, "LICENSE", self._selinux_source_folder, os.path.join(self.package_folder, "licenses")) + for library in [self._sepol_source_folder, self._selinux_source_folder]: + copy(self, "*.h", os.path.join(library, "include"), os.path.join(self.package_folder, "include")) + if self.options.shared: + copy(self, "*.so*", library, os.path.join(self.package_folder, "lib"), keep_path=False) + else: + copy(self, "*.a", library, os.path.join(self.package_folder, "lib"), keep_path=False) def package_info(self): + self.cpp_info.components["selinux"].set_property("pkg_config_name", "libselinux") self.cpp_info.components["selinux"].names["pkg_config"] = "libselinux" self.cpp_info.components["selinux"].libs = ["selinux"] self.cpp_info.components["selinux"].requires = ["sepol", "pcre2::pcre2"] + if self.options.shared: + self.cpp_info.components["selinux"].system_libs = ["dl"] + self.cpp_info.components["sepol"].set_property("pkg_config_name", "libsepol") self.cpp_info.components["sepol"].names["pkg_config"] = "libsepol" self.cpp_info.components["sepol"].libs = ["sepol"] diff --git a/recipes/libselinux/all/test_package/CMakeLists.txt b/recipes/libselinux/all/test_package/CMakeLists.txt index 7b9b613cbb24a3..7a316858398f3f 100644 --- a/recipes/libselinux/all/test_package/CMakeLists.txt +++ b/recipes/libselinux/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libselinux REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libselinux::libselinux) diff --git a/recipes/libselinux/all/test_package/conanfile.py b/recipes/libselinux/all/test_package/conanfile.py index 5c09494bc67c01..a9fb96656f2039 100644 --- a/recipes/libselinux/all/test_package/conanfile.py +++ b/recipes/libselinux/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libselinux/all/test_v1_package/CMakeLists.txt b/recipes/libselinux/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libselinux/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libselinux/all/test_v1_package/conanfile.py b/recipes/libselinux/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libselinux/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From db2c751895095d1705db1a74f0a4e48bcc9cad06 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Thu, 3 Nov 2022 17:45:45 +0100 Subject: [PATCH 300/300] (#13879) recastnavigation: conan v2 support --- recipes/recastnavigation/all/CMakeLists.txt | 7 -- recipes/recastnavigation/all/conandata.yml | 1 - recipes/recastnavigation/all/conanfile.py | 99 ++++++++++--------- .../all/test_package/CMakeLists.txt | 7 +- .../all/test_package/conanfile.py | 21 ++-- .../all/test_v1_package/CMakeLists.txt | 8 ++ .../all/test_v1_package/conanfile.py | 17 ++++ 7 files changed, 98 insertions(+), 62 deletions(-) delete mode 100644 recipes/recastnavigation/all/CMakeLists.txt create mode 100644 recipes/recastnavigation/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/recastnavigation/all/test_v1_package/conanfile.py diff --git a/recipes/recastnavigation/all/CMakeLists.txt b/recipes/recastnavigation/all/CMakeLists.txt deleted file mode 100644 index 07ec7f05275cb3..00000000000000 --- a/recipes/recastnavigation/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/recastnavigation/all/conandata.yml b/recipes/recastnavigation/all/conandata.yml index fbfd982ff8b37a..eeea2850387754 100644 --- a/recipes/recastnavigation/all/conandata.yml +++ b/recipes/recastnavigation/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20200511": - patch_file: "patches/001_fix_shared_option.patch" - base_path: "source_subfolder" diff --git a/recipes/recastnavigation/all/conanfile.py b/recipes/recastnavigation/all/conanfile.py index 8340de036cff17..cc3eb121186659 100644 --- a/recipes/recastnavigation/all/conanfile.py +++ b/recipes/recastnavigation/all/conanfile.py @@ -1,19 +1,20 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class RecastNavigationConan(ConanFile): name = "recastnavigation" homepage = "https://github.com/recastnavigation/recastnavigation" description = " Navigation-mesh Toolset for Games" - topics = ("conan", "navmesh", "recast", "navigation", "crowd") + topics = ("navmesh", "recast", "navigation", "crowd") url = "https://github.com/conan-io/conan-center-index" license = "Zlib" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" - settings = "os", "compiler", "build_type", "arch" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,17 +23,11 @@ class RecastNavigationConan(ConanFile): "shared": False, "fPIC": True, } - short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + short_paths = True - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,54 +35,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["RECASTNAVIGATION_DEMO"] = False - self._cmake.definitions["RECASTNAVIGATION_TESTS"] = False - self._cmake.definitions["RECASTNAVIGATION_EXAMPLES"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RECASTNAVIGATION_DEMO"] = False + tc.variables["RECASTNAVIGATION_TESTS"] = False + tc.variables["RECASTNAVIGATION_EXAMPLES"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("License.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["cmake_find_package"] = "recastnavigation" - self.cpp_info.names["cmake_find_package_multi"] = "recastnavigation" - self.cpp_info.components["Recast"].names["cmake_find_package"] = "Recast" - self.cpp_info.components["Recast"].names["cmake_find_package_multi"] = "Recast" + self.cpp_info.set_property("cmake_file_name", "recastnavigation") + self.cpp_info.set_property("pkg_config_name", "recastnavigation") + + self.cpp_info.components["Recast"].set_property("cmake_target_name", "RecastNavigation::Recast") self.cpp_info.components["Recast"].libs = ["Recast"] - self.cpp_info.components["Detour"].names["cmake_find_package"] = "Detour" - self.cpp_info.components["Detour"].names["cmake_find_package_multi"] = "Detour" + self.cpp_info.components["Detour"].set_property("cmake_target_name", "RecastNavigation::Detour") self.cpp_info.components["Detour"].libs = ["Detour"] - self.cpp_info.components["DetourCrowd"].names["cmake_find_package"] = "DetourCrowd" - self.cpp_info.components["DetourCrowd"].names["cmake_find_package_multi"] = "DetourCrowd" + self.cpp_info.components["DetourCrowd"].set_property("cmake_target_name", "RecastNavigation::DetourCrowd") self.cpp_info.components["DetourCrowd"].libs = ["DetourCrowd"] self.cpp_info.components["DetourCrowd"].requires = ["Detour"] - self.cpp_info.components["DetourTileCache"].names["cmake_find_package"] = "DetourTileCache" - self.cpp_info.components["DetourTileCache"].names["cmake_find_package_multi"] = "DetourTileCache" + self.cpp_info.components["DetourTileCache"].set_property("cmake_target_name", "RecastNavigation::DetourTileCache") self.cpp_info.components["DetourTileCache"].libs = ["DetourTileCache"] self.cpp_info.components["DetourTileCache"].requires = ["Detour"] - self.cpp_info.components["DebugUtils"].names["cmake_find_package"] = "DebugUtils" - self.cpp_info.components["DebugUtils"].names["cmake_find_package_multi"] = "DebugUtils" + self.cpp_info.components["DebugUtils"].set_property("cmake_target_name", "RecastNavigation::DebugUtils") self.cpp_info.components["DebugUtils"].libs = ["DebugUtils"] self.cpp_info.components["DebugUtils"].requires = ["Recast", "Detour", "DetourTileCache"] + + # TODO: to remove in conan v2 + self.cpp_info.filenames["cmake_find_package"] = "recastnavigation" + self.cpp_info.filenames["cmake_find_package_multi"] = "recastnavigation" + self.cpp_info.names["cmake_find_package"] = "RecastNavigation" + self.cpp_info.names["cmake_find_package_multi"] = "RecastNavigation" + self.cpp_info.components["Recast"].names["cmake_find_package"] = "Recast" + self.cpp_info.components["Recast"].names["cmake_find_package_multi"] = "Recast" + self.cpp_info.components["Detour"].names["cmake_find_package"] = "Detour" + self.cpp_info.components["Detour"].names["cmake_find_package_multi"] = "Detour" + self.cpp_info.components["DetourCrowd"].names["cmake_find_package"] = "DetourCrowd" + self.cpp_info.components["DetourCrowd"].names["cmake_find_package_multi"] = "DetourCrowd" + self.cpp_info.components["DetourTileCache"].names["cmake_find_package"] = "DetourTileCache" + self.cpp_info.components["DetourTileCache"].names["cmake_find_package_multi"] = "DetourTileCache" + self.cpp_info.components["DebugUtils"].names["cmake_find_package"] = "DebugUtils" + self.cpp_info.components["DebugUtils"].names["cmake_find_package_multi"] = "DebugUtils" diff --git a/recipes/recastnavigation/all/test_package/CMakeLists.txt b/recipes/recastnavigation/all/test_package/CMakeLists.txt index 945696beb2efc2..e3ac85f3e748bc 100644 --- a/recipes/recastnavigation/all/test_package/CMakeLists.txt +++ b/recipes/recastnavigation/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(recastnavigation REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE RecastNavigation::Recast) diff --git a/recipes/recastnavigation/all/test_package/conanfile.py b/recipes/recastnavigation/all/test_package/conanfile.py index 12dd810a6ab3bc..0a6bc68712d901 100644 --- a/recipes/recastnavigation/all/test_package/conanfile.py +++ b/recipes/recastnavigation/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/recastnavigation/all/test_v1_package/CMakeLists.txt b/recipes/recastnavigation/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/recastnavigation/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/recastnavigation/all/test_v1_package/conanfile.py b/recipes/recastnavigation/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/recastnavigation/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True)