diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index 6ed3839630c5d4..0d69cef67c601a 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -1009,3 +1009,15 @@ authorized_users: - ashley-b - psmitsu - Viatorus +- mkoviazin +- shtanko-sv +- larshg +- Wuqiqi123 +- OzanCansel +- marlamb +- alexsmedin +- n-morales +- calebgray +- technic +- guillaume-michel +- okaerin diff --git a/.c3i/config_v1.yml b/.c3i/config_v1.yml index e13f5eb8f935a6..870d10c9cf172d 100644 --- a/.c3i/config_v1.yml +++ b/.c3i/config_v1.yml @@ -3,7 +3,7 @@ id: 'conan-io/conan-center-index' conan: - version: 1.54.0 + version: 1.56.0 artifactory: url: "https://c3i.jfrog.io/c3i" @@ -40,10 +40,11 @@ tasks: automatic_merge: reviews_required_total: 2 # Reviews that a PR needs so it can be merged reviews_required_team: 1 # Reviews from the Conan team that a PR needs so it can be merged - cci_wait_for_multibranch: # CCI jobs should wait for other multibranch job for that same PR - job_name: "prod-v2/cci" # e.g. "cci-v2/cci" -> this means waiting for cci-v2/cci/PR- - timeout_seconds: 600 # Maximum time to wait for the multibranch job - merge_messages: true # Merge messages from the multibranch job waited for +# Temporarily disable feedback from Conan v2 + # cci_wait_for_multibranch: # CCI jobs should wait for other multibranch job for that same PR + # job_name: "prod-v2/cci" # e.g. "cci-v2/cci" -> this means waiting for cci-v2/cci/PR- + # timeout_seconds: 600 # Maximum time to wait for the multibranch job + # merge_messages: true # Merge messages from the multibranch job waited for # Profile configurations to build packages configurations: @@ -188,7 +189,6 @@ pod_size: large: - "pcl" - "duckdb" - - "cppfront" xlarge: - "llvm" - "opengv" diff --git a/.c3i/config_v2.yml b/.c3i/config_v2.yml index 08b2375a3d678f..20dcee62abb552 100644 --- a/.c3i/config_v2.yml +++ b/.c3i/config_v2.yml @@ -3,7 +3,7 @@ id: 'conan-io/conan-center-index-staging-v2' conan: - version: 2.0.0-pre + version: 2.0.0-beta7 artifactory: url: "https://c3i.jfrog.io/c3i" diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0d794fd004dd61..3f6e08d2479e94 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,6 +6,5 @@ Specify library name and version: **lib/1.0** --- - [ ] I've read the [contributing guidelines](https://github.com/conan-io/conan-center-index/blob/master/CONTRIBUTING.md). -- [ ] I've followed the [PEP8](https://www.python.org/dev/peps/pep-0008/) style guides for Python code in the recipes. -- [ ] I've used the [latest](https://github.com/conan-io/conan/releases/latest) Conan client version. +- [ ] I've used a [recent](https://github.com/conan-io/conan/releases/latest) Conan client version close to the [currently deployed](https://github.com/conan-io/conan-center-index/blob/master/.c3i/config_v1.yml#L6). - [ ] I've tried at least one configuration locally with the [conan-center hook](https://github.com/conan-io/hooks.git) activated. diff --git a/.github/workflows/linter-conan-v2.yml b/.github/workflows/linter-conan-v2.yml index 146c807267d261..ed93965afa1979 100644 --- a/.github/workflows/linter-conan-v2.yml +++ b/.github/workflows/linter-conan-v2.yml @@ -6,7 +6,6 @@ on: env: PYTHONPATH: ${{github.workspace}} PYVER: "3.8" - SCORE_THRESHOLD: "9.5" REQUIREMENTS: "pylint==2.14" jobs: @@ -21,16 +20,20 @@ jobs: with: files: | linter/** + .github/workflows/linter-conan-v2.yml + - name: Get Conan v1 version id: parse_conan_v1_version if: steps.changed_files.outputs.any_changed == 'true' uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' + - uses: actions/setup-python@v4 if: steps.changed_files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} + - name: Install requirements if: steps.changed_files.outputs.any_changed == 'true' run: | @@ -40,41 +43,35 @@ jobs: id: linter_recipes if: steps.changed_files.outputs.any_changed == 'true' run: | - pylint --rcfile=linter/pylintrc_recipe recipes/*/*/conanfile.py --output-format=json --output=recipes.json --score=y --fail-under=${{ env.SCORE_THRESHOLD }} + echo '## Linter summary (recipes)' >> $GITHUB_STEP_SUMMARY + i=1 + for file in recipes/*/*/conanfile.py; do + if [[ $i -gt 250 ]] ; then + break + fi + echo "$i - $file" + pylint --rcfile=linter/pylintrc_recipe $file --output-format=json --output=recipes.json --score=y --exit-zero + jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' recipes.json > recipes2.json + jq -r '" * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY + (( i += 1 )) + done - name: Execute linter over all test_package/recipes in the repository id: linter_test_package if: steps.changed_files.outputs.any_changed == 'true' - run: | - pylint --rcfile=linter/pylintrc_testpackage recipes/*/*/test_*/conanfile.py --ignore-paths="recipes/[^/]*/[^/]*/test_v1[^/]*/conanfile.py" --output-format=json --output=test_package.json --score=y --fail-under=${{ env.SCORE_THRESHOLD }} - - - name: Archive production artifacts - if: steps.changed_files.outputs.any_changed == 'true' && always() - uses: actions/upload-artifact@v3 - with: - name: linter-output - path: | - recipes.json - test_package.json - - - name: Create report (recipes) - if: steps.changed_files.outputs.any_changed == 'true' && steps.linter_recipes.outcome != 'skipped' && always() - run: | - echo '## Linter summary (recipes)' >> $GITHUB_STEP_SUMMARY - jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' recipes.json > recipes2.json - jq -r '" * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY - - - name: Create report (test_package) - if: steps.changed_files.outputs.any_changed == 'true' && steps.linter_test_package.outcome != 'skipped' && always() run: | echo '## Linter summary (test_package)' >> $GITHUB_STEP_SUMMARY - jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' test_package.json > test_package2.json - jq -r '" * \(.message): \(.length)"' test_package2.json >> $GITHUB_STEP_SUMMARY - - - name: Create report - if: steps.changed_files.outputs.any_changed == 'true' && always() - run: | - echo '> Note.- Check uploaded artifacts for a full report.' >> $GITHUB_STEP_SUMMARY + i=1 + for file in recipes/*/*/conanfile.py; do + if [[ $i -gt 250 ]] ; then + break + fi + echo "$i - $file" + pylint --rcfile=linter/pylintrc_testpackage $file --ignore-paths="recipes/[^/]*/[^/]*/test_v1[^/]*/conanfile.py --output-format=json --output=recipes.json --exit-zero + jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' recipes.json > recipes2.json + jq -r '" * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY + (( i += 1 )) + done conanfile_recipe: name: Lint changed conanfile.py (v2 migration) diff --git a/.github/workflows/linter-yaml.yml b/.github/workflows/linter-yaml.yml index b9f9a1b4c1ede8..d7d4050e8071df 100644 --- a/.github/workflows/linter-yaml.yml +++ b/.github/workflows/linter-yaml.yml @@ -56,13 +56,9 @@ jobs: - name: Run schema check (conandata.yml) if: steps.changed_files.outputs.any_changed == 'true' && always() run: | - err=0 for file in ${{ env.CONANDATA_FILES_PATH }}; do - python3 linter/conandata_yaml_linter.py ${file} || err=1 + python3 linter/conandata_yaml_linter.py ${file} done - if [[ $err == 1 ]]; then - exit 1 - fi lint_pr_files: # Lint files modified in the pull_request @@ -118,8 +114,5 @@ jobs: echo "::remove-matcher owner=yamllint_matcher::" for file in ${{ steps.changed_files_conandata.outputs.all_changed_files }}; do - python3 linter/conandata_yaml_linter.py ${file} || err=1 + python3 linter/conandata_yaml_linter.py ${file} done - if [[ $err == 1 ]]; then - exit 1 - fi diff --git a/docs/adding_packages/README.md b/docs/adding_packages/README.md index 36cc2c528956ca..19f9f5b8d930c9 100644 --- a/docs/adding_packages/README.md +++ b/docs/adding_packages/README.md @@ -53,7 +53,7 @@ The specific steps to add new packages are: * Fork the [conan-center-index](https://github.com/conan-io/conan-center-index) git repository, and then clone it locally. * Copy a template from [package_templates](../package_templates) folder in the recipes/ folder and rename it to the project name (it should be lower-case). Read templates [documentation](../package_templates/README.md) to find more information. -* Make sure you are using the latest [Conan client](https://conan.io/downloads) version, as recipes might evolve introducing features of the newer Conan releases. +* Make sure you are using a recent [Conan client](https://conan.io/downloads) version, as recipes might evolve introducing features of the newer Conan releases. * Commit and Push to GitHub then submit a pull request. * Our automated build service will build 100+ different configurations, and provide messages that indicate if there were any issues found during the pull request on GitHub. diff --git a/docs/adding_packages/build_and_package.md b/docs/adding_packages/build_and_package.md index d243fd84c9ecb6..b247b29d9faa88 100644 --- a/docs/adding_packages/build_and_package.md +++ b/docs/adding_packages/build_and_package.md @@ -19,28 +19,60 @@ Both methods often use build helpers to build binaries and install them into the * `build()` method should focus on build only, not installation. During the build, nothing should be written in `package` folder. Installation step should only occur in `package()` method. -* The build itself should only rely on local files. Nothing should be downloaded from the internet during this step. If external files are required, they should come from `requirements` or `build_requirements` in addition to source files downloaded in `source()` or coming from the recipe itself. +* The build itself should only rely on local files. Nothing should be downloaded from the internet during this step. If external files are required, they should come from `requirements` or `build_requirements` in addition to source files downloaded in `source()` or coming from the recipe itself through `export()` or `export_sources()`. -* Except for CMake and a working build toolchain (compiler, linker, archiver, etc.), the recipe should not assume that any other build tool is installed on the user-build machine (like Meson, autotools, or pkg-config). On Windows, the recipe should not assume that a shell is available (like MSYS2). Therefore, if the build method requires additional tools, they should be added to `build_requirements()`. +* Except for CMake, a working build toolchain (compiler, linker, archiver, etc.), and a "native generator" (`make` on *nix platforms, `mingw32-make` for MinGW, `MSBuild`/`NMake` for Visual Studio), the recipe should not assume that any other build tool is installed on the user-build machine (like Meson, autotools, or pkg-config). On Windows, the recipe should not assume that a shell is available (like MSYS2). Therefore, if the build method requires additional tools, they should be added to `build_requirements()`. + Tools explicitly marked as available by users through conf like `tools.gnu:make_program`, `tools.gnu:pkg_config`, `tools.microsoft.bash:path`, `tools.microsoft.bash:subsystem` should be taken into account to conditionally inject a build requirement (these conf should have precedence over build requirement equivalent hardcoded in the recipe). * It is forbidden to run other conan client commands during build. In other words, if upstream build files call conan under the hood (through `cmake-conan` for example or any other logic), this logic must be removed. * Settings from profile should be honored (`build_type`, `compiler.libcxx`, `compiler.cppstd`, `compiler.runtime` etc). -* These env vars from profile should be honored and properly propagated to underlying build system during the build: `CC`, `CXX`, `CFLAGS`, `CXXFLAGS`, `LDFLAGS`. +* Compiler paths from host profile should be honored and properly propagated to underlying build system during the build: + + | compiler type | conf / env var | + |---------------|----------------| + | C compiler | `c` key of `tools.build:compiler_executables`, otherwise `CC` environment variable | + | C++ compiler | `cpp` key of `tools.build:compiler_executables`, otherwise `CXX` environment variable | + | ASM compiler | `asm` key of `tools.build:compiler_executables`, otherwise `CCAS` environment variable | + | CUDA compiler | `cuda` key of `tools.build:compiler_executables` | + | Fortran compiler | `fortran` key of `tools.build:compiler_executables`, otherwise `FC` environment variable | + | Objective-C compiler | `objc` key of `tools.build:compiler_executables` | + | Objective-C++ compiler | `objcpp` key of `tools.build:compiler_executables` | + | Resource files compiler | `rc` key of `tools.build:compiler_executables`, otherwise `RC` environment variable | + | Archiver | `AR` environment variable | + | Linker | `LD` environment variable | + + They should be curated on the fly if underlying build system expects a specific format (no spaces in path, forward slash instead of back slash, etc). + +* These compiler and linker conf from host profile should be honored and propagated to underlying build system during the build: + * `tools.build:cflags` + * `tools.build:cxxflags` + * `tools.build:defines` + * `tools.build:sharedlinklags` + * `tools.build:exelinkflags` + * `tools.apple:enable_bitcode` (only if host OS is `iOS`/`watchOS`/`tvOS`) + +* Multithread build (if supported by underlying build system): + * if some steps are sensitive to race conditions, monothread should be enforced. + * otherwise multithreaded build should be enabled with a number of cores controlled by `tools.build:jobs` conf from host profile if it is set, otherwise to all cores of build machine. ## Package Method -* CMake config files must be removed (they will be generated for consumers by `cmake_find_package`, `cmake_find_package_multi`, or `CMakeDeps` generators). Use `rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))` or `rm(self, "*.cmake", os.path.join(self.package_folder, "lib"))`. +* CMake config files must be removed. They will be generated for consumers by `CMakeDeps` generator (or legacy `cmake_find_package`/`cmake_find_package_multi` generators). -* pkg-config files must be removed (they will be generated for consumers by `pkg_config` or `PkgConfigDeps` generators). Use `rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))` or `rm(self, "*.pc", os.path.join(self.package_folder, "lib"))`. +* pkg-config files must be removed. They will be generated for consumers by `PkgConfigDeps` generator (or legacy `pkg_config` generator). -* On *nix systems, executables and shared libraries should have empty `RPATH`/`RUNPATH`/`LC_RPATH`. +* On *nix systems, executables and shared libraries should have empty `RPATH`/`RUNPATH`/`LC_RPATH`. Though, a relative path pointing inside package itself is allowed. -* On macOS, install name in `LC_ID_DYLIB` section of shared libs must be `@rpath/`. +* On Apple OS family: + * shared libs: name field of `LC_ID_DYLIB` load command must be `@rpath/`. + * shared libs & executables: name field of each `LC_LOAD_DYLIB` load command should be `@rpath/` (except those refering to system libs or frameworks). * Installed files must not contain absolute paths specific to build machine. Relative paths to other packages is also forbidden since relative paths of dependencies during build may not be the same for consumers. Hardcoded relative paths pointing to a location in the package itself are allowed. +* Static and shared flavors of the same library must not be packaged together. + ## Build System Examples The [Conan's documentation](https://docs.conan.io) is always a good place for technical details. diff --git a/docs/adding_packages/dependencies.md b/docs/adding_packages/dependencies.md index 2fa285a4e607e5..ec2c2650598240 100644 --- a/docs/adding_packages/dependencies.md +++ b/docs/adding_packages/dependencies.md @@ -4,7 +4,19 @@ This section outlines all the practices and guidelines for the `requirements()` from handling "vendored" dependencies to what versions should be used. -## Contents +## Contents + + * [List Dependencies](#list-dependencies) + * [Optional Requirements](#optional-requirements) + * [Build Requirements](#build-requirements) + * [Accessing Dependencies](#accessing-dependencies) + * [Handling Requirement's Options](#handling-requirements-options) + * [Verifying Dependency's Version](#verifying-dependencys-version) + * [Passing Requirement's info to `build()`](#passing-requirements-info-to-build) + * [Overriding the provided properties from the consumer](#overriding-the-provided-properties-from-the-consumer) + * [Adherence to Build Service](#adherence-to-build-service) + * [Version Ranges](#version-ranges) + * [Handling "internal" dependencies](#handling-internal-dependencies) ## List Dependencies diff --git a/docs/adding_packages/test_packages.md b/docs/adding_packages/test_packages.md index 3366e42af3c511..c37f824816aba2 100644 --- a/docs/adding_packages/test_packages.md +++ b/docs/adding_packages/test_packages.md @@ -8,12 +8,12 @@ themselves. It's possible to have ConanCenter run `conan test` on more then one ## Contents - * [Files and Structure](#files-and-structure) - * [CMake targets](#cmake-targets) - * [Testing more generators with `test_`](#testing-more-generators-with-test_something) - * [Testing CMake variables from FindModules](#testing-cmake-variables-from-findmodules) - * [How it works](#how-it-works) - * [Minimalist Source Code](#minimalist-source-code) + * [Files and Structure](#files-and-structure) + * [CMake targets](#cmake-targets) + * [Testing more generators with `test_`](#testing-more-generators-with-test_something) + * [Testing CMake variables from FindModules](#testing-cmake-variables-from-findmodules) + * [How it works](#how-it-works) + * [Minimalist Source Code](#minimalist-source-code) ### Files and Structure diff --git a/docs/changelog.md b/docs/changelog.md index 6fbd36cb107fb7..3b299d84621ca1 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,29 @@ # Changelog +### 16-January-2023 - 16:43 CET + +- [fix] ValidateInfrastructure: Fix Conan version check. +- [feature] TapaholesRepo: Build references when there are 0 packages for a recipe revision. + +### 12-January-2023 - 19:33 CET + +- [fix] Fix Conan v2 download/upload recipe commands. + +### 12-January-2023 - 11:21 CET + +- [feature] Add support for Conan v2 beta 7. +- [feature] Check complete Conan version on ValidateInfrastructure. +- [fix] Increase `conan test` timeout value. +- [fix] Fix stage name when calculating build configurations. + +### 10-January-2023 - 15:20 CET + +- [feature] Add entry in config to disable merging labels from the multibranch job. +- [feature] Add timeout to `conan test` command. +- [feature] Add API wrapper support for status page. +- [refactor] Separate build configuration calculation from pull-request interaction (labels/comments). +- [feature] Take main repository from configuration for Tapaholes jobs. + ### 15-December-2022 - 11:12 CET - [feature] Set github feeback title via config file (`feedback_title`). diff --git a/docs/developing_recipes_locally.md b/docs/developing_recipes_locally.md index a9af9f65023518..afd59e641ddaa4 100644 --- a/docs/developing_recipes_locally.md +++ b/docs/developing_recipes_locally.md @@ -151,10 +151,8 @@ schema validation. There's are to encourage the best possible quality of recipes ```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 + yamllint --config-file linter/yamllint_rules.yml -f standard recipes/config.yml + yamllint --config-file linter/yamllint_rules.yml -f standard recipes/fmt/all/conandata.yml ``` ### Yamlschema diff --git a/docs/faqs.md b/docs/faqs.md index eb2cc47d5c1afc..6b255f700113e4 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -11,6 +11,7 @@ This section gathers the most common questions from the community related to pac * [Why are CMake find/config files and pkg-config files not packaged?](#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged) * [Should recipes export a recipe's license?](#should-recipes-export-a-recipes-license) * [Why recipes that use build tools (like CMake) that have packages in Conan Center do not use it as a build require by default?](#why-recipes-that-use-build-tools-like-cmake-that-have-packages-in-conan-center-do-not-use-it-as-a-build-require-by-default) + * [How are rare build systems without generators packaged?](#how-are-rare-build-systems-without-generators-packaged) * [Are python requires allowed in the `conan-center-index`?](#are-python-requires-allowed-in-the-conan-center-index) * [What version should packages use for libraries without official releases?](#what-version-should-packages-use-for-libraries-without-official-releases) * [Is the Jenkins orchestration library publicly available?](#is-the-jenkins-orchestration-library-publicly-available) @@ -38,7 +39,9 @@ This section gathers the most common questions from the community related to pac * [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) - * [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) + * [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) + * [Can we add package which are parts of bigger projects like Boost?](#can-we-add-package-which-are-parts-of-bigger-projects-like-boost) + * [Can I add my project which I will submit to Boost?](#can-i-add-my-project-which-i-will-submit-to-boost) ## What is the policy on recipe name collisions? diff --git a/docs/package_templates/msbuild_package/all/conanfile.py b/docs/package_templates/msbuild_package/all/conanfile.py index c3e9ab3384c1c5..332dbfb867b379 100644 --- a/docs/package_templates/msbuild_package/all/conanfile.py +++ b/docs/package_templates/msbuild_package/all/conanfile.py @@ -1,7 +1,8 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc, vs_layout, MSBuildDeps, MSBuildToolchain, MSBuild, VCVars -from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildDeps, MSBuildToolchain import os @@ -45,7 +46,7 @@ def configure(self): self.settings.rm_safe("compiler.cppstd") def layout(self): - vs_layout(self) + basic_layout(self, src_folder="src") def requirements(self): # prefer self.requires method instead of requires attribute @@ -63,44 +64,69 @@ def build_requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + @property + def _msbuild_configuration(self): + # Customize to Release when RelWithDebInfo or MinSizeRel, if upstream build files + # don't have RelWithDebInfo and MinSizeRel. + # Moreover: + # - you may have to change these values if upstream build file uses custom configuration names. + # - configuration of MSBuildToolchain/MSBuildDeps & build_type of MSBuild may have to be different. + # Its unusual, but it happens when there is a preSolution/postSolution mapping with different names. + # * build_type attribute of MSBuild should match preSolution + # * configuration attribute of MSBuildToolchain/MSBuildDeps should match postSolution + return "Debug" if self.settings.build_type == "Debug" else "Release" + def generate(self): tc = MSBuildToolchain(self) - tc.generate() - tc = MSBuildDeps(self) - tc.generate() - tc = VCVars(self) + tc.configuration = self._msbuild_configuration tc.generate() + # If there are requirements + deps = MSBuildDeps(self) + deps.configuration = self._msbuild_configuration + deps.generate() + 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, "CMakeLists.txt"), "...", "") + # Allows to inject platform toolset, and props file generated by MSBuildToolchain & MSBuildDeps + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_files = ["path/to/vcxproj_file1", "path/to/vcxproj_file2", "..."] + platform_toolset = MSBuildToolchain(self).toolset + import_conan_generators = "" + for props_file in ["conantoolchain.props", "conandeps.props"]: + props_path = os.path.join(self.generators_folder, props_file) + if os.path.exists(props_path): + import_conan_generators += f"" + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + # change this v142 value depending on actual value in vcxproj file + "v142", + f"{platform_toolset}", + ) + if props_path: + replace_in_file( + self, vcxproj_file, + "", + f"{import_conan_generators}", + ) + def build(self): self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed msbuild = MSBuild(self) - # customize to Release when RelWithDebInfo - msbuild.build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - # use Win32 instead of the default value when building x86 - msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build_type = self._msbuild_configuration # customize according the solution file and compiler version msbuild.build(sln="project_2017.sln") def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - copy( - self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False - ) - copy( - self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False - ) - copy( - self, - pattern="*.h", - dst=os.path.join(self.package_folder, "include"), - src=os.path.join(self.source_folder, "include"), - ) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + 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.libs = ["package_lib"] diff --git a/linter/check_layout_src_folder.py b/linter/check_layout_src_folder.py index 592565dae0b445..b7d418884ca458 100644 --- a/linter/check_layout_src_folder.py +++ b/linter/check_layout_src_folder.py @@ -32,7 +32,7 @@ def visit_call(self, node: nodes.Call) -> None: if not isinstance(node.func, nodes.Name): return - if node.func.name in ["cmake_layout", "vs_layout", "basic_layout"]: + if node.func.name in ["cmake_layout", "bazel_layout", "basic_layout"]: for kw in node.keywords: if kw.arg == "src_folder": if not kw.value or kw.value.as_string().strip("\"'") != "src": diff --git a/linter/conandata_yaml_linter.py b/linter/conandata_yaml_linter.py index e55abd40a32c15..739a4a6ef00da3 100644 --- a/linter/conandata_yaml_linter.py +++ b/linter/conandata_yaml_linter.py @@ -1,5 +1,4 @@ import argparse -import sys from strictyaml import ( load, Map, @@ -54,13 +53,12 @@ def main(): try: parsed = load(content, schema) except YAMLValidationError as error: - pretty_print_yaml_validate_error(args, error) - sys.exit(1) + pretty_print_yaml_validate_error(args, error) # Error when "source" is missing or when "patches" has no versions + return except BaseException as error: - pretty_print_yaml_validate_error(args, error) - sys.exit(1) + pretty_print_yaml_validate_error(args, error) # YAML could not be parsed + return - exit_code = 0 if "patches" in parsed: for version in parsed["patches"]: patches = parsed["patches"][version] @@ -69,8 +67,7 @@ def main(): try: parsed["patches"][version][i].revalidate(patch_fields) except YAMLValidationError as error: - pretty_print_yaml_validate_error(args, error) - exit_code = 1 + pretty_print_yaml_validate_warning(args, error) # Warning when patch fields are not followed continue # Make sure `patch_source` exists where it's encouraged @@ -98,8 +95,6 @@ def main(): " the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)" ) - sys.exit(exit_code) - def pretty_print_yaml_validate_error(args, error): snippet = error.context_mark.get_snippet().replace("\n", "%0A") @@ -108,6 +103,14 @@ def pretty_print_yaml_validate_error(args, error): f"title=conandata.yml schema error" f"::Schema outlined in {CONANDATA_YAML_URL}#patches-fields is not followed.%0A%0A{error.problem} in %0A{snippet}%0A" ) + +def pretty_print_yaml_validate_warning(args, error): + snippet = error.context_mark.get_snippet().replace("\n", "%0A") + print( + f"::warning file={args.path},line={error.context_mark.line},endline={error.problem_mark.line+1}," + f"title=conandata.yml schema warning" + f"::Schema outlined in {CONANDATA_YAML_URL}#patches-fields is not followed.%0A%0A{error.problem} in %0A{snippet}%0A" + ) if __name__ == "__main__": diff --git a/recipes/archicad-apidevkit/all/conandata.yml b/recipes/archicad-apidevkit/all/conandata.yml new file mode 100644 index 00000000000000..d3788a4383b777 --- /dev/null +++ b/recipes/archicad-apidevkit/all/conandata.yml @@ -0,0 +1,28 @@ +sources: + "26": + Macos: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/220529.v2022Release.3000.FULL.FIN.MAC64.DevKitAPI.tar.gz" + sha256: "326643eb79619166b6cb8f2858be3b24c1c3e3dd6749d20d2960baa0690f8e9c" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" + Windows: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/220529.v2022Release.3000.FULL.FIN.WIN64.DevKitAPI.zip" + sha256: "588c411b8bb8263bd417c271bb5a8d01136a802cb60116732ab5c1e2fbbf0558" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" + + "25": + Macos: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/210709.v2021Release.3006.FULL.FIN.MAC64.DevKitAPI.tar.gz" + sha256: "d692a59bdec7847ef4632e2c6741be064822a91eda2735dcff768985eaf4ec1e" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" + Windows: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/210519.v2021Release.3002.FULL.FIN.WIN64.DevKitAPI.zip" + sha256: "e7da392408f6150c58f3cba5d4f05118f1eaed4519fdb76895e13aed9ceede97" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" diff --git a/recipes/archicad-apidevkit/all/conanfile.py b/recipes/archicad-apidevkit/all/conanfile.py new file mode 100644 index 00000000000000..55e0ec99e9a6b8 --- /dev/null +++ b/recipes/archicad-apidevkit/all/conanfile.py @@ -0,0 +1,65 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.52.0" + + +class ArchicadApidevkitConan(ConanFile): + name = "archicad-apidevkit" + description = "The General API Development Kit enables software developers to extend the functionality of Archicad" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://archicadapi.graphisoft.com/" + license = "LicenseRef-LICENSE" + settings = "os", "compiler", "arch", "build_type" + no_copy_source = True + topics = "api", "archicad", "development" + short_paths = True + + def validate(self): + if self.settings.build_type == "Debug": + raise ConanInvalidConfiguration("Debug configuration is not supported") + if is_msvc(self): + # Approximate requirement for toolset >= v142 + check_min_vs(self, "192") + if not self.info.settings.os in ("Macos", "Windows"): + raise ConanInvalidConfiguration( + f"{self.ref} is not supported by the OS {self.info.settings.os}") + if not str(self.settings.arch) in ("x86_64"): + raise ConanInvalidConfiguration( + f"{self.ref} is not supported yet.") + if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "16": + raise ConanInvalidConfiguration( + "This recipe does not support this compiler version") + + def build(self): + devkit, licenses = self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)] + get(self, **devkit, destination=os.path.join(self.package_folder, "bin"), strip_root=True) + get(self, **licenses, destination=os.path.join(self.package_folder, "licenses"), strip_root=True) + + def package(self): + copy(self, "bin", src=self.build_folder, dst=self.package_folder) + copy(self, "licenses", src=self.build_folder, dst=self.package_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] + + # These are dependencies of third party vendored libraries + self.cpp_info.system_libs = [ + "WinMM", "MSImg32", "WS2_32", "USP10", "DNSApi"] + if self.settings.os == "Macos": + self.cpp_info.frameworks = ["CoreText", "CoreFoundation", "CoreServices", + "ApplicationServices", "Carbon", "CoreGraphics", "AppKit", "Foundation"] + else: + self.cpp_info.system_libs.extend(["gdiplus", "iphlpapi"]) + + devkit_dir = os.path.join(self.package_folder, "bin") + self.output.info(f"Setting AC_API_DEVKIT_DIR environment variable: {devkit_dir}") + self.env_info.AC_API_DEVKIT_DIR = devkit_dir + self.buildenv_info.define("AC_API_DEVKIT_DIR", devkit_dir) diff --git a/recipes/archicad-apidevkit/all/test_package/CMakeLists.txt b/recipes/archicad-apidevkit/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..7e25d3d3b7690b --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_package/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +function(SetCompilerOptions target ac_version) + if(ac_version GREATER "26") + target_compile_features("${target}" PUBLIC cxx_std_17) + else() + target_compile_features("${target}" PUBLIC cxx_std_14) + endif() +endfunction() + +set(AC_API_DEVKIT_DIR "$ENV{AC_API_DEVKIT_DIR}" CACHE PATH "API DevKit directory.") + +find_package(archicad-apidevkit REQUIRED CONFIG) + +add_executable(test_package test_gsroot.cpp) +SetCompilerOptions(test_package "${archicad-apidevkit_VERSION}") + +if(WIN32) + target_compile_definitions(test_package PRIVATE UNICODE _UNICODE) +else() + target_compile_definitions(test_package PRIVATE macintosh=1) +endif() + +target_include_directories(test_package SYSTEM PRIVATE "${AC_API_DEVKIT_DIR}/Modules/GSRoot") + +if(WIN32) + target_link_libraries( + test_package PRIVATE + "${AC_API_DEVKIT_DIR}/Modules/GSRoot/Win/GSRootImp.lib" + ) +else() + find_library( + GSROOT_FRAMEWORK GSRoot + PATHS "${AC_API_DEVKIT_DIR}/Frameworks" + ) + + if(NOT GSROOT_FRAMEWORK) + message(FATAL_ERROR "GSRoot not found: ${GSROOT_FRAMEWORK}") + endif() + + target_link_libraries(test_package PRIVATE "${GSROOT_FRAMEWORK}") +endif() diff --git a/recipes/archicad-apidevkit/all/test_package/conanfile.py b/recipes/archicad-apidevkit/all/test_package/conanfile.py new file mode 100644 index 00000000000000..f6d3c68ca3efba --- /dev/null +++ b/recipes/archicad-apidevkit/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", "VirtualBuildEnv" + 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/archicad-apidevkit/all/test_package/test_gsroot.cpp b/recipes/archicad-apidevkit/all/test_package/test_gsroot.cpp new file mode 100644 index 00000000000000..8712d2cd553d3e --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_package/test_gsroot.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main () +{ + Gfx::Color someColor; + someColor.SetRed (176); + + return someColor.GetRed () == 176 ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/archicad-apidevkit/all/test_v1_package/CMakeLists.txt b/recipes/archicad-apidevkit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..50f1488b009a22 --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS KEEP_RPATHS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/archicad-apidevkit/all/test_v1_package/conanfile.py b/recipes/archicad-apidevkit/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..af4b5cc85f42f0 --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake +from conan.errors import ConanInvalidConfiguration +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") + self.run(bin_path, run_environment=True) diff --git a/recipes/archicad-apidevkit/config.yml b/recipes/archicad-apidevkit/config.yml new file mode 100644 index 00000000000000..ca23918e2d0f42 --- /dev/null +++ b/recipes/archicad-apidevkit/config.yml @@ -0,0 +1,5 @@ +versions: + "25": + folder: all + "26": + folder: all diff --git a/recipes/arrow/all/conandata.yml b/recipes/arrow/all/conandata.yml index dd9d6a4aeec6c5..9d8117ed1a2a86 100644 --- a/recipes/arrow/all/conandata.yml +++ b/recipes/arrow/all/conandata.yml @@ -21,14 +21,11 @@ patches: "10.0.0": - patch_file: "patches/10.0.0-0001-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" - - patch_file: "patches/10.0.0-0002-fix-cmake.patch" - patch_description: "use cci package" patch_type: "conan" "8.0.1": - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/8.0.0-0005-install-utils.patch" patch_description: "enable utilis installation" patch_type: "conan" @@ -38,7 +35,7 @@ patches: "8.0.0": - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/8.0.0-0005-install-utils.patch" patch_description: "enable utilis installation" patch_type: "conan" @@ -48,7 +45,7 @@ patches: "7.0.0": - patch_file: "patches/7.0.0-0003-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/7.0.0-0006-install-utils.patch" patch_description: "enable utilis installation" patch_type: "conan" @@ -58,26 +55,26 @@ patches: "2.0.0": - patch_file: "patches/2.0.0-0003-fix-shared-msvc.patch" patch_description: "make shared enabled in msvc" - patch_type: "backport" + patch_type: "official" - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/2.0.0-0005-gandiva-engine.patch" patch_description: "fix grandiva compilation error" - patch_type: "backport" + patch_type: "official" - patch_file: "patches/2.0.0-0008-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" "1.0.0": - patch_file: "patches/1.0.0-0003-fix-shared-msvc.patch" patch_description: "make shared enabled in msvc" - patch_type: "backport" + patch_type: "official" - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" patch_description: "use size_t instead of ssize_t" - patch_type: "backport" + patch_type: "conan" - patch_file: "patches/1.0.0-0005-fix-make12-namespace.patch" patch_description: "fix ambiguous `make12` function between std and date" - patch_type: "backport" + patch_type: "official" - patch_file: "patches/1.0.0-0006-fix-cmake.patch" patch_description: "use cci package" patch_type: "conan" diff --git a/recipes/arrow/all/conanfile.py b/recipes/arrow/all/conanfile.py index 3985eb3a0a200e..28c550276568f1 100644 --- a/recipes/arrow/all/conanfile.py +++ b/recipes/arrow/all/conanfile.py @@ -392,6 +392,7 @@ def generate(self): if is_msvc(self): tc.variables["ARROW_USE_STATIC_CRT"] = is_msvc_static_runtime(self) tc.variables["ARROW_DEPENDENCY_SOURCE"] = "SYSTEM" + tc.variables["ARROW_PACKAGE_KIND"] = "conan" # See https://github.com/conan-io/conan-center-index/pull/14903/files#r1057938314 for details tc.variables["ARROW_GANDIVA"] = bool(self.options.gandiva) tc.variables["ARROW_PARQUET"] = self._parquet() tc.variables["ARROW_SUBSTRAIT"] = bool(self.options.get_safe("substrait", False)) @@ -410,6 +411,7 @@ def generate(self): tc.variables["ARROW_CSV"] = bool(self.options.with_csv) tc.variables["ARROW_CUDA"] = bool(self.options.with_cuda) tc.variables["ARROW_JEMALLOC"] = self._with_jemalloc() + tc.variables["jemalloc_SOURCE"] = "SYSTEM" tc.variables["ARROW_MIMALLOC"] = bool(self.options.with_mimalloc) tc.variables["ARROW_JSON"] = bool(self.options.with_json) tc.variables["google_cloud_cpp_SOURCE"] = "SYSTEM" @@ -498,7 +500,7 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - if Version(self.version) >= "7.0.0": + if "7.0.0" <= Version(self.version) < "10.0.0": for filename in glob.glob(os.path.join(self.source_folder, "cpp", "cmake_modules", "Find*.cmake")): if os.path.basename(filename) not in [ "FindArrow.cmake", diff --git a/recipes/arrow/all/patches/10.0.0-0002-fix-cmake.patch b/recipes/arrow/all/patches/10.0.0-0002-fix-cmake.patch deleted file mode 100644 index 62ee1a4570d306..00000000000000 --- a/recipes/arrow/all/patches/10.0.0-0002-fix-cmake.patch +++ /dev/null @@ -1,311 +0,0 @@ -diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt -index 029f13f..3518a23 100644 ---- a/cpp/CMakeLists.txt -+++ b/cpp/CMakeLists.txt -@@ -659,7 +659,7 @@ endif() - - if(ARROW_WITH_BROTLI) - # Order is important for static linking -- set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon) -+ set(ARROW_BROTLI_LIBS brotli::brotlienc brotli::brotlidec brotli::brotlicommon) - list(APPEND ARROW_SHARED_LINK_LIBS ${ARROW_BROTLI_LIBS}) - list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) - if(Brotli_SOURCE STREQUAL "SYSTEM") -@@ -675,14 +675,21 @@ if(ARROW_WITH_BZ2) - endif() - - if(ARROW_WITH_LZ4) -- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) -+if (TARGET LZ4::lz4_static) -+ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_static) - if(lz4_SOURCE STREQUAL "SYSTEM") -- list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) -+ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4_static) - endif() -+else() -+ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_shared) -+ if(lz4_SOURCE STREQUAL "SYSTEM") -+ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4_shared) -+ endif() -+endif() - endif() - - if(ARROW_WITH_SNAPPY) -- list(APPEND ARROW_STATIC_LINK_LIBS ${Snappy_TARGET}) -+ list(APPEND ARROW_STATIC_LINK_LIBS Snappy::snappy) - if(Snappy_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${Snappy_TARGET}) - endif() -diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake -index b7cd31f..78f3df3 100644 ---- a/cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1162,10 +1162,12 @@ endmacro() - - if(ARROW_WITH_SNAPPY) - resolve_dependency(Snappy -- HAVE_ALT -+ USE_CONFIG - TRUE - PC_PACKAGE_NAMES - snappy) -+ -+ if(0) - if(${Snappy_SOURCE} STREQUAL "SYSTEM" AND NOT snappy_PC_FOUND) - get_target_property(SNAPPY_TYPE ${Snappy_TARGET} TYPE) - if(NOT SNAPPY_TYPE STREQUAL "INTERFACE_LIBRARY") -@@ -1180,6 +1182,9 @@ if(ARROW_WITH_SNAPPY) - string(APPEND ARROW_PC_LIBS_PRIVATE " ${SNAPPY_LIB}") - endif() - endif() -+ else() -+ string(APPEND ARROW_PC_LIBS_PRIVATE " ${Snappy_LIBRARIES}") -+ endif() - endif() - - # ---------------------------------------------------------------------- -@@ -1242,7 +1247,7 @@ macro(build_brotli) - endmacro() - - if(ARROW_WITH_BROTLI) -- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) -+ resolve_dependency(brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) - endif() - - if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) -@@ -1256,7 +1261,7 @@ if(PARQUET_REQUIRE_ENCRYPTION - OR ARROW_GANDIVA) - set(OpenSSL_SOURCE "SYSTEM") - resolve_dependency(OpenSSL -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_OPENSSL_REQUIRED_VERSION}) -@@ -1399,22 +1404,14 @@ endmacro() - if(ARROW_NEED_GFLAGS) - set(ARROW_GFLAGS_REQUIRED_VERSION "2.1.0") - resolve_dependency(gflags -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_GFLAGS_REQUIRED_VERSION} - IS_RUNTIME_DEPENDENCY - FALSE) - -- if(NOT TARGET ${GFLAGS_LIBRARIES}) -- if(TARGET gflags::gflags_shared) -- set(GFLAGS_LIBRARIES gflags::gflags_shared) -- elseif(TARGET gflags-shared) -- set(GFLAGS_LIBRARIES gflags-shared) -- elseif(TARGET gflags_shared) -- set(GFLAGS_LIBRARIES gflags_shared) -- endif() -- endif() -+ set(GFLAGS_LIBRARIES gflags::gflags) - endif() - - # ---------------------------------------------------------------------- -@@ -1638,7 +1635,7 @@ if(ARROW_WITH_PROTOBUF) - set(ARROW_PROTOBUF_REQUIRED_VERSION "2.6.1") - endif() - resolve_dependency(Protobuf -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_PROTOBUF_REQUIRED_VERSION} -@@ -1770,7 +1767,7 @@ macro(build_substrait) - - add_custom_target(substrait_gen ALL DEPENDS ${SUBSTRAIT_PROTO_GEN_ALL}) - -- set(SUBSTRAIT_INCLUDES ${SUBSTRAIT_CPP_DIR} ${PROTOBUF_INCLUDE_DIR}) -+ set(SUBSTRAIT_INCLUDES ${SUBSTRAIT_CPP_DIR} ${protobuf_INCLUDE_DIR}) - - add_library(substrait STATIC ${SUBSTRAIT_SOURCES}) - set_target_properties(substrait PROPERTIES POSITION_INDEPENDENT_CODE ON) -@@ -1781,6 +1778,8 @@ macro(build_substrait) - list(APPEND ARROW_BUNDLED_STATIC_LIBS substrait) - endmacro() - -+set(CMAKE_VERBOSE_MAKEFILE ON) -+ - if(ARROW_SUBSTRAIT) - # Currently, we can only build Substrait from source. - set(Substrait_SOURCE "BUNDLED") -@@ -1866,7 +1865,10 @@ macro(build_jemalloc) - endmacro() - - if(ARROW_JEMALLOC) -- resolve_dependency(jemalloc) -+ #resolve_dependency(jemalloc) -+ find_package(jemalloc REQUIRED CONFIG) -+ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") -+ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS}) - endif() - - # ---------------------------------------------------------------------- -@@ -2186,7 +2188,7 @@ endmacro() - if(ARROW_WITH_RAPIDJSON) - set(ARROW_RAPIDJSON_REQUIRED_VERSION "1.1.0") - resolve_dependency(RapidJSON -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_RAPIDJSON_REQUIRED_VERSION} -@@ -2334,19 +2336,29 @@ macro(build_lz4) - BUILD_BYPRODUCTS ${LZ4_STATIC_LIB}) - - file(MAKE_DIRECTORY "${LZ4_PREFIX}/include") -- add_library(LZ4::lz4 STATIC IMPORTED) -- set_target_properties(LZ4::lz4 -- PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}" -- INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") -- add_dependencies(toolchain lz4_ep) -- add_dependencies(LZ4::lz4 lz4_ep) -- -- list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4) -+ if (TARGET LZ4::lz4_static) -+ add_library(LZ4::lz4_static STATIC IMPORTED) -+ set_target_properties(LZ4::lz4_static -+ PROPERTIES IMPORTED_LOCATION "${LZ4_STATIC_LIB}" -+ INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") -+ add_dependencies(toolchain lz4_ep) -+ add_dependencies(LZ4::lz4_static lz4_ep) -+ list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4_static) -+ else() -+ add_library(LZ4::lz4_shared STATIC IMPORTED) -+ set_target_properties(LZ4::lz4_shared -+ PROPERTIES IMPORTED_LOCATION "${LZ4_SHARED_LIB}" -+ INTERFACE_INCLUDE_DIRECTORIES "${LZ4_PREFIX}/include") -+ add_dependencies(toolchain lz4_ep) -+ add_dependencies(LZ4::lz4_shared lz4_ep) -+ list(APPEND ARROW_BUNDLED_STATIC_LIBS LZ4::lz4_shared) -+ endif() -+ - endmacro() - - if(ARROW_WITH_LZ4) - resolve_dependency(lz4 -- HAVE_ALT -+ USE_CONFIG - TRUE - PC_PACKAGE_NAMES - liblz4) -@@ -2415,7 +2427,7 @@ endmacro() - if(ARROW_WITH_ZSTD) - # ARROW-13384: ZSTD_minCLevel was added in v1.4.0, required by ARROW-13091 - resolve_dependency(zstd -- HAVE_ALT -+ USE_CONFIG - TRUE - PC_PACKAGE_NAMES - libzstd -@@ -2477,7 +2489,7 @@ if(ARROW_WITH_RE2) - # Don't specify "PC_PACKAGE_NAMES re2" here because re2.pc may - # include -std=c++11. It's not compatible with C source and C++ - # source not uses C++ 11. -- resolve_dependency(re2 HAVE_ALT TRUE) -+ resolve_dependency(re2 USE_CONFIG TRUE) - if(${re2_SOURCE} STREQUAL "SYSTEM") - get_target_property(RE2_TYPE re2::re2 TYPE) - if(NOT RE2_TYPE STREQUAL "INTERFACE_LIBRARY") -@@ -3922,7 +3934,7 @@ if(ARROW_WITH_GRPC) - set(gRPC_SOURCE "${Protobuf_SOURCE}") - endif() - resolve_dependency(gRPC -- HAVE_ALT -+ USE_CONFIG - TRUE - REQUIRED_VERSION - ${ARROW_GRPC_REQUIRED_VERSION} -@@ -3939,9 +3951,9 @@ if(ARROW_WITH_GRPC) - get_target_property(GRPC_INCLUDE_DIR gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES) - if(GRPC_INCLUDE_DIR MATCHES "^\\$<" - OR # generator expression -- EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") -+ EXISTS ${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h) - set(GRPCPP_PP_INCLUDE TRUE) -- elseif(EXISTS "${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h") -+ elseif(EXISTS ${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h) - set(GRPCPP_PP_INCLUDE FALSE) - else() - message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") -@@ -4282,8 +4294,11 @@ macro(build_orc) - get_target_property(ORC_SNAPPY_INCLUDE_DIR ${Snappy_TARGET} - INTERFACE_INCLUDE_DIRECTORIES) - get_filename_component(ORC_SNAPPY_ROOT "${ORC_SNAPPY_INCLUDE_DIR}" DIRECTORY) -- -- get_target_property(ORC_LZ4_ROOT LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) -+ if (TARGET LZ4::lz4_static) -+ get_target_property(ORC_LZ4_ROOT LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) -+ else() -+ get_target_property(ORC_LZ4_ROOT LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) -+ endif() - get_filename_component(ORC_LZ4_ROOT "${ORC_LZ4_ROOT}" DIRECTORY) - - get_target_property(ORC_ZSTD_ROOT ${ARROW_ZSTD_LIBZSTD} INTERFACE_INCLUDE_DIRECTORIES) -@@ -4321,16 +4336,29 @@ macro(build_orc) - # Work around CMake bug - file(MAKE_DIRECTORY ${ORC_INCLUDE_DIR}) - -- externalproject_add(orc_ep -- URL ${ORC_SOURCE_URL} -- URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}" -- BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -- CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS} -- DEPENDS ${ARROW_PROTOBUF_LIBPROTOBUF} -- ${ARROW_ZSTD_LIBZSTD} -- ${Snappy_TARGET} -- LZ4::lz4 -- ZLIB::ZLIB) -+ if (TARGET LZ4::lz4_static) -+ externalproject_add(orc_ep -+ URL ${ORC_SOURCE_URL} -+ URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}" -+ BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -+ CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS} -+ DEPENDS ${ARROW_PROTOBUF_LIBPROTOBUF} -+ ${ARROW_ZSTD_LIBZSTD} -+ ${Snappy_TARGET} -+ LZ4::lz4_static -+ ZLIB::ZLIB) -+ else() -+ externalproject_add(orc_ep -+ URL ${ORC_SOURCE_URL} -+ URL_HASH "SHA256=${ARROW_ORC_BUILD_SHA256_CHECKSUM}" -+ BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -+ CMAKE_ARGS ${ORC_CMAKE_ARGS} ${EP_LOG_OPTIONS} -+ DEPENDS ${ARROW_PROTOBUF_LIBPROTOBUF} -+ ${ARROW_ZSTD_LIBZSTD} -+ ${Snappy_TARGET} -+ LZ4::lz4_shared -+ ZLIB::ZLIB) -+ endif() - - set(ORC_VENDORED 1) - -@@ -4338,7 +4366,11 @@ macro(build_orc) - set_target_properties(orc::liborc - PROPERTIES IMPORTED_LOCATION "${ORC_STATIC_LIB}" - INTERFACE_INCLUDE_DIRECTORIES "${ORC_INCLUDE_DIR}") -- set(ORC_LINK_LIBRARIES LZ4::lz4 ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET}) -+ if (TARGET LZ4::lz4_static) -+ set(ORC_LINK_LIBRARIES LZ4::lz4_static ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET}) -+ else() -+ set(ORC_LINK_LIBRARIES LZ4::lz4_shared ZLIB::ZLIB ${ARROW_ZSTD_LIBZSTD} ${Snappy_TARGET}) -+ endif() - if(NOT MSVC) - if(NOT APPLE) - list(APPEND ORC_LINK_LIBRARIES Threads::Threads) -@@ -4765,7 +4797,7 @@ macro(build_awssdk) - endmacro() - - if(ARROW_S3) -- resolve_dependency(AWSSDK HAVE_ALT TRUE) -+ resolve_dependency(AWSSDK USE_CONFIG TRUE) - - message(STATUS "Found AWS SDK headers: ${AWSSDK_INCLUDE_DIR}") - message(STATUS "Found AWS SDK libraries: ${AWSSDK_LINK_LIBRARIES}") diff --git a/recipes/arsenalgear/all/conanfile.py b/recipes/arsenalgear/all/conanfile.py index 5a83b05e8d8a5d..98dcd780da86b7 100644 --- a/recipes/arsenalgear/all/conanfile.py +++ b/recipes/arsenalgear/all/conanfile.py @@ -8,7 +8,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class ArsenalgearConan(ConanFile): name = "arsenalgear" @@ -35,6 +35,7 @@ def _minimum_cpp_standard(self): def _compilers_minimum_version(self): return { "Visual Studio": "16", + "msvc": "192", "gcc": "8", "clang": "7", "apple-clang": "12.0", @@ -49,17 +50,14 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): if Version(self.version) < "2.0.0": - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") if self.settings.os in ["Linux", "Macos"]: self.requires("exprtk/0.0.1") diff --git a/recipes/arsenalgear/all/test_package/CMakeLists.txt b/recipes/arsenalgear/all/test_package/CMakeLists.txt index e3d45800d41b03..3ff34ca7821231 100644 --- a/recipes/arsenalgear/all/test_package/CMakeLists.txt +++ b/recipes/arsenalgear/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(arsenalgear REQUIRED CONFIG) diff --git a/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt index 2340ca5c12b920..bc541ea90b5128 100644 --- a/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt +++ b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(arsenalgear REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE arsenalgear::arsenalgear) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/asio-grpc/all/conandata.yml b/recipes/asio-grpc/all/conandata.yml index d44cb9f84670e8..67c8b715cb2d32 100644 --- a/recipes/asio-grpc/all/conandata.yml +++ b/recipes/asio-grpc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.4.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.4.0.tar.gz" + sha256: "d71de4f8de91dc0ad44d6a161fc628496b80622a6f9030dcd4c53b516629b8b7" "2.3.0": url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.3.0.tar.gz" sha256: "eb48e72c98d45d9251fe1cbdca3a72a4d67435a7020357cd33ff717cc5851c01" diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index d5f2c6fe82df8f..3bb69661037449 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -20,11 +20,11 @@ class AsioGrpcConan(ConanFile): no_copy_source = True options = { "backend": ["boost", "asio", "unifex"], - "use_boost_container": ["auto", True, False], + "local_allocator": ["auto", "memory_resource", "boost_container", "recycling_allocator"], } default_options = { "backend": "boost", - "use_boost_container": "auto", + "local_allocator": "auto", } @property @@ -51,17 +51,21 @@ def validate(self): self.output.warn(f"{self.name} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") def configure(self): - if self.options.use_boost_container == "auto": + self._local_allocator_option = self.options.local_allocator + if self._local_allocator_option == "auto": libcxx = self.settings.compiler.get_safe("libcxx") compiler_version = Version(self.settings.compiler.version) - self.options.use_boost_container = libcxx and str(libcxx) == "libc++" or \ + prefer_boost_container = libcxx and str(libcxx) == "libc++" or \ (self.settings.compiler == "gcc" and compiler_version < "9") or \ (self.settings.compiler == "clang" and compiler_version < "12" and libcxx and str(libcxx) == "libstdc++") + self._local_allocator_option = "boost_container" if prefer_boost_container else "memory_resource" + if self._local_allocator_option == "recycling_allocator" and self.options.backend == "unifex": + raise ConanInvalidConfiguration(f"{self.name} 'recycling_allocator' cannot be used in combination with the 'unifex' backend.") def requirements(self): - self.requires("grpc/1.50.0") - if self.options.use_boost_container or self.options.backend == "boost": - self.requires("boost/1.80.0") + self.requires("grpc/1.50.1") + if self._local_allocator_option == "boost_container" or self.options.backend == "boost": + self.requires("boost/1.81.0") if self.options.backend == "asio": self.requires("asio/1.24.0") if self.options.backend == "unifex": @@ -69,7 +73,7 @@ def requirements(self): def package_id(self): self.info.clear() - self.info.options.use_boost_container = self.options.use_boost_container + self.info.options.local_allocator = self._local_allocator_option def layout(self): cmake_layout(self, src_folder="src") @@ -79,7 +83,8 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self.options.use_boost_container + tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self._local_allocator_option == "boost_container" + tc.variables["ASIO_GRPC_USE_RECYCLING_ALLOCATOR"] = self._local_allocator_option == "recycling_allocator" tc.generate() def build(self): @@ -106,7 +111,7 @@ def package_info(self): self.cpp_info.defines = ["AGRPC_UNIFEX"] self.cpp_info.requires.append("libunifex::unifex") - if self.options.use_boost_container: + if self._local_allocator_option == "boost_container": self.cpp_info.requires.append("boost::container") self.cpp_info.set_property("cmake_file_name", "asio-grpc") diff --git a/recipes/asio-grpc/config.yml b/recipes/asio-grpc/config.yml index 9c1d4210486926..25e51279385fd9 100644 --- a/recipes/asio-grpc/config.yml +++ b/recipes/asio-grpc/config.yml @@ -1,4 +1,6 @@ versions: + "2.4.0": + folder: all "2.3.0": folder: all "2.2.0": diff --git a/recipes/at-spi2-core/config.yml b/recipes/at-spi2-core/config.yml index 75bf09030a3113..21111516a85854 100644 --- a/recipes/at-spi2-core/config.yml +++ b/recipes/at-spi2-core/config.yml @@ -17,3 +17,5 @@ versions: folder: new "2.46.0": folder: new + "2.47.1": + folder: new diff --git a/recipes/at-spi2-core/new/conandata.yml b/recipes/at-spi2-core/new/conandata.yml index 4ea30e6fd2d794..0404ff9bea312f 100644 --- a/recipes/at-spi2-core/new/conandata.yml +++ b/recipes/at-spi2-core/new/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.47.1": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.47/at-spi2-core-2.47.1.tar.xz" + sha256: "c6ba7c160434edebf09d2936933569c936f6ec972301766f2bdac5a4d418153c" "2.46.0": url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.46/at-spi2-core-2.46.0.tar.xz" sha256: "aa0c86c79f7a8d67bae49a5b7a5ab08430c608cffe6e33bf47a72f41ab03c3d0" @@ -9,12 +12,11 @@ sources: sha256: "ba95f346e93108fbb3462c62437081d582154db279b4052dedc52a706828b192" url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.45/at-spi2-core-2.45.1.tar.xz" patches: + "2.47.1": + - patch_file: "patches/93.patch" "2.46.0": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" + - patch_file: "patches/93.patch" "2.45.90": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" + - patch_file: "patches/93.patch" "2.45.1": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" + - patch_file: "patches/93.patch" diff --git a/recipes/at-spi2-core/new/conanfile.py b/recipes/at-spi2-core/new/conanfile.py index 389943e02b0015..d40f68c8b3da50 100644 --- a/recipes/at-spi2-core/new/conanfile.py +++ b/recipes/at-spi2-core/new/conanfile.py @@ -1,8 +1,15 @@ -from conans import ConanFile, Meson, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +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.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version import os +required_conan_version = ">=1.53.0" class AtSpi2CoreConan(ConanFile): name = "at-spi2-core" description = "It provides a Service Provider Interface for the Assistive Technologies available on the GNOME platform and a library against which applications can be linked" @@ -10,7 +17,6 @@ class AtSpi2CoreConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.gnome.org/GNOME/at-spi2-core/" license = "LGPL-2.1-or-later" - generators = "pkg_config" provides = "at-spi2-atk", "atk" @@ -26,37 +32,27 @@ class AtSpi2CoreConan(ConanFile): "with_x11": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - _meson = None - 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") if self.options.shared: self.options["glib"].shared = True def build_requirements(self): - self.build_requires("meson/0.62.2") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def requirements(self): - self.requires("glib/2.73.0") + self.requires("glib/2.75.2") if self.options.with_x11: self.requires("xorg/system") - self.requires("dbus/1.12.20") + self.requires("dbus/1.15.2") def validate(self): if self.options.shared and not self.options["glib"].shared: @@ -66,63 +62,67 @@ def validate(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("only linux is supported by this recipe") + def layout(self): + basic_layout(self, src_folder="src") + self.cpp.package.resdirs = ["res"] + def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _configure_meson(self): - if self._meson: - return self._meson - self._meson = Meson(self) - defs = {} - defs["introspection"] = "no" - defs["docs"] = "false" - defs["x11"] = "yes" if self.options.with_x11 else "no" - args=[] - args.append("--datadir=%s" % os.path.join(self.package_folder, "res")) - args.append("--localedir=%s" % os.path.join(self.package_folder, "res")) - args.append("--wrap-mode=nofallback") - self._meson.configure(defs=defs, build_folder=self._build_subfolder, source_folder=self._source_subfolder, pkg_config_paths=".", args=args) - return self._meson + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = MesonToolchain(self) + if Version(self.version) >= "2.47.1": + tc.project_options["introspection"] = "disabled" + tc.project_options["x11"] = "enabled" if self.options.with_x11 else "disabled" + else: + tc.project_options["introspection"] = "no" + tc.project_options["x11"] = "yes" if self.options.with_x11 else "no" + tc.project_options["docs"] = "false" + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() 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, "bus", "meson.build"), + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "bus", "meson.build"), "if x11_dep.found()", - "if x11_option == 'yes'") - tools.replace_in_file(os.path.join(self._source_subfolder, 'meson.build'), + "if get_option('x11').enabled()" if Version(self.version) >= "2.47.1" + else "if x11_option == 'yes'") + replace_in_file(self, os.path.join(self.source_folder, 'meson.build'), "subdir('tests')", "#subdir('tests')") - tools.replace_in_file(os.path.join(self._source_subfolder, 'meson.build'), + replace_in_file(self, os.path.join(self.source_folder, 'meson.build'), "libxml_dep = dependency('libxml-2.0', version: libxml_req_version)", "#libxml_dep = dependency('libxml-2.0', version: libxml_req_version)") - 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, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "etc")) def package_info(self): self.cpp_info.components["atspi"].libs = ['atspi'] self.cpp_info.components["atspi"].includedirs = ["include/at-spi-2.0"] self.cpp_info.components["atspi"].requires = ["dbus::dbus", "glib::glib"] - self.cpp_info.components["atspi"].names["pkg_config"] = "atspi-2" - + self.cpp_info.components["atspi"].set_property("pkg_config_name", "atspi-2") + self.cpp_info.components["atk"].libs = ["atk-1.0"] self.cpp_info.components["atk"].includedirs = ['include/atk-1.0'] self.cpp_info.components["atk"].requires = ["glib::glib"] - self.cpp_info.components["atk"].names['pkg_config'] = 'atk' + self.cpp_info.components["atk"].set_property("pkg_config_name", 'atk') self.cpp_info.components["atk-bridge"].libs = ['atk-bridge-2.0'] self.cpp_info.components["atk-bridge"].includedirs = [os.path.join('include', 'at-spi2-atk', '2.0')] self.cpp_info.components["atk-bridge"].requires = ["dbus::dbus", "atk", "glib::glib", "atspi"] - self.cpp_info.components["atk-bridge"].names['pkg_config'] = 'atk-bridge-2.0' + self.cpp_info.components["atk-bridge"].set_property("pkg_config_name", 'atk-bridge-2.0') def package_id(self): self.info.requires["glib"].full_package_mode() diff --git a/recipes/autoconf/all/conandata.yml b/recipes/autoconf/all/conandata.yml index 97adbd2afcde00..aefee4cae61324 100644 --- a/recipes/autoconf/all/conandata.yml +++ b/recipes/autoconf/all/conandata.yml @@ -2,19 +2,14 @@ sources: "2.71": sha256: "431075ad0bf529ef13cb41e9042c542381103e80015686222b8a9d4abef42a1c" url: "https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz" - "2.69": - sha256: "954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969" - url: "https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz" patches: "2.71": - - patch_file: "patches/2.71-0001-autom4te-relocatable.patch" + - patch_file: "patches/2.71-0001-relocatable-autoconf.patch" + patch_description: "Replace instances where absolute paths are embedded the generated files" + patch_type: "conan" - patch_file: "patches/2.71-0002-no-perl-path-in-shebang.patch" - - patch_file: "patches/2.71-0003-uppercase-autom4te_perllibdir.patch" - - patch_file: "patches/2.71-0004-no-embedded-m4-paths.patch" - - patch_file: "patches/2.71-0005-disable-man-regeneration.patch" - - patch_file: "patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch" - "2.69": - - patch_file: "patches/2.69-0001-autom4te-relocatable.patch" - - patch_file: "patches/2.69-0002-no-perl-path-in-shebang.patch" - - patch_file: "patches/2.69-0003-uppercase-autom4te_perllibdir.patch" - - patch_file: "patches/2.69-0004-no-embedded-m4-paths.patch" + patch_description: "Avoid build machine's perl path to be embedded the generated files" + patch_type: "conan" + - patch_file: "patches/2.71-0003-disable-man-regeneration.patch" + patch_description: "Disable man regeneration" + patch_type: "conan" diff --git a/recipes/autoconf/all/conanfile.py b/recipes/autoconf/all/conanfile.py index ceb06b4b4a4be2..36d4253e0bd5d8 100644 --- a/recipes/autoconf/all/conanfile.py +++ b/recipes/autoconf/all/conanfile.py @@ -4,10 +4,9 @@ from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.microsoft import unix_path, is_msvc -from conans import tools as tools_legacy import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class AutoconfConan(ConanFile): @@ -89,8 +88,7 @@ def build(self): def package(self): autotools = Autotools(self) - # TODO: can be replaced by autotools.install() if required_conan_version = ">=1.54.0" - autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + autotools.install() copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) rmdir(self, os.path.join(self.package_folder, "res", "info")) @@ -101,38 +99,37 @@ def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.resdirs = ["res"] - # TODO: use legacy unix_path for the moment (see https://github.com/conan-io/conan/issues/12499) + # TODO: These variables can be removed since the scripts now locate the resources + # relative to themselves. - dataroot_path = tools_legacy.unix_path(os.path.join(self.package_folder, "res", "autoconf")) + dataroot_path = os.path.join(self.package_folder, "res", "autoconf") self.output.info(f"Defining AC_MACRODIR environment variable: {dataroot_path}") self.buildenv_info.define_path("AC_MACRODIR", dataroot_path) - self.output.info(f"Defining AUTOM4TE_PERLLIBDIR environment variable: {dataroot_path}") - self.buildenv_info.define_path("AUTOM4TE_PERLLIBDIR", dataroot_path) + self.output.info(f"Defining autom4te_perllibdir environment variable: {dataroot_path}") + self.buildenv_info.define_path("autom4te_perllibdir", dataroot_path) bin_path = os.path.join(self.package_folder, "bin") - autoconf_bin = tools_legacy.unix_path(os.path.join(bin_path, "autoconf")) + autoconf_bin = os.path.join(bin_path, "autoconf") self.output.info(f"Defining AUTOCONF environment variable: {autoconf_bin}") self.buildenv_info.define_path("AUTOCONF", autoconf_bin) - autoreconf_bin = tools_legacy.unix_path(os.path.join(bin_path, "autoreconf")) + autoreconf_bin = os.path.join(bin_path, "autoreconf") self.output.info(f"Defining AUTORECONF environment variable: {autoreconf_bin}") self.buildenv_info.define_path("AUTORECONF", autoreconf_bin) - autoheader_bin = tools_legacy.unix_path(os.path.join(bin_path, "autoheader")) + autoheader_bin = os.path.join(bin_path, "autoheader") self.output.info(f"Defining AUTOHEADER environment variable: {autoheader_bin}") self.buildenv_info.define_path("AUTOHEADER", autoheader_bin) - autom4te_bin = tools_legacy.unix_path(os.path.join(bin_path, "autom4te")) + autom4te_bin = os.path.join(bin_path, "autom4te") self.output.info(f"Defining AUTOM4TE environment variable: {autom4te_bin}") self.buildenv_info.define_path("AUTOM4TE", autom4te_bin) # TODO: to remove in conan v2 self.env_info.PATH.append(bin_path) - self.env_info.AC_MACRODIR = dataroot_path - self.env_info.AUTOM4TE_PERLLIBDIR = dataroot_path - self.env_info.AUTOCONF = autoconf_bin - self.env_info.AUTORECONF = autoreconf_bin - self.env_info.AUTOHEADER = autoheader_bin - self.env_info.AUTOM4TE = autom4te_bin + self.env_info.AUTOCONF = "autoconf" + self.env_info.AUTORECONF = "autoreconf" + self.env_info.AUTOHEADER = "autoheader" + self.env_info.AUTOM4TE = "autom4te" diff --git a/recipes/autoconf/all/patches/2.69-0001-autom4te-relocatable.patch b/recipes/autoconf/all/patches/2.69-0001-autom4te-relocatable.patch deleted file mode 100644 index 7c7e3724d37e68..00000000000000 --- a/recipes/autoconf/all/patches/2.69-0001-autom4te-relocatable.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -268,6 +268,13 @@ - if /^\s*(\#.*)?$/; - - my @words = shellwords ($_); -+ # not using: s#AUTOCONF_M4DIR#$pkgdatadir#r to support perl <5.14 -+ my @words_clone = @words; -+ @words = (); -+ foreach ( @words_clone ) { -+ push(@words, do { (my $tmp = $_) =~ s#AUTOCONF_M4DIR#$pkgdatadir#; $tmp }); -+ } -+ - my $type = shift @words; - if ($type eq 'begin-language:') - { ---- lib/autom4te.in -+++ lib/autom4te.in -@@ -106,7 +106,7 @@ - # This intermediate language is used by aclocal to build aclocal.m4. - - begin-language: "Autoconf-without-aclocal-m4" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: --cache=autom4te.cache - args: autoconf/autoconf.m4f - args: acsite.m4? -@@ -133,7 +133,7 @@ - ## -------- ## - - begin-language: "Autotest" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: autotest/autotest.m4f - args: package.m4? - args: local.at? -@@ -147,7 +147,7 @@ - ## ---- ## - - begin-language: "M4sh" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sh.m4f - args: --mode 777 - args: --language M4sugar -@@ -159,7 +159,7 @@ - ## ------- ## - - begin-language: "M4sugar" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sugar.m4f - args: --warnings syntax - end-language: "M4sugar" diff --git a/recipes/autoconf/all/patches/2.69-0002-no-perl-path-in-shebang.patch b/recipes/autoconf/all/patches/2.69-0002-no-perl-path-in-shebang.patch deleted file mode 100644 index 1ff7ad736c9449..00000000000000 --- a/recipes/autoconf/all/patches/2.69-0002-no-perl-path-in-shebang.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- bin/autoheader.in -+++ bin/autoheader.in -@@ -1,4 +1,4 @@ --#! @PERL@ -+#! /usr/bin/env perl - # -*- Perl -*- - # @configure_input@ - ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/autoreconf.in -+++ bin/autoreconf.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/autoscan.in -+++ bin/autoscan.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/ifnames.in -+++ bin/ifnames.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - diff --git a/recipes/autoconf/all/patches/2.69-0003-uppercase-autom4te_perllibdir.patch b/recipes/autoconf/all/patches/2.69-0003-uppercase-autom4te_perllibdir.patch deleted file mode 100644 index 89895c153b4b92..00000000000000 --- a/recipes/autoconf/all/patches/2.69-0003-uppercase-autom4te_perllibdir.patch +++ /dev/null @@ -1,156 +0,0 @@ ---- bin/autoheader.in -+++ bin/autoheader.in -@@ -28,7 +28,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, "$pkgdatadir"; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -24,7 +24,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoreconf.in -+++ bin/autoreconf.in -@@ -26,7 +26,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoscan.in -+++ bin/autoscan.in -@@ -25,7 +25,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -26,7 +26,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/ifnames.in -+++ bin/ifnames.in -@@ -31,7 +31,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/Makefile.in -+++ bin/Makefile.in -@@ -213,7 +213,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/autoconf/Makefile.in -+++ lib/autoconf/Makefile.in -@@ -229,7 +229,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/autoscan/Makefile.in -+++ lib/autoscan/Makefile.in -@@ -215,7 +215,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/autotest/Makefile.in -+++ lib/autotest/Makefile.in -@@ -222,7 +222,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/freeze.mk -+++ lib/freeze.mk -@@ -31,7 +31,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/m4sugar/Makefile.in -+++ lib/m4sugar/Makefile.in -@@ -227,7 +227,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- tests/Makefile.in 2020-01-29 19:10:51.544709041 +0100 -+++ tests/Makefile.in 2020-01-29 19:10:37.143656386 +0100 -@@ -200,7 +200,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- tests/wrapper.as 2020-01-29 19:10:54.928721413 +0100 -+++ tests/wrapper.as 2020-01-29 19:10:37.143656386 +0100 -@@ -23,8 +23,8 @@ - AUTOHEADER=autoheader - AUTOM4TE=autom4te - AUTOM4TE_CFG='@abs_top_builddir@/lib/autom4te.cfg' --autom4te_perllibdir='@abs_top_srcdir@/lib' --export AUTOCONF AUTOHEADER AUTOM4TE AUTOM4TE_CFG autom4te_perllibdir -+AUTOM4TE_PERLLIBDIR='@abs_top_srcdir@/lib' -+export AUTOCONF AUTOHEADER AUTOM4TE AUTOM4TE_CFG AUTOM4TE_PERLLIBDIR - - case '@wrap_program@' in - ifnames) diff --git a/recipes/autoconf/all/patches/2.69-0004-no-embedded-m4-paths.patch b/recipes/autoconf/all/patches/2.69-0004-no-embedded-m4-paths.patch deleted file mode 100644 index 7b9c4d0bb1d329..00000000000000 --- a/recipes/autoconf/all/patches/2.69-0004-no-embedded-m4-paths.patch +++ /dev/null @@ -1,154 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -87,7 +87,7 @@ - my $freeze = 0; - - # $M4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - # Some non-GNU m4's don't reject the --help option, so give them /dev/null. - fatal "need GNU m4 1.4 or later: $m4" - if system "$m4 --help &1 | grep reload-state >/dev/null"; ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -53,7 +53,7 @@ - my @include = ('@pkgdatadir@'); - my $force = 0; - # m4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - - - # $HELP ---- bin/Makefile.in -+++ bin/Makefile.in -@@ -133,7 +133,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- doc/Makefile.in -+++ doc/Makefile.in -@@ -125,7 +125,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/autoconf/Makefile.in -+++ lib/autoconf/Makefile.in -@@ -135,7 +135,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/Autom4te/Makefile.in -+++ lib/Autom4te/Makefile.in -@@ -114,7 +114,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/autoscan/Makefile.in -+++ lib/autoscan/Makefile.in -@@ -131,7 +131,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/autotest/Makefile.in -+++ lib/autotest/Makefile.in -@@ -134,7 +134,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/emacs/Makefile.in -+++ lib/emacs/Makefile.in -@@ -104,7 +104,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/m4sugar/Makefile.in -+++ lib/m4sugar/Makefile.in -@@ -134,7 +134,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/Makefile.in -+++ lib/Makefile.in -@@ -153,7 +153,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- Makefile.in -+++ Makefile.in -@@ -169,7 +169,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- man/Makefile.in -+++ man/Makefile.in -@@ -115,7 +115,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- tests/Makefile.in -+++ tests/Makefile.in -@@ -107,7 +107,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ diff --git a/recipes/autoconf/all/patches/2.71-0001-autom4te-relocatable.patch b/recipes/autoconf/all/patches/2.71-0001-autom4te-relocatable.patch deleted file mode 100644 index 2fc1a3d51a5f7c..00000000000000 --- a/recipes/autoconf/all/patches/2.71-0001-autom4te-relocatable.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -271,6 +271,13 @@ - if /^\s*(\#.*)?$/; - - my @words = shellwords ($_); -+ # not using: s#AUTOCONF_M4DIR#$pkgdatadir#r to support perl <5.14 -+ my @words_clone = @words; -+ @words = (); -+ foreach ( @words_clone ) { -+ push(@words, do { (my $tmp = $_) =~ s#AUTOCONF_M4DIR#$pkgdatadir#; $tmp }); -+ } -+ - my $type = shift @words; - if ($type eq 'begin-language:') - { ---- lib/autom4te.in -+++ lib/autom4te.in -@@ -115,7 +115,7 @@ - # This intermediate language is used by aclocal to build aclocal.m4. - - begin-language: "Autoconf-without-aclocal-m4" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: --cache=autom4te.cache - args: autoconf/autoconf.m4f - args: acsite.m4? -@@ -142,7 +142,7 @@ - ## -------- ## - - begin-language: "Autotest" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: autotest/autotest.m4f - args: package.m4? - args: local.at? -@@ -156,7 +156,7 @@ - ## ---- ## - - begin-language: "M4sh" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sh.m4f - args: --mode 777 - args: --language M4sugar -@@ -168,6 +168,6 @@ - ## ------- ## - - begin-language: "M4sugar" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sugar.m4f - end-language: "M4sugar" diff --git a/recipes/autoconf/all/patches/2.71-0001-relocatable-autoconf.patch b/recipes/autoconf/all/patches/2.71-0001-relocatable-autoconf.patch new file mode 100644 index 00000000000000..ab33a00f77cb77 --- /dev/null +++ b/recipes/autoconf/all/patches/2.71-0001-relocatable-autoconf.patch @@ -0,0 +1,275 @@ +diff --git a/Makefile.in b/Makefile.in +index 22a17b3..ac18c85 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -427,7 +427,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LIBOBJS = @LIBOBJS@ + LIBS = @LIBS@ + LTLIBOBJS = @LTLIBOBJS@ +-M4 = @M4@ ++M4 = /usr/bin/env m4 + M4_DEBUGFILE = @M4_DEBUGFILE@ + M4_GNU = @M4_GNU@ + MAKEINFO = @MAKEINFO@ +diff --git a/bin/autoconf.as b/bin/autoconf.as +index 1407739..50ad1de 100644 +--- a/bin/autoconf.as ++++ b/bin/autoconf.as +@@ -89,8 +89,17 @@ exit_missing_arg=' + # restore font-lock: ' + + # Variables. +-: ${AUTOM4TE='@bindir@/@autom4te-name@'} +-: ${trailer_m4='@pkgdatadir@/autoconf/trailer.m4'} ++# Locate autom4ate and support files relative to current script inside package ++SCRIPT_DIR=$(dirname "$as_myself") ++RES_DIR="$SCRIPT_DIR/../res/autoconf" ++if [[ ! -d "$RES_DIR" ]] ++then ++ echo "Autoconf conan package error, unable to locate resource directory at $RES_DIR\n" ++ exit 1 ++fi ++ ++: ${AUTOM4TE="$SCRIPT_DIR/autom4te"} ++: ${trailer_m4="$RES_DIR/autoconf/trailer.m4"} + autom4te_options= + outfile= + verbose=false +diff --git a/bin/autoheader.in b/bin/autoheader.in +index 1cbf509..9bdd1cf 100644 +--- a/bin/autoheader.in ++++ b/bin/autoheader.in +@@ -29,10 +29,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, "$pkgdatadir"; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -54,7 +57,8 @@ use Autom4te::XFile; + our ($config_h, %symbol, %verbatim); + + # Lib files. +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $config_h_in; + my @prepend_include; + my @include; +diff --git a/bin/autom4te.in b/bin/autom4te.in +index 7ebe419..42f09b4 100644 +--- a/bin/autom4te.in ++++ b/bin/autom4te.in +@@ -25,10 +25,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -48,7 +51,8 @@ use Autom4te::General; + use Autom4te::XFile; + + # Data directory. +-my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $pkgdatadir = $ENV{'AC_MACRODIR'} || "$scriptpath/../res/autoconf"; + + # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE. + my %language; +@@ -91,7 +95,7 @@ my @include; + my $freeze = 0; + + # $M4. +-my $m4 = $ENV{"M4"} || '@M4@'; ++my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; + # Some non-GNU m4's don't reject the --help option, so give them /dev/null. + fatal "need GNU m4 1.4 or later: $m4" + if system "$m4 --help &1 | grep reload-state >/dev/null"; +@@ -271,6 +275,12 @@ sub load_configuration ($) + if /^\s*(\#.*)?$/; + + my @words = shellwords ($_); ++ # not using: s#AUTOCONF_M4DIR#$pkgdatadir#r to support perl <5.14 ++ my @words_clone = @words; ++ @words = (); ++ foreach ( @words_clone ) { ++ push(@words, do { (my $tmp = $_) =~ s#AUTOCONF_M4DIR#$pkgdatadir#; $tmp }); ++ } + my $type = shift @words; + if ($type eq 'begin-language:') + { +diff --git a/bin/autoreconf.in b/bin/autoreconf.in +index ec391a6..2992b16 100644 +--- a/bin/autoreconf.in ++++ b/bin/autoreconf.in +@@ -28,11 +28,14 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + my $buildauxdir; + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + $buildauxdir = $ENV{'autom4te_buildauxdir'} || $pkgdatadir . '/build-aux'; +@@ -117,9 +120,10 @@ Written by David J. MacKenzie and Akim Demaille. + "; + + # Lib files. +-my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@'; +-my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@'; +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autoconf = $ENV{'AUTOCONF'} || "$scriptpath/@autoconf-name@"; ++my $autoheader = $ENV{'AUTOHEADER'} || "$scriptpath/@autoheader-name@"; ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $automake = $ENV{'AUTOMAKE'} || 'automake'; + my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; + my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; +diff --git a/bin/autoscan.in b/bin/autoscan.in +index b89fd1a..6113d62 100644 +--- a/bin/autoscan.in ++++ b/bin/autoscan.in +@@ -27,10 +27,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -95,7 +98,8 @@ my %needed_macros = + my $log; + + # Autoconf and lib files. +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $autoconf = "$autom4te --language=autoconf"; + my @prepend_include; + my @include = ('@pkgdatadir@'); +diff --git a/bin/autoupdate.in b/bin/autoupdate.in +index c86203a..844dd20 100644 +--- a/bin/autoupdate.in ++++ b/bin/autoupdate.in +@@ -28,10 +28,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -51,14 +54,15 @@ use Autom4te::General; + use Autom4te::XFile; + + # Lib files. +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $autoconf = "$autom4te --language=autoconf"; + # We need to find m4sugar. + my @prepend_include; + my @include = ('@pkgdatadir@'); + my $force = 0; + # m4. +-my $m4 = $ENV{"M4"} || '@M4@'; ++my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; + + + # $HELP +diff --git a/bin/ifnames.in b/bin/ifnames.in +index b04947f..75d014e 100644 +--- a/bin/ifnames.in ++++ b/bin/ifnames.in +@@ -32,10 +32,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +diff --git a/lib/autom4te.in b/lib/autom4te.in +index 9e86c9f..bf3ae42 100644 +--- a/lib/autom4te.in ++++ b/lib/autom4te.in +@@ -115,7 +115,7 @@ end-language: "Autoreconf-preselections" + # This intermediate language is used by aclocal to build aclocal.m4. + + begin-language: "Autoconf-without-aclocal-m4" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: --cache=autom4te.cache + args: autoconf/autoconf.m4f + args: acsite.m4? +@@ -142,7 +142,7 @@ end-language: "Autoconf" + ## -------- ## + + begin-language: "Autotest" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: autotest/autotest.m4f + args: package.m4? + args: local.at? +@@ -156,7 +156,7 @@ end-language: "Autotest" + ## ---- ## + + begin-language: "M4sh" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: m4sugar/m4sh.m4f + args: --mode 777 + args: --language M4sugar +@@ -168,6 +168,6 @@ end-language: "M4sh" + ## ------- ## + + begin-language: "M4sugar" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: m4sugar/m4sugar.m4f + end-language: "M4sugar" diff --git a/recipes/autoconf/all/patches/2.71-0005-disable-man-regeneration.patch b/recipes/autoconf/all/patches/2.71-0003-disable-man-regeneration.patch similarity index 100% rename from recipes/autoconf/all/patches/2.71-0005-disable-man-regeneration.patch rename to recipes/autoconf/all/patches/2.71-0003-disable-man-regeneration.patch diff --git a/recipes/autoconf/all/patches/2.71-0003-uppercase-autom4te_perllibdir.patch b/recipes/autoconf/all/patches/2.71-0003-uppercase-autom4te_perllibdir.patch deleted file mode 100644 index f877e630d58f5a..00000000000000 --- a/recipes/autoconf/all/patches/2.71-0003-uppercase-autom4te_perllibdir.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- bin/autoheader.in -+++ bin/autoheader.in -@@ -32,7 +32,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, "$pkgdatadir"; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -28,7 +28,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoreconf.in -+++ bin/autoreconf.in -@@ -32,7 +32,7 @@ - my $buildauxdir; - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - $buildauxdir = $ENV{'autom4te_buildauxdir'} || $pkgdatadir . '/build-aux'; ---- bin/autoscan.in -+++ bin/autoscan.in -@@ -30,7 +30,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -31,7 +31,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/ifnames.in -+++ bin/ifnames.in -@@ -35,7 +35,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- Makefile.in -+++ Makefile.in -@@ -576,7 +567,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_build_prefix)bin/autom4te \ - -B '$(top_build_prefix)'lib -B '$(top_srcdir)'/lib # keep ` ' - diff --git a/recipes/autoconf/all/patches/2.71-0004-no-embedded-m4-paths.patch b/recipes/autoconf/all/patches/2.71-0004-no-embedded-m4-paths.patch deleted file mode 100644 index d47835a0e0137d..00000000000000 --- a/recipes/autoconf/all/patches/2.71-0004-no-embedded-m4-paths.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -91,7 +91,7 @@ - my $freeze = 0; - - # $M4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - # Some non-GNU m4's don't reject the --help option, so give them /dev/null. - fatal "need GNU m4 1.4 or later: $m4" - if system "$m4 --help &1 | grep reload-state >/dev/null"; ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -58,7 +58,7 @@ - my @include = ('@pkgdatadir@'); - my $force = 0; - # m4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - - - # $HELP ---- Makefile.in -+++ Makefile.in -@@ -427,7 +427,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ diff --git a/recipes/autoconf/all/patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch b/recipes/autoconf/all/patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch deleted file mode 100644 index a346636c611390..00000000000000 --- a/recipes/autoconf/all/patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch +++ /dev/null @@ -1,17 +0,0 @@ -The trailer_m4 environment variable contains build-environment dependent information. -So this variable needs to be overridden by the conanfile. -But Windows has case insensitive environment variables. -Python silently converts lowercase environment variables to uppercase. -Work around this problem by getting the system information from an uppercase environment variable. - ---- bin/autoconf.as -+++ bin/autoconf.as -@@ -90,7 +90,7 @@ - - # Variables. - : ${AUTOM4TE='@bindir@/@autom4te-name@'} --: ${trailer_m4='@pkgdatadir@/autoconf/trailer.m4'} -+: ${trailer_m4="$AC_MACRODIR/autoconf/trailer.m4"} - autom4te_options= - outfile= - verbose=false diff --git a/recipes/autoconf/config.yml b/recipes/autoconf/config.yml index 7eafcfb17c54fe..f45dc3e529288e 100644 --- a/recipes/autoconf/config.yml +++ b/recipes/autoconf/config.yml @@ -1,5 +1,3 @@ versions: "2.71": folder: all - "2.69": - folder: all diff --git a/recipes/automake/all/conandata.yml b/recipes/automake/all/conandata.yml index 24df7aa715c72e..058a6cc80e230c 100644 --- a/recipes/automake/all/conandata.yml +++ b/recipes/automake/all/conandata.yml @@ -16,47 +16,22 @@ sources: sha256: "608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8" patches: "1.16.5": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.5.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.5.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.5.patch" "1.16.4": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.4.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.4.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.4.patch" "1.16.3": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.3.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.3.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.3.patch" "1.16.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.2.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.2.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.2.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.2.patch" "1.16.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.1.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.1.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.1.patch" + - patch_file: "patches/0003-relocatable-automake-1.16.1.patch" diff --git a/recipes/automake/all/conanfile.py b/recipes/automake/all/conanfile.py index 472f84cf07d885..25a1e0fbdb40f7 100644 --- a/recipes/automake/all/conanfile.py +++ b/recipes/automake/all/conanfile.py @@ -1,11 +1,17 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout + +required_conan_version = ">=1.53.0" class AutomakeConan(ConanFile): name = "automake" + package_type = "application" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/automake/" description = "Automake is a tool for automatically generating Makefile.in files compliant with the GNU Coding Standards." @@ -13,14 +19,6 @@ class AutomakeConan(ConanFile): license = ("GPL-2.0-or-later", "GPL-3.0-or-later") settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") - @property def _version_major_minor(self): [major, minor, _] = self.version.split(".", 2) @@ -30,6 +28,12 @@ def _version_major_minor(self): def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + def configure(self): del self.settings.compiler.cppstd del self.settings.compiler.libcxx @@ -41,7 +45,8 @@ def requirements(self): def build_requirements(self): if hasattr(self, "settings_build"): self.build_requires("autoconf/2.71") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.win_bash = True self.build_requires("msys2/cci.latest") def package_id(self): @@ -50,8 +55,8 @@ def package_id(self): del self.info.settings.build_type 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) @property def _datarootdir(self): @@ -61,41 +66,47 @@ def _datarootdir(self): def _automake_libdir(self): return os.path.join(self._datarootdir, "automake-{}".format(self._version_major_minor)) - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - conf_args = [ - "--datarootdir={}".format(tools.unix_path(self._datarootdir)), - "--prefix={}".format(tools.unix_path(self.package_folder)), - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - def _patch_files(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--datarootdir=${prefix}/res", + ]) + + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) if self.settings.os == "Windows": # tracing using m4 on Windows returns Windows paths => use cygpath to convert to unix paths - tools.replace_in_file(os.path.join(self._source_subfolder, "bin", "aclocal.in"), - " $map_traced_defs{$arg1} = $file;", - " $file = `cygpath -u $file`;\n" - " $file =~ s/^\\s+|\\s+$//g;\n" - " $map_traced_defs{$arg1} = $file;") + ac_local_in = os.path.join(self.source_folder, "bin", "aclocal.in") + replace_in_file(self, ac_local_in, + " $map_traced_defs{$arg1} = $file;", + " $file = `cygpath -u $file`;\n" + " $file =~ s/^\\s+|\\s+$//g;\n" + " $map_traced_defs{$arg1} = $file;") + # handle relative paths during aclocal.m4 creation + replace_in_file(self, ac_local_in, "$map{$m} eq $map_traced_defs{$m}", + "abs_path($map{$m}) eq abs_path($map_traced_defs{$m})") def build(self): - self._patch_files() - autotools = self._configure_autotools() + self._patch_sources() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self._datarootdir, "info")) - tools.rmdir(os.path.join(self._datarootdir, "man")) - tools.rmdir(os.path.join(self._datarootdir, "doc")) + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder,"licenses")) + rmdir(self, os.path.join(self._datarootdir, "info")) + rmdir(self, os.path.join(self._datarootdir, "man")) + rmdir(self, os.path.join(self._datarootdir, "doc")) + + # TODO: consider whether the following is still necessary on Windows if self.settings.os == "Windows": binpath = os.path.join(self.package_folder, "bin") for filename in os.listdir(binpath): @@ -108,33 +119,15 @@ def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] + # For consumers with new integrations (Conan 1 and 2 compatible): + compile_wrapper = os.path.join(self._automake_libdir, "compile") + lib_wrapper = os.path.join(self._automake_libdir, "ar-lib") + self.conf_info.define("user.automake:compile-wrapper", compile_wrapper) + self.conf_info.define("user.automake:lib-wrapper", lib_wrapper) + + # For legacy Conan 1.x consumers only: + self.user_info.compile = compile_wrapper + self.user_info.ar_lib = lib_wrapper 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) - - bin_ext = ".exe" if self.settings.os == "Windows" else "" - - aclocal = tools.unix_path(os.path.join(self.package_folder, "bin", "aclocal" + bin_ext)) - self.output.info("Appending ACLOCAL environment variable with: {}".format(aclocal)) - self.env_info.ACLOCAL.append(aclocal) - - automake_datadir = tools.unix_path(self._datarootdir) - self.output.info("Setting AUTOMAKE_DATADIR to {}".format(automake_datadir)) - self.env_info.AUTOMAKE_DATADIR = automake_datadir - - automake_libdir = tools.unix_path(self._automake_libdir) - self.output.info("Setting AUTOMAKE_LIBDIR to {}".format(automake_libdir)) - self.env_info.AUTOMAKE_LIBDIR = automake_libdir - - automake_perllibdir = tools.unix_path(self._automake_libdir) - self.output.info("Setting AUTOMAKE_PERLLIBDIR to {}".format(automake_perllibdir)) - self.env_info.AUTOMAKE_PERLLIBDIR = automake_perllibdir - - automake = tools.unix_path(os.path.join(self.package_folder, "bin", "automake" + bin_ext)) - self.output.info("Setting AUTOMAKE to {}".format(automake)) - self.env_info.AUTOMAKE = automake - - self.output.info("Append M4 include directories to AUTOMAKE_CONAN_INCLUDES environment variable") - - self.user_info.compile = os.path.join(self._automake_libdir, "compile") - self.user_info.ar_lib = os.path.join(self._automake_libdir, "ar-lib") diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.3.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.3.patch deleted file mode 100644 index b608f94a120089..00000000000000 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.3.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -711,4 +711,4 @@ - update_mans = \ - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ -- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ -+ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.4.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.4.patch deleted file mode 100644 index 0ae00eb737eac9..00000000000000 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.4.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -703,4 +703,4 @@ - update_mans = \ - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ -- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ -+ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.1.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.1.patch similarity index 65% rename from recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.1.patch rename to recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.1.patch index 56c09e6ef56108..4472414040ceb1 100644 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.1.patch +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.1.patch @@ -1,11 +1,13 @@ ---- Makefile.in -+++ Makefile.in -@@ -706,7 +706,7 @@ +diff --git a/Makefile.in b/Makefile.in +index c3e934c..b96e108 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -706,7 +706,7 @@ man1_MANS = \ update_mans = \ $(AM_V_GEN): \ && $(MKDIR_P) doc \ - && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ + && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - + amhello_sources = \ doc/amhello/configure.ac \ diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.2.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.2.patch similarity index 65% rename from recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.2.patch rename to recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.2.patch index 9c66ba2afeeb71..8caedb331444e7 100644 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.2.patch +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.2.patch @@ -1,11 +1,13 @@ ---- Makefile.in -+++ Makefile.in -@@ -699,7 +699,7 @@ +diff --git a/Makefile.in b/Makefile.in +index 670f97a..feb1085 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -699,7 +699,7 @@ man1_MANS = \ update_mans = \ $(AM_V_GEN): \ && $(MKDIR_P) doc \ - && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ + && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - + amhello_sources = \ doc/amhello/configure.ac \ diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.3.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.3.patch new file mode 100644 index 00000000000000..e6fc1e37c7a203 --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.3.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 3190a66..c599705 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -711,7 +711,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + checklinkx = $(top_srcdir)/contrib/checklinkx + # that 4-second sleep seems to be what gnu.org likes. diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.4.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.4.patch new file mode 100644 index 00000000000000..aec1e1e992850a --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.4.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index bbe2d04..3a0f57e 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -703,7 +703,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + checklinkx = $(top_srcdir)/contrib/checklinkx + # that 4-second sleep seems to be what gnu.org likes. diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.5.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.5.patch new file mode 100644 index 00000000000000..c593ef11dafd15 --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.5.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 18850e7..ae75282 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -703,7 +703,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + checklinkx = $(top_srcdir)/contrib/checklinkx + # that 4-second sleep seems to be what gnu.org likes. diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.2.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.2.patch deleted file mode 100644 index 5e91a18bb5be9f..00000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.2.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,1 +1,1 @@ --#!@PERL@ -w -+#!/usr/bin/env perl -+# -*- perl -*- -w ---- bin/automake.in -+++ bin/automake.in -@@ -1,1 +1,1 @@ --#!@PERL@ -w -+#!/usr/bin/env perl -+# -*- perl -*- -w ---- Makefile.in -+++ Makefile.in -@@ -524,7 +524,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.3.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.3.patch deleted file mode 100644 index d13c305ceee18d..00000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.3.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- bin/automake.in -+++ bin/automake.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- Makefile.in -+++ Makefile.in -@@ -535,7 +535,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.4.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.4.patch deleted file mode 100644 index 986bcfba267608..00000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.4.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- bin/automake.in -+++ bin/automake.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- Makefile.in -+++ Makefile.in -@@ -527,7 +527,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.1.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.1.patch similarity index 60% rename from recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.1.patch rename to recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.1.patch index 3b71368f122614..54ba3ebcf4d591 100644 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.1.patch +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.1.patch @@ -1,10 +1,24 @@ ---- bin/aclocal.in -+++ bin/aclocal.in +diff --git a/Makefile.in b/Makefile.in +index b96e108..dd05843 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -532,7 +532,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index b3715d9..acf4792 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in @@ -1,8 +1,8 @@ -#!@PERL@ -w --# -*- perl -*- +#!/usr/bin/env perl -+# -*- perl -*- -w + # -*- perl -*- # @configure_input@ -eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' @@ -12,34 +26,26 @@ if 0; # aclocal - create aclocal.m4 by scanning configure.ac ---- bin/automake.in -+++ bin/automake.in +diff --git a/bin/automake.in b/bin/automake.in +index a52a489..0abd5f6 100644 +--- a/bin/automake.in ++++ b/bin/automake.in @@ -1,8 +1,8 @@ -#!@PERL@ -w --# -*- perl -*- +#!/usr/bin/env perl -+# -*- perl -*- -w + # -*- perl -*- # @configure_input@ -eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' -+eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' ++eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec /usr/bin/env perl -S "$0" "$@";; esac' if 0; # automake - create Makefile.in from Makefile.am ---- Makefile.in -+++ Makefile.in -@@ -532,7 +532,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index 5dc2a61..3f53902 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL # User can override various tools used. Prefer overriding specific for # that automake testsuite, if they are available. AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.2.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.2.patch new file mode 100644 index 00000000000000..62935414ace95f --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.2.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index feb1085..5d2f5cc 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -524,7 +524,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index 9a20325..0a4eac4 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ -w ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2020 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index 212cb38..cb077a7 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ -w ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2020 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index dff88b7..20b012f 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.3.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.3.patch new file mode 100644 index 00000000000000..1a24e6d5d93a76 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.3.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index c599705..8c18ed2 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -535,7 +535,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index ca2f963..8782f24 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2020 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index 31c7238..e41b1f5 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2020 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index dff88b7..20b012f 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.4.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.4.patch new file mode 100644 index 00000000000000..e4e77c4731fc55 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.4.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index 3a0f57e..4bdcf55 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -527,7 +527,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index f112447..a63ce4d 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2021 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index f04f5d5..4502558 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2021 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index c404b0e..381d965 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.5.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.5.patch new file mode 100644 index 00000000000000..aa3b8311015962 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.5.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index ae75282..55844e7 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -527,7 +527,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index f112447..a63ce4d 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2021 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index 30babd6..d499bfd 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2021 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index c404b0e..381d965 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.1.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.1.patch new file mode 100644 index 00000000000000..a302e89e70767a --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.1.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index acf4792..e0b64de 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -24,10 +24,13 @@ eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec /usr/bin/env perl - + + # Written by Tom Tromey , and + # Alexandre Duret-Lutz . ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -67,9 +70,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -451,6 +461,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -773,7 +784,7 @@ sub trace_used_macros () + # to silence m4_require warnings". + my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])"; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + $traces = "echo '$early_m4_code' | $traces - "; + +diff --git a/bin/automake.in b/bin/automake.in +index 0abd5f6..055c078 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -28,10 +28,13 @@ eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec /usr/bin/env perl - + package Automake; + + use strict; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5246,7 +5249,7 @@ sub scan_autoconf_traces + sinclude => 1, + ); + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index 6edac11..3adeed1 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ use strict; + + use 5.006; + require Exporter; ++use Cwd 'abs_path'; ++use File::Basename; + + our @ISA = qw (Exporter); + our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION +@@ -32,7 +34,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.2.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.2.patch new file mode 100644 index 00000000000000..c7d66e2f6959bd --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.2.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index 0a4eac4..487b93d 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -18,10 +18,13 @@ + + # Written by Tom Tromey , and + # Alexandre Duret-Lutz . ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -61,9 +64,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -445,6 +455,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -767,7 +778,7 @@ sub trace_used_macros () + # to silence m4_require warnings". + my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])"; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + $traces = "echo '$early_m4_code' | $traces - "; + +diff --git a/bin/automake.in b/bin/automake.in +index cb077a7..676593c 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -23,10 +23,13 @@ + package Automake; + + use strict; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5243,7 +5246,7 @@ sub scan_autoconf_traces + sinclude => 1, + ); + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index f79b8cd..ed78dd2 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ use strict; + + use 5.006; + require Exporter; ++use Cwd 'abs_path'; ++use File::Basename; + + our @ISA = qw (Exporter); + our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION +@@ -32,7 +34,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.3.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.3.patch new file mode 100644 index 00000000000000..2c34ed4d6edbea --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.3.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index 8782f24..263ebc2 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -22,10 +22,13 @@ + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -64,9 +67,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -448,6 +458,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -768,7 +779,7 @@ sub trace_used_macros () + # aclocal.m4 is not yet available. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + + # Support AC_CONFIG_MACRO_DIRS also with older autoconf. +diff --git a/bin/automake.in b/bin/automake.in +index e41b1f5..233a6a3 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -25,10 +25,13 @@ package Automake; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5254,7 +5257,7 @@ sub scan_autoconf_traces + # and will see its warnings then. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index d44e0ab..fba2b81 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ package Automake::Config; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + use Exporter; + +@@ -34,7 +36,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.4.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.4.patch new file mode 100644 index 00000000000000..011c7ddfdc8db1 --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.4.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index a63ce4d..e82d65b 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -22,10 +22,13 @@ + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -64,9 +67,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -448,6 +458,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -768,7 +779,7 @@ sub trace_used_macros () + # aclocal.m4 is not yet available. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + + # Support AC_CONFIG_MACRO_DIRS also with older autoconf. +diff --git a/bin/automake.in b/bin/automake.in +index 4502558..6506946 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -25,10 +25,13 @@ package Automake; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5280,7 +5283,7 @@ sub scan_autoconf_traces + # and will see its warnings then. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index d529f1b..ca98604 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ package Automake::Config; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + use Exporter; + +@@ -34,7 +36,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.5.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.5.patch new file mode 100644 index 00000000000000..56b752f9a116a2 --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.5.patch @@ -0,0 +1,107 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index a63ce4d..6224832 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -22,10 +22,13 @@ + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -64,9 +67,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -448,6 +458,8 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); ++ + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -768,7 +780,7 @@ sub trace_used_macros () + # aclocal.m4 is not yet available. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + + # Support AC_CONFIG_MACRO_DIRS also with older autoconf. +diff --git a/bin/automake.in b/bin/automake.in +index d499bfd..d4081c9 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -25,10 +25,13 @@ package Automake; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5280,7 +5283,7 @@ sub scan_autoconf_traces + # and will see its warnings then. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index d529f1b..ca98604 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ package Automake::Config; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + use Exporter; + +@@ -34,7 +36,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch b/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch deleted file mode 100644 index 458aa275fdbca2..00000000000000 --- a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -68,8 +68,8 @@ - # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' - # option. - my @user_includes = (); --my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); --my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION); -+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal'); -+my @conan_includes = uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || "")); -- - # Whether we should copy M4 file in $user_includes[0]. - my $install = 0; -@@ -451,6 +451,6 @@ - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); -+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); -- - # Construct a new function that does the searching. We use a - # function (instead of just evaluating $search in the loop) so that diff --git a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch b/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch deleted file mode 100644 index 3b2e717768c51d..00000000000000 --- a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -62,8 +62,8 @@ - # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' - # option. - my @user_includes = (); --my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); --my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION); -+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal'); -+my @conan_includes = uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || "")); -- - # Whether we should copy M4 file in $user_includes[0]. - my $install = 0; -@@ -445,6 +445,6 @@ - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); -+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); -- - # Construct a new function that does the searching. We use a - # function (instead of just evaluating $search in the loop) so that diff --git a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch b/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch deleted file mode 100644 index a762cf7600f69c..00000000000000 --- a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -65,8 +65,8 @@ - # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' - # option. - my @user_includes = (); --my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); --my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION); -+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal'); -+my @conan_includes = uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || "")); -- - # Whether we should copy M4 file in $user_includes[0]. - my $install = 0; -@@ -448,6 +448,6 @@ - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); -+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); -- - # Construct a new function that does the searching. We use a - # function (instead of just evaluating $search in the loop) so that diff --git a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.1.patch b/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.1.patch deleted file mode 100644 index d74ebf2dc56a6b..00000000000000 --- a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.1.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -27,7 +27,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - } - ---- bin/automake.in -+++ bin/automake.in -@@ -31,7 +31,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - - # Override SHELL. This is required on DJGPP so that system() uses -$ diff --git a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.2.patch b/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.2.patch deleted file mode 100644 index 07ad7435b932ee..00000000000000 --- a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.2.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -21,7 +21,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - } - ---- bin/automake.in -+++ bin/automake.in -@@ -26,7 +26,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - - # Override SHELL. This is required on DJGPP so that system() uses -$ diff --git a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.3.patch b/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.3.patch deleted file mode 100644 index 8c2546f8629f49..00000000000000 --- a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.3.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -25,7 +25,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - } - ---- bin/automake.in -+++ bin/automake.in -@@ -28,7 +28,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - - # Override SHELL. This is required on DJGPP so that system() uses -$ diff --git a/recipes/automake/all/test_package/conanfile.py b/recipes/automake/all/test_package/conanfile.py index 8362800620a5ab..32063f5e9afe29 100644 --- a/recipes/automake/all/test_package/conanfile.py +++ b/recipes/automake/all/test_package/conanfile.py @@ -1,89 +1,95 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conan.tools.microsoft import is_msvc -from contextlib import contextmanager import os -import shutil -required_conan_version = ">=1.45.0" +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path + + +required_conan_version = ">=1.53.0" class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - exports_sources = "configure.ac", "Makefile.am", "test_package_1.c", "test_package.cpp" - # DON'T COPY extra.m4 TO BUILD FOLDER!!! test_type = "explicit" + win_bash = True + + _default_cc = { + "gcc": "gcc", + "clang": "clang", + "Visual Studio": "cl -nologo", + "msvc": "cl -nologo", + "apple-clang": "clang", + } + + def _system_compiler(self, cxx=False): + system_cc = self._default_cc.get(str(self.settings.compiler)) + if system_cc and cxx: + if self.settings.compiler == "gcc": + system_cc = "g++" + elif "clang" in self.settings.compiler: + system_cc = "clang++" + return system_cc @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - def requirements(self): - self.requires(self.tested_reference_str) - def build_requirements(self): self.build_requires(self.tested_reference_str) - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + if self._settings_build.os == "Windows" and not self.conf.get( + "tools.microsoft.bash:path", check_type=str + ): self.build_requires("msys2/cci.latest") - @contextmanager - def _build_context(self): - if is_msvc(self): - with tools.vcvars(self): - with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): - yield - else: - yield + def layout(self): + basic_layout(self, src_folder="src") - _default_cc = { - "gcc": "gcc", - "clang": "clang", - "Visual Studio": "cl -nologo", - "apple-clang": "clang", - } + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() - @property - def _system_cc(self): - system_cc = os.environ.get("CC", None) - if not system_cc: - system_cc = self._default_cc.get(str(self.settings.compiler)) - return system_cc - - @property - def _user_info(self): - return getattr(self, "user_info_build", self.deps_user_info) - - def _build_scripts(self): - """Test compile script of automake""" - compile_script = self._user_info["automake"].compile - ar_script = self._user_info["automake"].ar_lib - assert os.path.isfile(ar_script) - assert os.path.isfile(compile_script) - - if self._system_cc: - with tools.vcvars(self) if is_msvc(self) else tools.no_op(): - self.run("{} {} test_package_1.c -o script_test".format(tools.unix_path(compile_script), self._system_cc), win_bash=tools.os_info.is_windows) - - def _build_autotools(self): - """Test autoreconf + configure + make""" - with tools.environment_append({"AUTOMAKE_CONAN_INCLUDES": [tools.unix_path(self.source_folder)]}): - self.run("{} -fiv".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows) - self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), win_bash=tools.os_info.is_windows) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools.configure() - autotools.make() + env = VirtualBuildEnv(self) + env.generate() - def build(self): - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + env = Environment() - self._build_scripts() - self._build_autotools() + compile_script = unix_path(self, + self.dependencies.build["automake"].conf_info.get("user.automake:compile-wrapper")) - def test(self): - if self._system_cc: - if not tools.cross_building(self): - self.run(os.path.join(".", "script_test"), run_environment=True) + # define CC and CXX such that if the user hasn't already defined it + # via `tools.build:compiler_executables` or buildenv variables, + # we tell autotools to guess the name matching the current setting + # (otherwise it falls back to finding gcc first) + cc = self._system_compiler() + cxx = self._system_compiler(cxx=True) + if cc and cxx: + # Using shell parameter expansion + env.define("CC", f"${{CC-{cc}}}") + env.define("CXX", f"${{CXX-{cxx}}}") + + env.define("COMPILE", compile_script) + env.define("ACLOCAL_PATH", unix_path(self, os.path.join(self.source_folder))) + env.vars(self, scope="build").save_script("automake_build_test") - if not tools.cross_building(self): - self.run(os.path.join(".", "test_package"), run_environment=True) + def build(self): + # Test compilation through compile wrapper script + compiler = self._system_compiler() + source_file = unix_path(self, os.path.join(self.source_folder, "test_package_1.c")) + with chdir(self, self.build_folder): + self.run(f"$COMPILE {compiler} {source_file} -o script_test", env="conanbuild") + + # Build test project + autotools = Autotools(self) + autotools.autoreconf(args=['--debug']) + autotools.configure() + autotools.make() + + def test(self): + if can_run(self): + with chdir(self, self.build_folder): + self.run("./script_test") + self.run("./test_package") diff --git a/recipes/automake/all/test_package/src/Makefile.am b/recipes/automake/all/test_package/src/Makefile.am new file mode 100644 index 00000000000000..655db7f1876cb6 --- /dev/null +++ b/recipes/automake/all/test_package/src/Makefile.am @@ -0,0 +1,4 @@ +# @configure_input@ + +bin_PROGRAMS = test_package +test_package_SOURCES = test_package.cpp diff --git a/recipes/automake/all/test_package/src/configure.ac b/recipes/automake/all/test_package/src/configure.ac new file mode 100644 index 00000000000000..8a7ae1dc34e7f5 --- /dev/null +++ b/recipes/automake/all/test_package/src/configure.ac @@ -0,0 +1,28 @@ +AC_PREREQ([2.69]) +AC_INIT([test_package], [1.0]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +# Safety checks in case user overwritten --srcdir +AC_CONFIG_SRCDIR([test_package.cpp]) + +AC_CANONICAL_HOST + +# Test includes of extra including directories using conan +AUTOMAKE_TEST_PACKAGE_PREREQ([1.0]) +AUTOMAKE_TEST_PACKAGE_HELLO([argument1], [argument2], [...], [last argument]) + +AC_CONFIG_HEADER([config.h]) + +# Check for CC and CXX compiler +AC_PROG_CC +AC_PROG_CXX +## We can add more checks in this section +# +## Tells automake to create a Makefile +## See https://www.gnu.org/software/automake/manual/html_node/Requirements.html +AC_CONFIG_FILES([Makefile]) +# +## Generate the output +AC_OUTPUT +# diff --git a/recipes/automake/all/test_package/src/extra.m4 b/recipes/automake/all/test_package/src/extra.m4 new file mode 100644 index 00000000000000..69c85f5ac945de --- /dev/null +++ b/recipes/automake/all/test_package/src/extra.m4 @@ -0,0 +1,14 @@ +dnl This file contains a macro to test adding extra include dirs using conan + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_PREREQ],[ + m4_define([CONAN_MACRO_VERSION], [1.3]) + m4_if(m4_version_compare(CONAN_MACRO_VERSION, [$1]), + -1, + [m4_fatal([extra.m4 version $1 or higher is required, but ]CONAN_MACRO_VERSION[ found])] + ) +])dnl AUTOMAKE_TEST_PACKAGE_PREREQ + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_HELLO],[ + echo "Hello world from the extra.m4 script!" + echo "My args were: $*" +])dnl diff --git a/recipes/automake/all/test_package/src/test_package.cpp b/recipes/automake/all/test_package/src/test_package.cpp new file mode 100644 index 00000000000000..cd8c2f27c35879 --- /dev/null +++ b/recipes/automake/all/test_package/src/test_package.cpp @@ -0,0 +1,9 @@ +#include "config.h" + +#include +#include + +int main(int argc, char** argv) { + std::cout << "test_package.cpp: " << "hello world from " PACKAGE_NAME "!\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/automake/all/test_package/src/test_package_1.c b/recipes/automake/all/test_package/src/test_package_1.c new file mode 100644 index 00000000000000..9aaff6c18e30d1 --- /dev/null +++ b/recipes/automake/all/test_package/src/test_package_1.c @@ -0,0 +1,7 @@ +#include +#include + +int main() { + puts("test_package.c says 'Hello World'!\n"); + return EXIT_SUCCESS; +} diff --git a/recipes/automake/all/test_v1_package/Makefile.am b/recipes/automake/all/test_v1_package/Makefile.am new file mode 100644 index 00000000000000..655db7f1876cb6 --- /dev/null +++ b/recipes/automake/all/test_v1_package/Makefile.am @@ -0,0 +1,4 @@ +# @configure_input@ + +bin_PROGRAMS = test_package +test_package_SOURCES = test_package.cpp diff --git a/recipes/automake/all/test_v1_package/conanfile.py b/recipes/automake/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..8362800620a5ab --- /dev/null +++ b/recipes/automake/all/test_v1_package/conanfile.py @@ -0,0 +1,89 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, tools +from conan.tools.microsoft import is_msvc +from contextlib import contextmanager +import os +import shutil + +required_conan_version = ">=1.45.0" + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + exports_sources = "configure.ac", "Makefile.am", "test_package_1.c", "test_package.cpp" + # DON'T COPY extra.m4 TO BUILD FOLDER!!! + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + @contextmanager + def _build_context(self): + if is_msvc(self): + with tools.vcvars(self): + with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): + yield + else: + yield + + _default_cc = { + "gcc": "gcc", + "clang": "clang", + "Visual Studio": "cl -nologo", + "apple-clang": "clang", + } + + @property + def _system_cc(self): + system_cc = os.environ.get("CC", None) + if not system_cc: + system_cc = self._default_cc.get(str(self.settings.compiler)) + return system_cc + + @property + def _user_info(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def _build_scripts(self): + """Test compile script of automake""" + compile_script = self._user_info["automake"].compile + ar_script = self._user_info["automake"].ar_lib + assert os.path.isfile(ar_script) + assert os.path.isfile(compile_script) + + if self._system_cc: + with tools.vcvars(self) if is_msvc(self) else tools.no_op(): + self.run("{} {} test_package_1.c -o script_test".format(tools.unix_path(compile_script), self._system_cc), win_bash=tools.os_info.is_windows) + + def _build_autotools(self): + """Test autoreconf + configure + make""" + with tools.environment_append({"AUTOMAKE_CONAN_INCLUDES": [tools.unix_path(self.source_folder)]}): + self.run("{} -fiv".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows) + self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), win_bash=tools.os_info.is_windows) + autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + with self._build_context(): + autotools.configure() + autotools.make() + + def build(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + + self._build_scripts() + self._build_autotools() + + def test(self): + if self._system_cc: + if not tools.cross_building(self): + self.run(os.path.join(".", "script_test"), run_environment=True) + + if not tools.cross_building(self): + self.run(os.path.join(".", "test_package"), run_environment=True) diff --git a/recipes/automake/all/test_v1_package/configure.ac b/recipes/automake/all/test_v1_package/configure.ac new file mode 100644 index 00000000000000..8a7ae1dc34e7f5 --- /dev/null +++ b/recipes/automake/all/test_v1_package/configure.ac @@ -0,0 +1,28 @@ +AC_PREREQ([2.69]) +AC_INIT([test_package], [1.0]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +# Safety checks in case user overwritten --srcdir +AC_CONFIG_SRCDIR([test_package.cpp]) + +AC_CANONICAL_HOST + +# Test includes of extra including directories using conan +AUTOMAKE_TEST_PACKAGE_PREREQ([1.0]) +AUTOMAKE_TEST_PACKAGE_HELLO([argument1], [argument2], [...], [last argument]) + +AC_CONFIG_HEADER([config.h]) + +# Check for CC and CXX compiler +AC_PROG_CC +AC_PROG_CXX +## We can add more checks in this section +# +## Tells automake to create a Makefile +## See https://www.gnu.org/software/automake/manual/html_node/Requirements.html +AC_CONFIG_FILES([Makefile]) +# +## Generate the output +AC_OUTPUT +# diff --git a/recipes/automake/all/test_v1_package/extra.m4 b/recipes/automake/all/test_v1_package/extra.m4 new file mode 100644 index 00000000000000..69c85f5ac945de --- /dev/null +++ b/recipes/automake/all/test_v1_package/extra.m4 @@ -0,0 +1,14 @@ +dnl This file contains a macro to test adding extra include dirs using conan + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_PREREQ],[ + m4_define([CONAN_MACRO_VERSION], [1.3]) + m4_if(m4_version_compare(CONAN_MACRO_VERSION, [$1]), + -1, + [m4_fatal([extra.m4 version $1 or higher is required, but ]CONAN_MACRO_VERSION[ found])] + ) +])dnl AUTOMAKE_TEST_PACKAGE_PREREQ + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_HELLO],[ + echo "Hello world from the extra.m4 script!" + echo "My args were: $*" +])dnl diff --git a/recipes/automake/all/test_v1_package/test_package.cpp b/recipes/automake/all/test_v1_package/test_package.cpp new file mode 100644 index 00000000000000..cd8c2f27c35879 --- /dev/null +++ b/recipes/automake/all/test_v1_package/test_package.cpp @@ -0,0 +1,9 @@ +#include "config.h" + +#include +#include + +int main(int argc, char** argv) { + std::cout << "test_package.cpp: " << "hello world from " PACKAGE_NAME "!\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/automake/all/test_v1_package/test_package_1.c b/recipes/automake/all/test_v1_package/test_package_1.c new file mode 100644 index 00000000000000..9aaff6c18e30d1 --- /dev/null +++ b/recipes/automake/all/test_v1_package/test_package_1.c @@ -0,0 +1,7 @@ +#include +#include + +int main() { + puts("test_package.c says 'Hello World'!\n"); + return EXIT_SUCCESS; +} diff --git a/recipes/avahi/all/conanfile.py b/recipes/avahi/all/conanfile.py index a622c2efdd8916..9db11a9e8123fd 100644 --- a/recipes/avahi/all/conanfile.py +++ b/recipes/avahi/all/conanfile.py @@ -1,6 +1,7 @@ import os from conan import ConanFile +from conan.tools.env import VirtualBuildEnv from conan.tools.files import copy, get, rmdir, rm from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps from conan.tools.layout import basic_layout @@ -33,13 +34,16 @@ def layout(self): basic_layout(self, src_folder="src") def requirements(self): - self.requires("glib/2.75.0") + self.requires("glib/2.75.2") self.requires("expat/2.5.0") self.requires("libdaemon/0.14") self.requires("dbus/1.15.2") self.requires("gdbm/1.19") self.requires("libevent/2.1.12") + def build_requirements(self): + self.tool_requires("glib/2.75.2") + def validate(self): if self.info.settings.os != "Linux": raise ConanInvalidConfiguration(f"{self.ref} only supports Linux.") @@ -54,6 +58,8 @@ def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() tc = AutotoolsToolchain(self) tc.configure_args.append("--enable-compat-libdns_sd") tc.configure_args.append("--disable-gtk3") diff --git a/recipes/b2/portable/conanfile.py b/recipes/b2/portable/conanfile.py index c4123bff05281c..9de31b1810ad27 100644 --- a/recipes/b2/portable/conanfile.py +++ b/recipes/b2/portable/conanfile.py @@ -1,9 +1,11 @@ -import os -from contextlib import contextmanager -import conan.tools.files -import conan.tools.layout from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.files import chdir, copy, get +from conan.tools.layout import basic_layout + +from contextlib import contextmanager +import os from six import StringIO required_conan_version = ">=1.47.0" @@ -13,11 +15,11 @@ class B2Conan(ConanFile): name = "b2" homepage = "https://www.bfgroup.xyz/b2/" description = "B2 makes it easy to build C++ projects, everywhere." - topics = ("b2", "installer", "builder", "build", "build-system") + topics = ("installer", "builder", "build", "build-system") license = "BSL-1.0" - settings = "os", "arch" url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch" ''' * use_cxx_env: False, True @@ -45,24 +47,31 @@ class B2Conan(ConanFile): 'acc', 'borland', 'clang', 'como', 'gcc-nocygwin', 'gcc', 'intel-darwin', 'intel-linux', 'intel-win32', 'kcc', 'kylix', 'mingw', 'mipspro', 'pathscale', 'pgi', 'qcc', 'sun', 'sunpro', - 'tru64cxx', 'vacpp', 'vc12', 'vc14', 'vc141', 'vc142', 'vc143'] + 'tru64cxx', 'vacpp', 'vc12', 'vc14', 'vc141', 'vc142', 'vc143', + ] } default_options = { 'use_cxx_env': False, 'toolset': 'auto' } + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.options.use_cxx_env + del self.info.options.toolset + def validate(self): + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} recipe doesn't support cross-build yet") + if (self.options.toolset == 'cxx' or self.options.toolset == 'cross-cxx') and not self.options.use_cxx_env: raise ConanInvalidConfiguration( "Option toolset 'cxx' and 'cross-cxx' requires 'use_cxx_env=True'") - def layout(self): - conan.tools.layout.basic_layout(self, src_folder="root") - def source(self): - conan.tools.files.get( - self, **self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _b2_dir(self): @@ -76,10 +85,6 @@ def _b2_engine_dir(self): def _b2_output_dir(self): return os.path.join(self.build_folder, "output") - @property - def _pkg_licenses_dir(self): - return os.path.join(self.package_folder, "licenses") - @property def _pkg_bin_dir(self): return os.path.join(self.package_folder, "bin") @@ -118,7 +123,7 @@ def build(self): # that didn't exist when the build was written. This turns that # into a generic msvc toolset build assuming it could work, # since it's a better version. - with conan.tools.files.chdir(self, self._b2_engine_dir): + with chdir(self, self._b2_engine_dir): with self._bootstrap_env(): buf = StringIO() self.run('guess_toolset && set', output=buf) @@ -134,7 +139,7 @@ def build(self): command += "build" if use_windows_commands else "./build.sh" if b2_toolset != 'auto': command += " "+str(b2_toolset) - with conan.tools.files.chdir(self, self._b2_engine_dir): + with chdir(self, self._b2_engine_dir): with self._bootstrap_env(): self.run(command) @@ -144,31 +149,23 @@ def build(self): if b2_toolset not in ["auto", "cxx", "cross-cxx"]: command += " toolset=" + str(b2_toolset) full_command = \ - ("{0} --ignore-site-config " + - "--prefix={1} " + + (f"{command} --ignore-site-config " + + f"--prefix={self._b2_output_dir} " + "--abbreviate-paths " + "install " + - "b2-install-layout=portable").format(command, self._b2_output_dir) - with conan.tools.files.chdir(self, self._b2_dir): + "b2-install-layout=portable") + with chdir(self, self._b2_dir): self.run(full_command) def package(self): - conan.tools.files.copy( - self, "LICENSE.txt", dst=self._pkg_licenses_dir, src=self.source_folder) - conan.tools.files.copy( - self, "*b2", dst=self._pkg_bin_dir, src=self._b2_output_dir) - conan.tools.files.copy( - self, "*b2.exe", dst=self._pkg_bin_dir, src=self._b2_output_dir) - conan.tools.files.copy( - self, "*.jam", dst=self._pkg_bin_dir, src=self._b2_output_dir) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*b2", dst=self._pkg_bin_dir, src=self._b2_output_dir) + copy(self, "*b2.exe", dst=self._pkg_bin_dir, src=self._b2_output_dir) + copy(self, "*.jam", dst=self._pkg_bin_dir, src=self._b2_output_dir) def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - self.cpp_info.bindirs = ["bin"] - self.buildenv_info.prepend_path("PATH", self._pkg_bin_dir) - self.env_info.path = [self._pkg_bin_dir] - def package_id(self): - del self.info.options.use_cxx_env - del self.info.options.toolset + # TODO: to remove in conan v2 + self.env_info.PATH.append(self._pkg_bin_dir) diff --git a/recipes/benchmark/all/conanfile.py b/recipes/benchmark/all/conanfile.py index 04fc858f5c5ba4..78f24e35596ca5 100644 --- a/recipes/benchmark/all/conanfile.py +++ b/recipes/benchmark/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.build import cross_building from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir -from conan.tools.microsoft import is_msvc +from conan.tools.microsoft import is_msvc, check_min_vs from conan.tools.scm import Version import os @@ -44,9 +44,8 @@ def layout(self): cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) <= "12": - raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio <= 12") - if Version(self.version) < "1.7.0" and is_msvc(self) and self.info.options.shared: + check_min_vs(self, "190") + if Version(self.version) < "1.7.0" and is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration(f"{self.ref} doesn't support msvc shared builds") def _cmake_new_enough(self, required_version): @@ -65,8 +64,7 @@ def build_requirements(self): self.tool_requires("cmake/3.25.0") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/bison/all/conandata.yml b/recipes/bison/all/conandata.yml index 67b0780a7f6589..5b0419bb8cd0b9 100644 --- a/recipes/bison/all/conandata.yml +++ b/recipes/bison/all/conandata.yml @@ -14,35 +14,50 @@ sources: patches: "3.8.2": - patch_file: "patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.7.6-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" "3.7.6": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.7.6-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" "3.7.1": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.7.1-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" - patch_file: "patches/0006-dont-link-bison-against-libreadline.patch" - base_path: "source_subfolder" + patch_description: "Don't link bison against libreadline" + patch_type: "portability" "3.5.3": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.5.3-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0003-3.5.3-msvc-changes.patch" - base_path: "source_subfolder" + patch_description: "windows: fix build" + patch_type: "portability" - patch_file: "patches/0004-3.5.3-relocatable.patch" - base_path: "source_subfolder" + patch_description: "Relocatable" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" diff --git a/recipes/bison/all/conanfile.py b/recipes/bison/all/conanfile.py index 86d0e584d5c460..9a5645894b97c8 100644 --- a/recipes/bison/all/conanfile.py +++ b/recipes/bison/all/conanfile.py @@ -1,11 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, apply_conandata_patches, replace_in_file -from conans import AutoToolsBuildEnvironment, tools -import contextlib +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.54.0" class BisonConan(ConanFile): @@ -23,151 +25,147 @@ class BisonConan(ConanFile): "fPIC": True, } - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @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): + 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 + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("m4/1.4.19") def validate(self): - if self.settings.compiler == "Visual Studio" and self.version == "3.8.2": - raise ConanInvalidConfiguration("bison/3.8.2 is not yet ready for Visual Studio, use previous version or open a pull request on https://github.com/conan-io/conan-center-index/pulls") + if is_msvc(self) and self.version == "3.8.2": + raise ConanInvalidConfiguration( + f"{self.ref} is not yet ready for Visual Studio, use previous version " + "or open a pull request on https://github.com/conan-io/conan-center-index/pulls" + ) 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.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.5") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") if self.settings.os != "Windows": - self.build_requires("flex/2.6.4") + self.tool_requires("flex/2.6.4") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CFLAGS": "-{}".format(self.settings.compiler.runtime), - "LD": "link", - "NM": "dumpbin -symbols", - "STRIP": ":", - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - "RANLIB": ":", - } - with tools.environment_append(env): - yield - else: - yield + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @property - def _datarootdir(self): - return os.path.join(self.package_folder, "res") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = [ + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ "--enable-relocatable", "--disable-nls", - "--datarootdir={}".format(os.path.join(self._datarootdir).replace("\\", "/")), - ] - host, build = None, None - if self.settings.os == "Windows": - self._autotools.defines.append("_WINDOWS") + "--datarootdir=${prefix}/res", + ]) if self.settings.compiler == "apple-clang": - args.append("gl_cv_compiler_check_decl_option=") - if self.settings.compiler == "Visual Studio": + tc.configure_args.append("gl_cv_compiler_check_decl_option=") + if is_msvc(self): # Avoid a `Assertion Failed Dialog Box` during configure with build_type=Debug # Visual Studio does not support the %n format flag: # https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions # Because the %n format is inherently insecure, it is disabled by default. If %n is encountered in a format string, # the invalid parameter handler is invoked, as described in Parameter Validation. To enable %n support, see _set_printf_count_output. - args.extend(["gl_cv_func_printf_directive_n=no", "gl_cv_func_snprintf_directive_n=no", "gl_cv_func_snprintf_directive_n=no"]) - self._autotools.flags.append("-FS") - host, build = False, False - self._autotools.configure(args=args, configure_dir=self._source_subfolder, host=host, build=build) - return self._autotools + tc.configure_args.extend([ + "gl_cv_func_printf_directive_n=no", + "gl_cv_func_snprintf_directive_n=no", + "gl_cv_func_snprintf_directive_n=no", + ]) + tc.extra_cflags.append("-FS") + env = tc.environment() + if is_msvc(self): + 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") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def _patch_sources(self): apply_conandata_patches(self) + makefile = os.path.join(self.source_folder, "Makefile.in") + yacc = os.path.join(self.source_folder, "src", "yacc.in") + if self.settings.os == "Windows": # replace embedded unix paths by windows paths - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define BINDIR \"$(bindir)\"';", "echo '#define BINDIR \"$(shell cygpath -m \"$(bindir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define PKGDATADIR \"$(pkgdatadir)\"';", "echo '#define PKGDATADIR \"$(shell cygpath -m \"$(pkgdatadir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define DATADIR \"$(datadir)\"';", "echo '#define DATADIR \"$(shell cygpath -m \"$(datadir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define DATAROOTDIR \"$(datarootdir)\"';", "echo '#define DATAROOTDIR \"$(shell cygpath -m \"$(datarootdir)\")\"';") - replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "dist_man_MANS = $(top_srcdir)/doc/bison.1", "dist_man_MANS =") - replace_in_file(self, os.path.join(self._source_subfolder, "src", "yacc.in"), - "@prefix@", - "${}_ROOT".format(self.name.upper())) - replace_in_file(self, os.path.join(self._source_subfolder, "src", "yacc.in"), - "@bindir@", - "${}_ROOT/bin".format(self.name.upper())) + replace_in_file(self, yacc, "@prefix@", "$CONAN_BISON_ROOT") + replace_in_file(self, yacc, "@bindir@", "$CONAN_BISON_ROOT/bin") def build(self): self._patch_sources() - with self._build_context(): - env_build = self._configure_autotools() - env_build.make() + autotools = Autotools(self) + autotools.configure() + autotools.install() def package(self): - with self._build_context(): - env_build = self._configure_autotools() - env_build.install() - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - - if self.settings.compiler == "Visual Studio": - os.rename(os.path.join(self.package_folder, "lib", "liby.a"), - os.path.join(self.package_folder, "lib", "y.lib")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + if is_msvc(self): + rename(self, os.path.join(self.package_folder, "lib", "liby.a"), + os.path.join(self.package_folder, "lib", "y.lib")) def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libs = ["y"] + self.cpp_info.resdirs = ["res"] - self.output.info("Setting BISON_ROOT environment variable: {}".format(self.package_folder)) - self.env_info.BISON_ROOT = self.package_folder.replace("\\", "/") + bison_root = self.package_folder.replace("\\", "/") + self.buildenv_info.define_path("CONAN_BISON_ROOT", bison_root) - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) - pkgdir = os.path.join(self._datarootdir, "bison") - self.output.info("Setting the BISON_PKGDATADIR environment variable: {}".format(pkgdir)) - self.env_info.BISON_PKGDATADIR = pkgdir + pkgdir = os.path.join(self.package_folder, "res", "bison") + self.buildenv_info.define_path("BISON_PKGDATADIR", pkgdir) # yacc is a shell script, so requires a shell (such as bash) - self.user_info.YACC = os.path.join(self.package_folder, "bin", "yacc").replace("\\", "/") + yacc = os.path.join(self.package_folder, "bin", "yacc").replace("\\", "/") + self.conf_info.define("user.bison:yacc", yacc) + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.CONAN_BISON_ROOT = self.package_folder.replace("\\", "/") + self.env_info.BISON_PKGDATADIR = pkgdir + self.user_info.YACC = yacc diff --git a/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch b/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch index 3e04d6ae94ee52..56aeeebbeb7df8 100644 --- a/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch +++ b/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch @@ -7,11 +7,11 @@ but aren't to avoid a dependency on a already-built flex and bison. #include #include #include /* fileno */ -+#if !defined(_WINDOWS) ++#ifndef _WIN32 #include +#endif #include /* fstat */ -+#if !defined(_WINDOWS) ++#ifndef _WIN32 #include +#endif diff --git a/recipes/bison/all/test_package/CMakeLists.txt b/recipes/bison/all/test_package/CMakeLists.txt index b2e4203587321d..569311ba35a62b 100644 --- a/recipes/bison/all/test_package/CMakeLists.txt +++ b/recipes/bison/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.0) -project(test_package) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() - -find_package(BISON) +find_package(BISON REQUIRED) set(BISON_VARS BISON_FOUND @@ -19,13 +16,5 @@ foreach(BISON_VAR ${BISON_VARS}) endif() endforeach() -bison_target(Bison_McParser - mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp" -) - -add_library(McParser STATIC - "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp" -) -add_executable(${PROJECT_NAME} test_package.cpp) -set_propertY(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +bison_target(McParser mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp") +add_library(${PROJECT_NAME} STATIC ${BISON_McParser_OUTPUTS}) diff --git a/recipes/bison/all/test_package/conanfile.py b/recipes/bison/all/test_package/conanfile.py index 82220fffff8660..dd177dd578622b 100644 --- a/recipes/bison/all/test_package/conanfile.py +++ b/recipes/bison/all/test_package/conanfile.py @@ -1,38 +1,38 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.microsoft import unix_path import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + win_bash = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + cmake_layout(self) + 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": + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() @property def _mc_parser_source(self): return os.path.join(self.source_folder, "mc_parser.yy") - def build(self): - if not tools.cross_building(self, skip_x64_x86=True): - # verify bison may run - self.run("bison --version", run_environment=True) - # verify yacc may run - self.run("yacc --version", run_environment=True, win_bash=tools.os_info.is_windows) - # verify bison may preprocess something - self.run("bison -d {}".format(self._mc_parser_source), run_environment=True) - - # verify CMake integration - 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) + self.run("bison --version") + self.run("yacc --version") + self.run(f"bison -d {unix_path(self, self._mc_parser_source)}") diff --git a/recipes/bison/all/test_package/test_package.cpp b/recipes/bison/all/test_package/test_package.cpp deleted file mode 100644 index b00966a007909e..00000000000000 --- a/recipes/bison/all/test_package/test_package.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -extern "C" -{ - int yyerror(const char *); -} - -int main() -{ - char error[] = "conan-center-index"; - std::cout << yyerror(error) << std::endl; - return 0; -} diff --git a/recipes/bison/all/test_v1_package/CMakeLists.txt b/recipes/bison/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/bison/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/bison/all/test_v1_package/conanfile.py b/recipes/bison/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..99ccbfcae8665d --- /dev/null +++ b/recipes/bison/all/test_v1_package/conanfile.py @@ -0,0 +1,31 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def _mc_parser_source(self): + return os.path.join(self.source_folder, os.pardir, "test_package", "mc_parser.yy") + + def test(self): + self.run("bison --version") + self.run("yacc --version", win_bash=tools.os_info.is_windows) + self.run(f"bison -d {self._mc_parser_source}") diff --git a/recipes/bitserializer/all/conandata.yml b/recipes/bitserializer/all/conandata.yml index 10234ee527ae71..9b5b2264c84bba 100644 --- a/recipes/bitserializer/all/conandata.yml +++ b/recipes/bitserializer/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.50": + url: "https://bitbucket.com/Pavel_Kisliak/BitSerializer/get/0.50.tar.gz" + sha256: "dc000b6516db60337d5dd56fb1b60e29ce700bd2e6f4e609ca548b84d1f1dcee" "0.44": url: "https://bitbucket.com/Pavel_Kisliak/BitSerializer/get/0.44.tar.gz" sha256: "39ee0b038c9f38a012f96913c9738a68514d2e923431fbd83ddf3f454e02bc6c" diff --git a/recipes/bitserializer/all/conanfile.py b/recipes/bitserializer/all/conanfile.py index cf88fcf1ae05c6..de0b409d6488ad 100644 --- a/recipes/bitserializer/all/conanfile.py +++ b/recipes/bitserializer/all/conanfile.py @@ -1,9 +1,10 @@ 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.files import copy, get, rmdir, replace_in_file from conan.tools.layout import basic_layout from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain import os required_conan_version = ">=1.50.0" @@ -11,8 +12,8 @@ class BitserializerConan(ConanFile): name = "bitserializer" - description = "C++ 17 library for serialization to multiple output formats (JSON, XML, YAML)" - topics = ("serialization", "json", "xml") + description = "C++ 17 library for serialization to multiple output formats (JSON, XML, YAML, CSV)" + topics = ("serialization", "json", "xml", "yaml", "csv") url = "https://github.com/conan-io/conan-center-index" homepage = "https://bitbucket.org/Pavel_Kisliak/bitserializer" license = "MIT" @@ -22,11 +23,15 @@ class BitserializerConan(ConanFile): "with_cpprestsdk": [True, False], "with_rapidjson": [True, False], "with_pugixml": [True, False], + "with_rapidyaml": [True, False], + "with_csv": [True, False], } default_options = { "with_cpprestsdk": False, "with_rapidjson": False, "with_pugixml": False, + "with_rapidyaml": False, + "with_csv": False, } no_copy_source = True @@ -45,6 +50,15 @@ def _compilers_minimum_version(self): "apple-clang": "12", } + @property + def _is_header_only(self): + # All components of library are header-only except csv-archive + return not self.options.with_csv + + def _patch_sources(self): + # Remove 'ryml' subdirectory from #include + replace_in_file(self, os.path.join(self.source_folder, "include/bitserializer/rapidyaml_archive.h"), "#include :BitSerializer::cpprestjson-archive> $<$:BitSerializer::rapidjson-archive> - $<$:BitSerializer::pugixml-archive>) + $<$:BitSerializer::pugixml-archive> + $<$:BitSerializer::rapidyaml-archive> + $<$:BitSerializer::csv-archive> +) target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:"WITH_CPPRESTSDK"> $<$:"WITH_RAPIDJSON"> - $<$:"WITH_PUGIXML">) + $<$:"WITH_PUGIXML"> + $<$:"WITH_RAPIDYAML"> + $<$:"WITH_CSV"> +) diff --git a/recipes/bitserializer/all/test_package/conanfile.py b/recipes/bitserializer/all/test_package/conanfile.py index 4076e2a9b6b6d8..b681a2801a2f57 100644 --- a/recipes/bitserializer/all/test_package/conanfile.py +++ b/recipes/bitserializer/all/test_package/conanfile.py @@ -17,9 +17,12 @@ def requirements(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["WITH_CPPRESTSDK"] = self.dependencies["bitserializer"].options.with_cpprestsdk - tc.variables["WITH_RAPIDJSON"] = self.dependencies["bitserializer"].options.with_rapidjson - tc.variables["WITH_PUGIXML"] = self.dependencies["bitserializer"].options.with_pugixml + bitserializerOptions = self.dependencies[self.tested_reference_str].options + tc.variables["WITH_CPPRESTSDK"] = bitserializerOptions.with_cpprestsdk + tc.variables["WITH_RAPIDJSON"] = bitserializerOptions.with_rapidjson + tc.variables["WITH_PUGIXML"] = bitserializerOptions.with_pugixml + tc.variables["WITH_RAPIDYAML"] = bitserializerOptions.with_rapidyaml + tc.variables["WITH_CSV"] = bitserializerOptions.with_csv tc.generate() def build(self): diff --git a/recipes/bitserializer/all/test_package/test_package.cpp b/recipes/bitserializer/all/test_package/test_package.cpp index 643c308b932d27..aba11c808ba190 100644 --- a/recipes/bitserializer/all/test_package/test_package.cpp +++ b/recipes/bitserializer/all/test_package/test_package.cpp @@ -12,6 +12,12 @@ #ifdef WITH_PUGIXML #include #endif +#ifdef WITH_RAPIDYAML +#include +#endif +#ifdef WITH_CSV +#include +#endif #include #include @@ -41,7 +47,7 @@ void TestArchive(const std::string& message) BitSerializer::SerializationOptions serializationOptions; serializationOptions.streamOptions.writeBom = false; - CTest testObj(message); + CTest testObj[1] = { message }; std::stringstream outputStream; BitSerializer::SaveObject(testObj, outputStream, serializationOptions); std::cout << outputStream.str() << std::endl; @@ -66,4 +72,10 @@ int main() { #ifdef WITH_PUGIXML TestArchive("Implementation based on pugixml"); #endif +#ifdef WITH_RAPIDYAML + TestArchive("Implementation based on RapidYaml"); +#endif +#ifdef WITH_CSV + TestArchive("CSV archive (built-in implementation)"); +#endif } diff --git a/recipes/bitserializer/all/test_v1_package/conanfile.py b/recipes/bitserializer/all/test_v1_package/conanfile.py index 2aef261cc57120..36f5974e9b2f14 100644 --- a/recipes/bitserializer/all/test_v1_package/conanfile.py +++ b/recipes/bitserializer/all/test_v1_package/conanfile.py @@ -11,6 +11,8 @@ def build(self): cmake.definitions["WITH_CPPRESTSDK"] = self.options["bitserializer"].with_cpprestsdk cmake.definitions["WITH_RAPIDJSON"] = self.options["bitserializer"].with_rapidjson cmake.definitions["WITH_PUGIXML"] = self.options["bitserializer"].with_pugixml + cmake.definitions["WITH_RAPIDYAML"] = self.options["bitserializer"].with_rapidyaml + cmake.definitions["WITH_CSV"] = self.options["bitserializer"].with_csv cmake.configure() cmake.build() diff --git a/recipes/bitserializer/config.yml b/recipes/bitserializer/config.yml index 3b57b2ed72ef13..31b18058643087 100644 --- a/recipes/bitserializer/config.yml +++ b/recipes/bitserializer/config.yml @@ -1,4 +1,6 @@ versions: + "0.50": + folder: "all" "0.44": folder: "all" "0.10": diff --git a/recipes/boost/all/conandata.yml b/recipes/boost/all/conandata.yml index 08d02a20d2367e..429c6cd2f589d0 100644 --- a/recipes/boost/all/conandata.yml +++ b/recipes/boost/all/conandata.yml @@ -1,70 +1,70 @@ sources: + "1.81.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.81.0/boost_1_81_0.tar.bz2" + sha256: "71feeed900fbccca04a3b4f2f84a7c217186f28a940ed8b7ed4725986baf99fa" "1.80.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.80.0/boost_1_80_0.tar.bz2" - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.80.0/boost_1_80_0.tar.bz2" sha256: "1e19565d82e43bc59209a168f5ac899d3ba471d55c7610c677d4ccf2c9c500c0" "1.79.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.bz2" - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.bz2" sha256: "475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39" "1.78.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.bz2" - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.bz2" sha256: "8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc" "1.77.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.77.0/boost_1_77_0.tar.bz2" - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.77.0/boost_1_77_0.tar.bz2" sha256: "fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854" "1.76.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2" - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2" sha256: "f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41" "1.75.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.75.0/boost_1_75_0.tar.bz2" - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.75.0/boost_1_75_0.tar.bz2" sha256: "953db31e016db7bb207f11432bef7df100516eeb746843fa0486a222e3fd49cb" "1.74.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.74.0/boost_1_74_0.tar.bz2" - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.74.0/boost_1_74_0.tar.bz2" sha256: "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1" "1.73.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.73.0/boost_1_73_0.tar.bz2", - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.73.0/boost_1_73_0.tar.bz2" sha256: "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402" "1.72.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2", - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2" sha256: "59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722" "1.71.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2", - ] + url: "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2" sha256: "d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee" "1.70.0": - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.bz2", - ] + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.bz2" sha256: "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778" patches: + "1.81.0": + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.81.0-locale-fail-on-missing-backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" "1.80.0": - patch_file: "patches/1.80.0-locale-fail-on-missing-backend.patch" patch_description: "Fails the build when there is no iconv backend" @@ -90,98 +90,269 @@ patches: patch_source: "https://github.com/boostorg/filesystem/issues/250" "1.79.0": - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.77.0-fiber-mingw.patch" + patch_description: "fix layout=versioned for clang@Macos + mingw@Windows" + patch_type: "conan" - patch_file: "patches/1.79.0-0001-json-array-erase-relocate.patch" + patch_description: "json::array::erase(it) seg fault on linux" + patch_type: "official" + patch_source: "https://github.com/boostorg/json/issues/692" - patch_file: "patches/1.79.0-smart_ptr_cw_ppc_msync.patch" + patch_description: "Use msync for PowerPC architectures" + patch_type: "portability" - patch_file: "patches/1.79.0-geometry_no_rtti.patch" + patch_description: "Fix access specifier preventing use of experimental iterators. Allow more granular control over enabled experimental features." patch_type: "portability" patch_source: "https://github.com/boostorg/geometry/discussions/1041" "1.78.0": - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.77.0-fiber-mingw.patch" + patch_description: "fix layout=versioned for clang@Macos + mingw@Windows" + patch_type: "conan" - patch_file: "patches/1.78.0-b2-fix-install.patch" + patch_description: "Don't skip install targets if there's no in ureqs" + patch_type: "official" + patch_source: "https://github.com/boostorg/build/pull/113" "1.77.0": - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.77.0-fiber-mingw.patch" + patch_description: "fix layout=versioned for clang@Macos + mingw@Windows" + patch_type: "conan" - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" "1.76.0": - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" "1.75.0": - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix_since_1_74.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" "1.74.0": - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix_since_1_74.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" "1.73.0": - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" "1.72.0": - patch_file: "patches/bcp_namespace_issues_1_72.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/solaris_pthread_data.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/0001-revert-cease-dependence-on-range.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_log_filesystem_no_deprecated_1_72.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" "1.71.0": - patch_file: "patches/bcp_namespace_issues_1_71.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/solaris_pthread_data.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-contract-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" "1.70.0": - patch_file: "patches/0001-beast-fix-moved-from-executor.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/bcp_namespace_issues_1_70.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/solaris_pthread_data.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-contract-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.70.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" diff --git a/recipes/boost/all/conanfile.py b/recipes/boost/all/conanfile.py index babdee07e5f301..4f9bb32f663189 100644 --- a/recipes/boost/all/conanfile.py +++ b/recipes/boost/all/conanfile.py @@ -57,6 +57,7 @@ "thread", "timer", "type_erasure", + "url", "wave", ) @@ -234,10 +235,6 @@ def _settings_build(self): def _is_clang_cl(self): return self.settings.os == "Windows" and self.settings.compiler == "clang" - @property - def _zip_bzip2_requires_needed(self): - return not self.options.without_iostreams and not self.options.header_only - @property def _python_executable(self): """ @@ -275,6 +272,7 @@ def config_options(self): self.options.without_fiber = True self.options.without_nowide = True self.options.without_json = True + self.options.without_url = True else: version_cxx11_standard_json = self._min_compiler_version_default_cxx11 if version_cxx11_standard_json: @@ -282,10 +280,12 @@ def config_options(self): self.options.without_fiber = True self.options.without_json = True self.options.without_nowide = True + self.options.without_url = True else: self.options.without_fiber = True self.options.without_json = True self.options.without_nowide = True + self.options.without_url = True # iconv is off by default on Windows and Solaris if self._is_windows_platform or self.settings.os == "SunOS": @@ -321,7 +321,7 @@ def disable_math(): else: min_compiler_version = self._min_compiler_version_default_cxx11 if min_compiler_version is None: - self.output.warn("Assuming the compiler supports c++11 by default") + self.output.warning("Assuming the compiler supports c++11 by default") elif Version(self.settings.compiler.version) < min_compiler_version: disable_math() @@ -343,10 +343,32 @@ def disable_wave(): else: min_compiler_version = self._min_compiler_version_default_cxx11 if min_compiler_version is None: - self.output.warn("Assuming the compiler supports c++11 by default") + self.output.warning("Assuming the compiler supports c++11 by default") elif Version(self.settings.compiler.version) < min_compiler_version: disable_wave() + if Version(self.version) >= "1.81.0": + # Starting from 1.81.0, Boost.Locale requires a c++11 capable compiler + # ==> disable it by default for older compilers or c++ standards + + def disable_locale(): + super_modules = self._all_super_modules("locale") + for smod in super_modules: + try: + setattr(self.options, f"without_{smod}", True) + except ConanException: + pass + + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 11): + disable_locale() + else: + min_compiler_version = self._min_compiler_version_default_cxx11 + if min_compiler_version is None: + self.output.warning("Assuming the compiler supports c++11 by default") + elif Version(self.settings.compiler.version) < min_compiler_version: + disable_locale() + @property def _configure_options(self): return self._dependencies["configure_options"] @@ -374,7 +396,7 @@ def configure(self): self.options.rm_safe("fPIC") if self.options.i18n_backend != "deprecated": - self.output.warn("i18n_backend option is deprecated, do not use anymore.") + self.output.warning("i18n_backend option is deprecated, do not use anymore.") if self.options.i18n_backend == "iconv": self.options.i18n_backend_iconv = "libiconv" self.options.i18n_backend_icu = False @@ -412,11 +434,13 @@ def layout(self): @property def _cxx11_boost_libraries(self): - libraries = ["fiber", "json", "nowide"] + libraries = ["fiber", "json", "nowide", "url"] if Version(self.version) >= "1.76.0": libraries.append("math") if Version(self.version) >= "1.79.0": libraries.append("wave") + if Version(self.version) >= "1.81.0": + libraries.append("locale") libraries.sort() return filter(lambda library: f"without_{library}" in self.options, libraries) @@ -515,7 +539,7 @@ def requirements(self): if self._with_zstd: self.requires("zstd/1.5.2") if self._with_stacktrace_backtrace: - self.requires("libbacktrace/cci.20210118") + self.requires("libbacktrace/cci.20210118", transitive_headers=True) if self._with_icu: self.requires("icu/72.1") @@ -534,12 +558,10 @@ def package_id(self): del self.info.options.python_executable # PATH to the interpreter is not important, only version matters if self.info.options.without_python: del self.info.options.python_version - else: - self.info.options.python_version = self._python_version def build_requirements(self): if not self.options.header_only: - self.tool_requires("b2/4.9.2") + self.tool_requires("b2/4.9.3") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -565,7 +587,7 @@ def _run_python_script(self, script): command = f'"{self._python_executable}" -c "{script}"' self.output.info(f"running {command}") try: - self.run(command=command, output=output) + self.run(command, output, scope="run") except ConanException: self.output.info("(failed)") return None @@ -617,7 +639,7 @@ def _get_python_var(self, name): NOTE: distutils is deprecated and breaks the recipe since Python 3.10 """ - python_version_parts = self.info.options.python_version.split('.') + python_version_parts = str(self.info.options.python_version).split('.') python_major = int(python_version_parts[0]) python_minor = int(python_version_parts[1]) if(python_major >= 3 and python_minor >= 10): @@ -699,9 +721,10 @@ def _python_library_dir(self): multiarch = self._get_python_var("MULTIARCH") masd = self._get_python_var("multiarchsubdir") with_dyld = self._get_python_var("WITH_DYLD") - if libdir and multiarch and masd: + if libdir and multiarch and masd and not libdir.endswith(masd): if masd.startswith(os.sep): masd = masd[len(os.sep):] + self.output.warning(f"Python libdir candidate thingy: {libdir}") libdir = os.path.join(libdir, masd) if not libdir: @@ -746,7 +769,7 @@ def _clean(self): ] for d in clean_dirs: if os.path.isdir(d): - self.output.warn(f"removing '{d}'") + self.output.warning(f"removing '{d}'") shutil.rmtree(d) @property @@ -771,7 +794,7 @@ def _build_bcp(self): with chdir(self, folder): command = f"{self._b2_exe} -j{build_jobs(self)} --abbreviate-paths toolset={self._toolset}" command += f" -d{self.options.debug_level}" - self.output.warn(command) + self.output.warning(command) self.run(command) def _run_bcp(self): @@ -789,7 +812,7 @@ def _run_bcp(self): libraries.add(d) libraries = " ".join(libraries) command = f"{self._bcp_exe} {namespace} {alias} {boostdir} {libraries} {self._bcp_dir}" - self.output.warn(command) + self.output.warning(command) self.run(command) def build(self): @@ -822,7 +845,7 @@ def build(self): strict=False) if self.options.header_only: - self.output.warn("Header only package, skipping build") + self.output.warning("Header only package, skipping build") return self._clean() @@ -831,7 +854,6 @@ def build(self): self._build_bcp() self._run_bcp() - # Help locating bzip2 and zlib self._create_user_config_jam(self._boost_build_dir) # JOIN ALL FLAGS @@ -840,7 +862,7 @@ def build(self): # -d2 is to print more debug info and avoid travis timing out without output sources = os.path.join(self.source_folder, self._bcp_dir) if self._use_bcp else self.source_folder full_command += f' --debug-configuration --build-dir="{self.build_folder}"' - self.output.warn(full_command) + self.output.warning(full_command) # If sending a user-specified toolset to B2, setting the vcvars # interferes with the compiler selection. @@ -978,7 +1000,7 @@ def _build_flags(self): flags.append("--disable-iconv") def add_defines(library): - for define in self.dependencies[library].cpp_info.defines: + for define in self.dependencies[library].cpp_info.aggregated_components().defines: flags.append(f"define={define}") if self._with_zlib: @@ -1084,10 +1106,11 @@ def add_defines(library): flags.append(f"-sICU_PATH={self.dependencies['icu'].package_folder}") if not self.dependencies["icu"].options.shared: # Using ICU_OPTS to pass ICU system libraries is not possible due to Boost.Regex disallowing it. + icu_system_libs = self.dependencies["icu"].cpp_info.aggregated_components().system_libs if is_msvc(self): - icu_ldflags = " ".join(f"{l}.lib" for l in self.dependencies["icu"].cpp_info.system_libs) + icu_ldflags = " ".join(f"{l}.lib" for l in icu_system_libs) else: - icu_ldflags = " ".join(f"-l{l}" for l in self.dependencies["icu"].cpp_info.system_libs) + icu_ldflags = " ".join(f"-l{l}" for l in icu_system_libs) link_flags.append(icu_ldflags) link_flags = f'linkflags="{" ".join(link_flags)}"' @@ -1136,14 +1159,14 @@ def _build_cross_flags(self): elif arch.startswith("mips"): pass else: - self.output.warn(f"Unable to detect the appropriate ABI for {arch} architecture.") + self.output.warning(f"Unable to detect the appropriate ABI for {arch} architecture.") self.output.info(f"Cross building flags: {flags}") return flags @property def _ar(self): - ar = self.buildenv.vars(self).get("AR") + ar = VirtualBuildEnv(self).vars().get("AR") if ar: return ar if is_apple_os(self) and self.settings.compiler == "apple-clang": @@ -1152,7 +1175,7 @@ def _ar(self): @property def _ranlib(self): - ranlib = self.buildenv.vars(self).get("RANLIB") + ranlib = VirtualBuildEnv(self).vars().get("RANLIB") if ranlib: return ranlib if is_apple_os(self) and self.settings.compiler == "apple-clang": @@ -1161,7 +1184,8 @@ def _ranlib(self): @property def _cxx(self): - cxx = self.buildenv.vars(self).get("CXX") + compilers_by_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + cxx = compilers_by_conf.get("cpp") or VirtualBuildEnv(self).vars().get("CXX") if cxx: return cxx if is_apple_os(self) and self.settings.compiler == "apple-clang": @@ -1175,32 +1199,31 @@ def _cxx(self): return "" def _create_user_config_jam(self, folder): - """To help locating the zlib and bzip2 deps""" - self.output.warn("Patching user-config.jam") + self.output.warning("Patching user-config.jam") + + def create_library_config(deps_name, name): + aggregated_cpp_info = self.dependencies[deps_name].cpp_info.aggregated_components() + includedir = aggregated_cpp_info.includedirs[0].replace("\\", "/") + includedir = f"\"{includedir}\"" + libdir = aggregated_cpp_info.libdirs[0].replace("\\", "/") + libdir = f"\"{libdir}\"" + lib = aggregated_cpp_info.libs[0] + version = self.dependencies[deps_name].ref.version + return f"\nusing {name} : {version} : " \ + f"{includedir} " \ + f"{libdir} " \ + f"{lib} ;" contents = "" - if self._zip_bzip2_requires_needed: - def create_library_config(deps_name, name): - includedir = self.dependencies[deps_name].cpp_info.includedirs[0].replace("\\", "/") - includedir = f"\"{includedir}\"" - libdir = self.dependencies[deps_name].cpp_info.libdirs[0].replace("\\", "/") - libdir = f"\"{libdir}\"" - lib = self.dependencies[deps_name].cpp_info.libs[0] - version = self.dependencies[deps_name].ref.version - return f"\nusing {name} : {version} : " \ - f"{includedir} " \ - f"{libdir} " \ - f"{lib} ;" - - contents = "" - if self._with_zlib: - contents += create_library_config("zlib", "zlib") - if self._with_bzip2: - contents += create_library_config("bzip2", "bzip2") - if self._with_lzma: - contents += create_library_config("xz_utils", "lzma") - if self._with_zstd: - contents += create_library_config("zstd", "zstd") + + if self._with_zlib: + contents += create_library_config("zlib", "zlib") + if self._with_bzip2: + contents += create_library_config("bzip2", "bzip2") + if self._with_lzma: + contents += create_library_config("xz_utils", "lzma") + if self._with_zstd: + contents += create_library_config("zstd", "zstd") if not self.options.without_python: # https://www.boost.org/doc/libs/1_70_0/libs/python/doc/html/building/configuring_boost_build.html @@ -1214,10 +1237,8 @@ def create_library_config(deps_name, name): contents += f'\nusing "{self._toolset}" : {self._toolset_version} : ' cxx_fwd_slahes = self._cxx.replace("\\", "/") - if is_msvc(self): - contents += f' "{cxx_fwd_slahes}"' - else: - contents += f' {cxx_fwd_slahes}' + if cxx_fwd_slahes: + contents += f" \"{cxx_fwd_slahes}\"" if is_apple_os(self): if self.settings.compiler == "apple-clang": @@ -1234,13 +1255,15 @@ def create_library_config(deps_name, name): contents += f'"{ranlib_path}" ' cxxflags = " ".join(self.conf.get("tools.build:cxxflags", default=[], check_type=list)) + " " cflags = " ".join(self.conf.get("tools.build:cflags", default=[], check_type=list)) + " " - cppflags = self.buildenv.vars(self).get("CPPFLAGS", "") + " " + buildenv_vars = VirtualBuildEnv(self).vars() + cppflags = buildenv_vars.get("CPPFLAGS", "") + " " ldflags = " ".join(self.conf.get("tools.build:sharedlinkflags", default=[], check_type=list)) + " " - asflags = self.buildenv.vars(self).get("ASFLAGS", "") + " " + asflags = buildenv_vars.get("ASFLAGS", "") + " " if self._with_stacktrace_backtrace: - cppflags += " ".join(f"-I{p}" for p in self.dependencies["libbacktrace"].cpp_info.includedirs) + " " - ldflags += " ".join(f"-L{p}" for p in self.dependencies["libbacktrace"].cpp_info.libdirs) + " " + backtrace_aggregated_cpp_info = self.dependencies["libbacktrace"].cpp_info.aggregated_components() + cppflags += " ".join(f"-I{p}" for p in backtrace_aggregated_cpp_info.includedirs) + " " + ldflags += " ".join(f"-L{p}" for p in backtrace_aggregated_cpp_info.libdirs) + " " if cxxflags.strip(): contents += f'"{cxxflags.strip()}" ' @@ -1258,7 +1281,7 @@ def create_library_config(deps_name, name): contents += " ;" - self.output.warn(contents) + self.output.warning(contents) filename = f"{folder}/user-config.jam" save(self, filename, contents) @@ -1368,7 +1391,7 @@ def _create_emscripten_libs(self): self.package_folder, "lib" ) if not os.path.exists(staged_libs): - self.output.warn(f"Lib folder doesn't exist, can't collect libraries: {staged_libs}") + self.output.warning(f"Lib folder doesn't exist, can't collect libraries: {staged_libs}") return for bc_file in os.listdir(staged_libs): if bc_file.startswith("lib") and bc_file.endswith(".bc"): @@ -1623,11 +1646,15 @@ def filter_transform_module_libraries(names): self.cpp_info.components[module].names["cmake_find_package_multi"] = module self.cpp_info.components[module].names["pkg_config"] = f"boost_{module}" + # extract list of names of direct host dependencies to check for dependencies + # of components that exist in other packages + dependencies = [d.ref.name for d, _ in self.dependencies.direct_host.items()] + for requirement in self._dependencies.get("requirements", {}).get(module, []): if self.options.get_safe(requirement, None) == False: continue conan_requirement = self._option_to_conan_requirement(requirement) - if conan_requirement not in self.requires: + if conan_requirement not in dependencies: continue if module == "locale" and requirement in ("icu", "iconv"): if requirement == "icu" and not self._with_icu: @@ -1637,7 +1664,7 @@ def filter_transform_module_libraries(names): self.cpp_info.components[module].requires.append(f"{conan_requirement}::{conan_requirement}") for incomplete_component in incomplete_components: - self.output.warn(f"Boost component '{incomplete_component}' is missing libraries. Try building boost with '-o boost:without_{incomplete_component}'. (Option is not guaranteed to exist)") + self.output.warning(f"Boost component '{incomplete_component}' is missing libraries. Try building boost with '-o boost:without_{incomplete_component}'. (Option is not guaranteed to exist)") non_used = all_detected_libraries.difference(all_expected_libraries) if non_used: @@ -1712,4 +1739,6 @@ def filter_transform_module_libraries(names): self.cpp_info.components["headers"].defines.append("BOOST_SP_USE_SPINLOCK") else: self.cpp_info.components["headers"].defines.extend(["BOOST_AC_DISABLE_THREADS", "BOOST_SP_DISABLE_THREADS"]) + #TODO: remove in the future, user_info deprecated in conan2, but kept for compatibility while recipe is cross-compatible. self.user_info.stacktrace_addr2line_available = self._stacktrace_addr2line_available + self.conf_info.define("user.boost:stacktrace_addr2line_available", self._stacktrace_addr2line_available) diff --git a/recipes/boost/all/dependencies/dependencies-1.81.0.yml b/recipes/boost/all/dependencies/dependencies-1.81.0.yml new file mode 100644 index 00000000000000..838c68bc7e4324 --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.81.0.yml @@ -0,0 +1,280 @@ +configure_options: +- atomic +- chrono +- container +- context +- contract +- coroutine +- date_time +- exception +- fiber +- filesystem +- graph +- graph_parallel +- iostreams +- json +- locale +- log +- math +- mpi +- nowide +- program_options +- python +- random +- regex +- serialization +- stacktrace +- system +- test +- thread +- timer +- type_erasure +- url +- wave +dependencies: + atomic: [] + chrono: + - system + container: [] + context: [] + contract: + - exception + - thread + coroutine: + - context + - exception + - system + date_time: [] + exception: [] + fiber: + - context + - filesystem + fiber_numa: + - fiber + filesystem: + - atomic + - system + graph: + - math + - random + - regex + - serialization + graph_parallel: + - filesystem + - graph + - mpi + - random + - serialization + iostreams: + - random + - regex + json: + - container + - system + locale: + - thread + log: + - atomic + - container + - date_time + - exception + - filesystem + - random + - regex + - system + - thread + log_setup: + - log + math: [] + math_c99: + - math + math_c99f: + - math + math_c99l: + - math + math_tr1: + - math + math_tr1f: + - math + math_tr1l: + - math + mpi: + - graph + - serialization + mpi_python: + - mpi + - python + nowide: + - filesystem + numpy: + - python + prg_exec_monitor: + - test + program_options: [] + python: [] + random: + - system + regex: [] + serialization: [] + stacktrace: [] + stacktrace_addr2line: + - stacktrace + stacktrace_backtrace: + - stacktrace + stacktrace_basic: + - stacktrace + stacktrace_noop: + - stacktrace + stacktrace_windbg: + - stacktrace + stacktrace_windbg_cached: + - stacktrace + system: [] + test: + - exception + test_exec_monitor: + - test + thread: + - atomic + - chrono + - container + - date_time + - exception + - system + timer: + - chrono + - system + type_erasure: + - thread + unit_test_framework: + - prg_exec_monitor + - test + - test_exec_monitor + url: + - system + wave: + - filesystem + - serialization + wserialization: + - serialization +libs: + atomic: + - boost_atomic + chrono: + - boost_chrono + container: + - boost_container + context: + - boost_context + contract: + - boost_contract + coroutine: + - boost_coroutine + date_time: + - boost_date_time + exception: + - boost_exception + fiber: + - boost_fiber + fiber_numa: + - boost_fiber_numa + filesystem: + - boost_filesystem + graph: + - boost_graph + graph_parallel: + - boost_graph_parallel + iostreams: + - boost_iostreams + json: + - boost_json + locale: + - boost_locale + log: + - boost_log + log_setup: + - boost_log_setup + math: [] + math_c99: + - boost_math_c99 + math_c99f: + - boost_math_c99f + math_c99l: + - boost_math_c99l + math_tr1: + - boost_math_tr1 + math_tr1f: + - boost_math_tr1f + math_tr1l: + - boost_math_tr1l + mpi: + - boost_mpi + mpi_python: + - boost_mpi_python + nowide: + - boost_nowide + numpy: + - boost_numpy{py_major}{py_minor} + prg_exec_monitor: + - boost_prg_exec_monitor + program_options: + - boost_program_options + python: + - boost_python{py_major}{py_minor} + random: + - boost_random + regex: + - boost_regex + serialization: + - boost_serialization + stacktrace: [] + stacktrace_addr2line: + - boost_stacktrace_addr2line + stacktrace_backtrace: + - boost_stacktrace_backtrace + stacktrace_basic: + - boost_stacktrace_basic + stacktrace_noop: + - boost_stacktrace_noop + stacktrace_windbg: + - boost_stacktrace_windbg + stacktrace_windbg_cached: + - boost_stacktrace_windbg_cached + system: + - boost_system + test: [] + test_exec_monitor: + - boost_test_exec_monitor + thread: + - boost_thread + timer: + - boost_timer + type_erasure: + - boost_type_erasure + unit_test_framework: + - boost_unit_test_framework + url: + - boost_url + wave: + - boost_wave + wserialization: + - boost_wserialization +requirements: + iostreams: + - bzip2 + - lzma + - zlib + - zstd + locale: + - iconv + - icu + python: + - python + regex: + - icu + stacktrace: + - backtrace +static_only: +- boost_exception +- boost_test_exec_monitor +version: 1.81.0 diff --git a/recipes/boost/all/patches/1.81.0-locale-fail-on-missing-backend.patch b/recipes/boost/all/patches/1.81.0-locale-fail-on-missing-backend.patch new file mode 100644 index 00000000000000..80b22dd54b0e12 --- /dev/null +++ b/recipes/boost/all/patches/1.81.0-locale-fail-on-missing-backend.patch @@ -0,0 +1,12 @@ +diff --git a/libs/locale/build/Jamfile.v2 b/libs/locale/build/Jamfile.v2 +index f1321db3..36899cdc 100644 +--- a/libs/locale/build/Jamfile.v2 ++++ b/libs/locale/build/Jamfile.v2 +@@ -22,6 +22,7 @@ project /boost/locale + # Features + + feature.feature boost.locale.iconv : on off : optional propagated ; ++feature.feature boost.locale.iconv.lib : libc libiconv : optional propagated ; + feature.feature boost.locale.icu : on off : optional propagated ; + feature.feature boost.locale.posix : on off : optional propagated ; + feature.feature boost.locale.std : on off : optional propagated ; diff --git a/recipes/boost/all/rebuild-dependencies.py b/recipes/boost/all/rebuild-dependencies.py index 0ad4028e797b3f..05a14b8375a058 100755 --- a/recipes/boost/all/rebuild-dependencies.py +++ b/recipes/boost/all/rebuild-dependencies.py @@ -55,6 +55,7 @@ "thread", "timer", "type_erasure", + "url", "wave", ) diff --git a/recipes/boost/all/test_package/CMakeLists.txt b/recipes/boost/all/test_package/CMakeLists.txt index e34607eab169d2..769ce4cdc3ba2d 100644 --- a/recipes/boost/all/test_package/CMakeLists.txt +++ b/recipes/boost/all/test_package/CMakeLists.txt @@ -1,6 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) +enable_testing() + if(BOOST_NAMESPACE) add_definitions("-DBOOST_NAMESPACE=${BOOST_NAMESPACE}") endif() @@ -10,30 +12,35 @@ if(NOT HEADER_ONLY) find_package(Boost COMPONENTS random REQUIRED) add_executable(random_exe random.cpp) target_link_libraries(random_exe PRIVATE Boost::random) + add_test(NAME boost_random COMMAND random_exe) endif() if(WITH_REGEX) find_package(Boost COMPONENTS regex REQUIRED) add_executable(regex_exe regex.cpp) target_link_libraries(regex_exe PRIVATE Boost::regex) + add_test(NAME boost_regex COMMAND regex_exe) endif() if(WITH_TEST) find_package(Boost COMPONENTS unit_test_framework REQUIRED) add_executable(test_exe test.cpp) target_link_libraries(test_exe PRIVATE Boost::unit_test_framework) + add_test(NAME boost_test COMMAND test_exe) endif() if(WITH_COROUTINE) find_package(Boost COMPONENTS coroutine REQUIRED) add_executable(coroutine_exe coroutine.cpp) target_link_libraries(coroutine_exe PRIVATE Boost::coroutine) + add_test(NAME coroutine_test COMMAND coroutine_exe) endif() if(WITH_CHRONO) find_package(Boost COMPONENTS chrono REQUIRED) add_executable(chrono_exe chrono.cpp) target_link_libraries(chrono_exe PRIVATE Boost::chrono) + add_test(NAME chrono_test COMMAND chrono_exe) endif() if(WITH_FIBER) @@ -41,6 +48,7 @@ if(NOT HEADER_ONLY) add_executable(fiber_exe fiber.cpp) target_link_libraries(fiber_exe PRIVATE Boost::fiber) set_property(TARGET fiber_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_fiber COMMAND fiber_exe) endif() if(WITH_JSON) @@ -48,6 +56,7 @@ if(NOT HEADER_ONLY) add_executable(json_exe json.cpp) target_link_libraries(json_exe PRIVATE Boost::json) set_property(TARGET json_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_json COMMAND json_exe) endif() if(WITH_NOWIDE) @@ -55,12 +64,14 @@ if(NOT HEADER_ONLY) add_executable(nowide_exe nowide.cpp) target_link_libraries(nowide_exe PRIVATE Boost::nowide) set_property(TARGET nowide_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_nowide COMMAND nowide_exe ${CMAKE_CURRENT_SOURCE_DIR}/conanfile.py) endif() if(WITH_LOCALE) find_package(Boost COMPONENTS locale REQUIRED) add_executable(locale_exe locale.cpp) target_link_libraries(locale_exe PRIVATE Boost::locale) + add_test(NAME boost_locale COMMAND locale_exe) endif() if(WITH_STACKTRACE_ADDR2LINE) @@ -68,12 +79,14 @@ if(NOT HEADER_ONLY) add_executable(stacktrace_addr2line_exe stacktrace.cpp) target_compile_definitions(stacktrace_addr2line_exe PRIVATE TEST_STACKTRACE_IMPL=1) target_link_libraries(stacktrace_addr2line_exe PRIVATE Boost::stacktrace_addr2line) + add_test(NAME boost_stacktrace_addr2line COMMAND stacktrace_addr2line_exe) endif() if(WITH_STACKTRACE_BACKTRACE) add_executable(stacktrace_backtrace_exe stacktrace.cpp) target_compile_definitions(stacktrace_backtrace_exe PRIVATE TEST_STACKTRACE_IMPL=2) target_link_libraries(stacktrace_backtrace_exe PRIVATE Boost::stacktrace_backtrace) + add_test(NAME boost_stacktrace_backtrace COMMAND stacktrace_backtrace_exe) endif() if(WITH_STACKTRACE) @@ -82,19 +95,23 @@ if(NOT HEADER_ONLY) add_executable(stacktrace_noop_exe stacktrace.cpp) target_compile_definitions(stacktrace_noop_exe PRIVATE TEST_STACKTRACE_IMPL=4) target_link_libraries(stacktrace_noop_exe PRIVATE Boost::stacktrace_noop) + add_test(NAME boost_stacktrace_noop COMMAND stacktrace_noop_exe) if(WIN32) add_executable(stacktrace_windbg_exe stacktrace.cpp) target_compile_definitions(stacktrace_windbg_exe PRIVATE TEST_STACKTRACE_IMPL=5) target_link_libraries(stacktrace_windbg_exe PRIVATE Boost::stacktrace_windbg) + add_test(NAME boost_stacktrace_windbg COMMAND stacktrace_windbg_exe) add_executable(stacktrace_windbg_cached_exe stacktrace.cpp) target_compile_definitions(stacktrace_windbg_cached_exe PRIVATE TEST_STACKTRACE_IMPL=6) target_link_libraries(stacktrace_windbg_cached_exe PRIVATE Boost::stacktrace_windbg_cached) + add_test(NAME boost_stacktrace_windbg_cached COMMAND stacktrace_windbg_cached_exe) else() add_executable(stacktrace_basic_exe stacktrace.cpp) target_compile_definitions(stacktrace_basic_exe PRIVATE TEST_STACKTRACE_IMPL=3) target_link_libraries(stacktrace_basic_exe PRIVATE Boost::stacktrace_basic) + add_test(NAME boost_stacktrace_basic COMMAND stacktrace_basic_exe) endif() endif() @@ -103,22 +120,33 @@ if(NOT HEADER_ONLY) add_library(hello_ext MODULE python.cpp) set_property(TARGET hello_ext PROPERTY PREFIX "") - find_package(PythonInterp REQUIRED) - find_package(PythonLibs REQUIRED) + find_package(Python ${PYTHON_VERSION_TO_SEARCH} COMPONENTS Interpreter Development NumPy REQUIRED) - target_include_directories(hello_ext PRIVATE ${PYTHON_INCLUDE_DIRS}) - target_link_libraries(hello_ext PRIVATE Boost::python${PYTHON_COMPONENT_SUFFIX} ${PYTHON_LIBRARIES}) + target_link_libraries(hello_ext PRIVATE Boost::python Python::Python) if(WIN32) set_target_properties(hello_ext PROPERTIES SUFFIX ".pyd") endif() + add_test(NAME boost_python COMMAND Python::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/python.py") + set_property(TEST boost_python PROPERTY ENVIRONMENT "PYTHONPATH=$") add_executable(numpy_exe numpy.cpp) - target_include_directories(numpy_exe PRIVATE ${PYTHON_INCLUDE_DIRS}) - target_link_libraries(numpy_exe PRIVATE Boost::numpy${PYTHON_COMPONENT_SUFFIX} ${PYTHON_LIBRARIES}) + target_link_libraries(numpy_exe PRIVATE Boost::numpy Python::Python Python::NumPy) + add_test(NAME boost_numpy COMMAND numpy_exe) + set_property(TEST boost_numpy PROPERTY ENVIRONMENT "PYTHONPATH=${Python_SITELIB}") + endif() + + if(WITH_URL) + find_package(Boost COMPONENTS url REQUIRED) + add_executable(url_exe url.cpp) + target_link_libraries(url_exe PRIVATE Boost::url) + set_property(TARGET url_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_url COMMAND url_exe) endif() + endif() # Test header-only target find_package(Boost REQUIRED) add_executable(lambda_exe lambda.cpp) target_link_libraries(lambda_exe PRIVATE Boost::headers) +add_test(NAME boost_boost COMMAND lambda_exe) diff --git a/recipes/boost/all/test_package/conanfile.py b/recipes/boost/all/test_package/conanfile.py index 24064240e3ecc3..66ee2b0e2d2764 100644 --- a/recipes/boost/all/test_package/conanfile.py +++ b/recipes/boost/all/test_package/conanfile.py @@ -2,9 +2,8 @@ from conan.errors import ConanException from conan.tools.build import can_run from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import chdir from conan.tools.scm import Version -from conans import tools as tools_legacy -import os class TestPackageConan(ConanFile): @@ -14,7 +13,7 @@ class TestPackageConan(ConanFile): def _boost_option(self, name, default): try: - return getattr(self.options["boost"], name, default) + return getattr(self.dependencies["boost"].options, name, default) except (AttributeError, ConanException): return default @@ -26,28 +25,29 @@ def requirements(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["HEADER_ONLY"] = self.dependencies["boost"].options.header_only + tc.cache_variables["HEADER_ONLY"] = self.dependencies["boost"].options.header_only if not self.dependencies["boost"].options.header_only: - tc.variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared - tc.variables["WITH_PYTHON"] = not self.dependencies["boost"].options.without_python + tc.cache_variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared + tc.cache_variables["WITH_PYTHON"] = not self.dependencies["boost"].options.without_python if not self.dependencies["boost"].options.without_python: - pyversion = Version(self.dependencies["boost"].options.python_version) - tc.variables["Python_ADDITIONAL_VERSIONS"] = f"{pyversion.major}.{pyversion.minor}" - tc.variables["PYTHON_COMPONENT_SUFFIX"] = f"{pyversion.major}.{pyversion.minor}" - tc.variables["WITH_RANDOM"] = not self.dependencies["boost"].options.without_random - tc.variables["WITH_REGEX"] = not self.dependencies["boost"].options.without_regex - tc.variables["WITH_TEST"] = not self.dependencies["boost"].options.without_test - tc.variables["WITH_COROUTINE"] = not self.dependencies["boost"].options.without_coroutine - tc.variables["WITH_CHRONO"] = not self.dependencies["boost"].options.without_chrono - tc.variables["WITH_FIBER"] = not self.dependencies["boost"].options.without_fiber - tc.variables["WITH_LOCALE"] = not self.dependencies["boost"].options.without_locale - tc.variables["WITH_NOWIDE"] = not self._boost_option("without_nowide", True) - tc.variables["WITH_JSON"] = not self._boost_option("without_json", True) - tc.variables["WITH_STACKTRACE"] = not self.dependencies["boost"].options.without_stacktrace - tc.variables["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available - tc.variables["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) + pyversion = self.dependencies["boost"].options.python_version + tc.cache_variables["PYTHON_VERSION_TO_SEARCH"] = pyversion + tc.cache_variables["Python_EXECUTABLE"] = self.dependencies["boost"].options.python_executable + tc.cache_variables["WITH_RANDOM"] = not self.dependencies["boost"].options.without_random + tc.cache_variables["WITH_REGEX"] = not self.dependencies["boost"].options.without_regex + tc.cache_variables["WITH_TEST"] = not self.dependencies["boost"].options.without_test + tc.cache_variables["WITH_COROUTINE"] = not self.dependencies["boost"].options.without_coroutine + tc.cache_variables["WITH_CHRONO"] = not self.dependencies["boost"].options.without_chrono + tc.cache_variables["WITH_FIBER"] = not self.dependencies["boost"].options.without_fiber + tc.cache_variables["WITH_LOCALE"] = not self.dependencies["boost"].options.without_locale + tc.cache_variables["WITH_NOWIDE"] = not self._boost_option("without_nowide", True) + tc.cache_variables["WITH_JSON"] = not self._boost_option("without_json", True) + tc.cache_variables["WITH_STACKTRACE"] = not self.dependencies["boost"].options.without_stacktrace + tc.cache_variables["WITH_STACKTRACE_ADDR2LINE"] = self.dependencies["boost"].conf_info.get("user.boost:stacktrace_addr2line_available") + tc.cache_variables["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) + tc.cache_variables["WITH_URL"] = not self._boost_option("without_url", True) if self.dependencies["boost"].options.namespace != 'boost' and not self.dependencies["boost"].options.namespace_alias: - tc.variables['BOOST_NAMESPACE'] = self.dependencies["boost"].options.namespace + tc.cache_variables['BOOST_NAMESPACE'] = self.dependencies["boost"].options.namespace tc.generate() def build(self): @@ -58,44 +58,5 @@ def build(self): def test(self): if not can_run(self): return - bindir = self.cpp.build.bindirs[0] - self.run(os.path.join(bindir, "lambda_exe"), env="conanrun") - if self.options["boost"].header_only: - return - if not self.options["boost"].without_random: - self.run(os.path.join(bindir, "random_exe"), env="conanrun") - if not self.options["boost"].without_regex: - self.run(os.path.join(bindir, "regex_exe"), env="conanrun") - if not self.options["boost"].without_test: - self.run(os.path.join(bindir, "test_exe"), env="conanrun") - if not self.options["boost"].without_coroutine: - self.run(os.path.join(bindir, "coroutine_exe"), env="conanrun") - if not self.options["boost"].without_chrono: - self.run(os.path.join(bindir, "chrono_exe"), env="conanrun") - if not self.options["boost"].without_fiber: - self.run(os.path.join(bindir, "fiber_exe"), env="conanrun") - if not self.options["boost"].without_locale: - self.run(os.path.join(bindir, "locale_exe"), env="conanrun") - if not self._boost_option("without_nowide", True): - bin_nowide = os.path.join(bindir, "nowide_exe") - conanfile = os.path.join(self.source_folder, "conanfile.py") - self.run(f"{bin_nowide} {conanfile}", env="conanrun") - if not self._boost_option("without_json", True): - self.run(os.path.join(bindir, "json_exe"), env="conanrun") - if not self.options["boost"].without_python: - with tools_legacy.environment_append({"PYTHONPATH": "bin:lib"}): - python_executable = self.options["boost"].python_executable - python_script = os.path.join(self.source_folder, "python.py") - self.run(f"{python_executable} {python_script}", env="conanrun") - self.run(os.path.join(bindir, "numpy_exe"), env="conanrun") - if not self.options["boost"].without_stacktrace: - self.run(os.path.join(bindir, "stacktrace_noop_exe"), env="conanrun") - if str(self.deps_user_info["boost"].stacktrace_addr2line_available) == "True": - self.run(os.path.join(bindir, "stacktrace_addr2line_exe"), env="conanrun") - if self.settings.os == "Windows": - self.run(os.path.join(bindir, "stacktrace_windbg_exe"), env="conanrun") - self.run(os.path.join(bindir, "stacktrace_windbg_cached_exe"), env="conanrun") - else: - self.run(os.path.join(bindir, "stacktrace_basic_exe"), env="conanrun") - if self._boost_option("with_stacktrace_backtrace", False): - self.run(os.path.join(bindir, "stacktrace_backtrace_exe"), env="conanrun") + with chdir(self, self.folders.build_folder): + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun") diff --git a/recipes/boost/all/test_package/url.cpp b/recipes/boost/all/test_package/url.cpp new file mode 100644 index 00000000000000..dd65390f85c359 --- /dev/null +++ b/recipes/boost/all/test_package/url.cpp @@ -0,0 +1,14 @@ +// +// Copyright (c) 2022 alandefreitas (alandefreitas@gmail.com) +// +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +// + +#include +#include + +int main() { + assert(sizeof(boost::urls::url) > 0); + return 0; +} diff --git a/recipes/boost/all/test_v1_package/CMakeLists.txt b/recipes/boost/all/test_v1_package/CMakeLists.txt index 0d20897301b68b..c23ed5cfe6d983 100644 --- a/recipes/boost/all/test_v1_package/CMakeLists.txt +++ b/recipes/boost/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_v1_package) + +enable_testing() include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) diff --git a/recipes/boost/all/test_v1_package/conanfile.py b/recipes/boost/all/test_v1_package/conanfile.py index 9888310c2d96f8..4bdbddf498bcc7 100644 --- a/recipes/boost/all/test_v1_package/conanfile.py +++ b/recipes/boost/all/test_v1_package/conanfile.py @@ -23,8 +23,8 @@ def build(self): cmake.definitions["WITH_PYTHON"] = not self.options["boost"].without_python if not self.options["boost"].without_python: pyversion = tools.Version(self.options["boost"].python_version) - cmake.definitions["Python_ADDITIONAL_VERSIONS"] = f"{pyversion.major}.{pyversion.minor}" - cmake.definitions["PYTHON_COMPONENT_SUFFIX"] = f"{pyversion.major}.{pyversion.minor}" + cmake.definitions["PYTHON_VERSION_TO_SEARCH"] = pyversion + cmake.definitions["Python_EXECUTABLE"] = self.options["boost"].python_executable cmake.definitions["WITH_RANDOM"] = not self.options["boost"].without_random cmake.definitions["WITH_REGEX"] = not self.options["boost"].without_regex cmake.definitions["WITH_TEST"] = not self.options["boost"].without_test @@ -37,6 +37,7 @@ def build(self): cmake.definitions["WITH_STACKTRACE"] = not self.options["boost"].without_stacktrace cmake.definitions["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available cmake.definitions["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) + cmake.definitions["WITH_URL"] = not self._boost_option("without_url", True) if self.options["boost"].namespace != 'boost' and not self.options["boost"].namespace_alias: cmake.definitions['BOOST_NAMESPACE'] = self.options["boost"].namespace cmake.configure() @@ -47,43 +48,5 @@ def build(self): def test(self): if tools.cross_building(self): return - self.run(os.path.join("bin", "lambda_exe"), run_environment=True) - if self.options["boost"].header_only: - return - if not self.options["boost"].without_random: - self.run(os.path.join("bin", "random_exe"), run_environment=True) - if not self.options["boost"].without_regex: - self.run(os.path.join("bin", "regex_exe"), run_environment=True) - if not self.options["boost"].without_test: - self.run(os.path.join("bin", "test_exe"), run_environment=True) - if not self.options["boost"].without_coroutine: - self.run(os.path.join("bin", "coroutine_exe"), run_environment=True) - if not self.options["boost"].without_chrono: - self.run(os.path.join("bin", "chrono_exe"), run_environment=True) - if not self.options["boost"].without_fiber: - self.run(os.path.join("bin", "fiber_exe"), run_environment=True) - if not self.options["boost"].without_locale: - self.run(os.path.join("bin", "locale_exe"), run_environment=True) - if not self._boost_option("without_nowide", True): - bin_nowide = os.path.join("bin", "nowide_exe") - conanfile = os.path.join(self.source_folder, "conanfile.py") - self.run(f"{bin_nowide} {conanfile}", run_environment=True) - if not self._boost_option("without_json", True): - self.run(os.path.join("bin", "json_exe"), run_environment=True) - if not self.options["boost"].without_python: - with tools.environment_append({"PYTHONPATH": "bin:lib"}): - python_executable = self.options["boost"].python_executable - python_script = os.path.join(self.source_folder, os.pardir, "test_package", "python.py") - self.run(f"{python_executable} {python_script}", run_environment=True) - self.run(os.path.join("bin", "numpy_exe"), run_environment=True) - if not self.options["boost"].without_stacktrace: - self.run(os.path.join("bin", "stacktrace_noop_exe"), run_environment=True) - if str(self.deps_user_info["boost"].stacktrace_addr2line_available) == "True": - self.run(os.path.join("bin", "stacktrace_addr2line_exe"), run_environment=True) - if self.settings.os == "Windows": - self.run(os.path.join("bin", "stacktrace_windbg_exe"), run_environment=True) - self.run(os.path.join("bin", "stacktrace_windbg_cached_exe"), run_environment=True) - else: - self.run(os.path.join("bin", "stacktrace_basic_exe"), run_environment=True) - if self._boost_option("with_stacktrace_backtrace", False): - self.run(os.path.join("bin", "stacktrace_backtrace_exe"), run_environment=True) + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", run_environment=True) + diff --git a/recipes/boost/config.yml b/recipes/boost/config.yml index 060b434b992122..76bc4f6280af1e 100644 --- a/recipes/boost/config.yml +++ b/recipes/boost/config.yml @@ -1,4 +1,6 @@ versions: + "1.81.0": + folder: all "1.80.0": folder: all "1.79.0": diff --git a/recipes/brynet/all/conandata.yml b/recipes/brynet/all/conandata.yml index bee79fc665e46a..032ce7485ea1de 100644 --- a/recipes/brynet/all/conandata.yml +++ b/recipes/brynet/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.12.2": + url: "https://github.com/IronsDu/brynet/archive/v1.12.2.tar.gz" + sha256: "b8b740cae39804d1e7037866046321065856c0ea9f565d26f67aeccc7ccd3d51" "1.12.1": url: "https://github.com/IronsDu/brynet/archive/v1.12.1.tar.gz" sha256: "bcd7ce9b1c3a8dd900f34e50e7ac23013226b3c78b1e22b079d781fbc698122d" diff --git a/recipes/brynet/config.yml b/recipes/brynet/config.yml index 37756b05891746..dd64cd4c4992b0 100644 --- a/recipes/brynet/config.yml +++ b/recipes/brynet/config.yml @@ -1,4 +1,6 @@ versions: + "1.12.2": + folder: all "1.12.1": folder: all "1.11.1": diff --git a/recipes/bx/all/CMakeLists.txt b/recipes/bx/all/CMakeLists.txt deleted file mode 100644 index ba4a65a78f3b0a..00000000000000 --- a/recipes/bx/all/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# Custom cmake config because the maintainer doesn't want maintain CMake configs. -# https://github.com/conan-io/conan-center-index/pull/1544/files#r420852884 - -cmake_minimum_required(VERSION 3.0) -project(bx) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -include(GNUInstallDirs) - -set(BX_SOURCE_SUBFOLDER "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder") - -file(GLOB BX_SOURCES ${BX_SOURCE_SUBFOLDER}/src/*.cpp) -list(REMOVE_ITEM BX_SOURCES ${BX_SOURCE_SUBFOLDER}/src/amalgamated.cpp) -add_library(bx STATIC ${BX_SOURCES}) -target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include ${BX_SOURCE_SUBFOLDER}/3rdparty) -install(TARGETS bx PUBLIC_HEADER ARCHIVE LIBRARY RUNTIME) -set_property(TARGET bx PROPERTY CXX_STANDARD 14) -install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/bx DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - -if(MSVC) - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/msvc) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/msvc/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) -elseif(MINGW OR CYGWIN OR MSYS) - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/mingw) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/mingw/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) -elseif(UNIX) - if(APPLE) - if(IOS) - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/ios) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/ios/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) - else() - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/osx) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/osx/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) - endif() - else() - if(SYSTEM_NAME STREQUAL "FreeBSD") - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/freebsd) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/freebsd/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) - endif() - endif() -endif() - -if(WIN32) - target_link_libraries(bx PUBLIC psapi) -endif() - -target_compile_definitions(bx PUBLIC "__STDC_LIMIT_MACROS" "__STDC_FORMAT_MACROS" "__STDC_CONSTANT_MACROS" PRIVATE "$<$:BX_CONFIG_DEBUG=1>") - -if(UNIX AND NOT APPLE AND NOT ANDROID) - find_package(Threads) - target_link_libraries(bx ${CMAKE_THREAD_LIBS_INIT} dl) - - target_link_libraries(bx rt) -elseif(APPLE) - find_library(FOUNDATION_LIBRARY Foundation) - mark_as_advanced(FOUNDATION_LIBRARY) - target_link_libraries(bx PUBLIC ${FOUNDATION_LIBRARY}) -endif() diff --git a/recipes/bx/all/conandata.yml b/recipes/bx/all/conandata.yml index 4f350d3b1a2c6a..f4ae1ed020baa8 100644 --- a/recipes/bx/all/conandata.yml +++ b/recipes/bx/all/conandata.yml @@ -1,7 +1,4 @@ sources: - "20200504": - url: "https://github.com/bkaradzic/bx/archive/b6ab66b099044220b8a047e58c41c288a939388c.zip" - sha256: "2074387565d9ace107e7a1dc734ee2e72a9763170574f22b0e70d70072449663" - "20200716": - url: "https://github.com/bkaradzic/bx/archive/c5b9b64c2d7c270494f6ad89cbb4090f8e3e7b64.zip" - sha256: "8c006f0df6ed0ac19fad8e9110451a71d729554aad13d7dcd8239aa0abbc1537" + "cci.20221116": + url: "https://github.com/bkaradzic/bx/archive/aed1086c48884b1b4f1c2f9af34c5198624263f6.tar.gz" + sha256: "6867CF7ABD2BB53A1A92C7B70CBC7F424B97D3AE3A8183F284C6A6507EFE4517" diff --git a/recipes/bx/all/conanfile.py b/recipes/bx/all/conanfile.py index 26064fb83f34bd..c1e1bfa91952f4 100644 --- a/recipes/bx/all/conanfile.py +++ b/recipes/bx/all/conanfile.py @@ -1,81 +1,247 @@ +from conan import ConanFile +from conan.tools.files import copy, get, rename +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, check_min_vs, is_msvc_static_runtime +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import MSBuild, VCVars +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.env import VirtualBuildEnv +from pathlib import Path import os -import glob -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -class BxConan(ConanFile): +required_conan_version = ">=1.50.0" + + +class bxConan(ConanFile): name = "bx" - description = "Base library used across multiple projects." license = "BSD-2-Clause" - topics = ("conan", "bx") homepage = "https://github.com/bkaradzic/bx" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = "os", "arch", "compiler", "build_type" - options = { - "fPIC": [True, False], - } - default_options = { - "fPIC": True, - } + description = "Base library providing utility functions and macros." + topics = ("general", "utility") + settings = "os", "compiler", "arch", "build_type" + options = {"fPIC": [True, False], "tools": [True, False]} + default_options = {"fPIC": True, "tools": False} + + @property + def _bx_folder(self): + return "bx" @property - def _source_subfolder(self): - return "source_subfolder" + def _bx_path(self): + return os.path.join(self.source_folder, self._bx_folder) @property - def _build_subfolder(self): - return "build_subfolder" + def _genie_extra(self): + genie_extra = "" + if is_msvc(self) and not is_msvc_static_runtime(self): + genie_extra += " --with-dynamic-runtime" + return genie_extra + + @property + def _projs(self): + projs = ["bx"] + if self.options.tools: + projs.extend(["bin2c", "lemon"]) + return projs + + @property + def _compiler_required(self): + return { + "gcc": "8", + "clang": "3.3", + "apple-clang": "5", + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def config_options(self): - if self.settings.os == 'Windows': + if self.settings.os == "Windows": del self.options.fPIC - def configure(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { - "gcc": "5", - "clang": "3.4", - "apple-clang": "10", - "Visual Studio": "15" - } - compiler = str(self.settings.compiler) - if compiler not in 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)) - 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)) + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if not self.options.get_safe("fPIC", True): + raise ConanInvalidConfiguration("This package does not support builds without fPIC.") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + check_min_vs(self, 191) + 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++14 support. The current compiler does not support it.") + except KeyError: + self.output.warn("This recipe has no checking for the current compiler. Please consider adding it.") + + def build_requirements(self): + self.tool_requires("genie/1170") + if not is_msvc(self) and self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('bx-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=os.path.join(self.source_folder, self._bx_folder)) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + vbe = VirtualBuildEnv(self) + vbe.generate() + if is_msvc(self): + tc = VCVars(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - cmake = self._configure_cmake() - cmake.build() + if is_msvc(self): + # Conan to Genie translation maps + vs_ver_to_genie = {"17": "2022", "16": "2019", "15": "2017", + "193": "2022", "192": "2019", "191": "2017"} + + # Use genie directly, then msbuild on specific projects based on requirements + genie_VS = f"vs{vs_ver_to_genie[str(self.settings.compiler.version)]}" + genie_gen = f"{self._genie_extra} {genie_VS}" + self.run(f"genie {genie_gen}", cwd=self._bx_path) + + msbuild = MSBuild(self) + # customize to Release when RelWithDebInfo + msbuild.build_type = "Debug" if self.settings.build_type == "Debug" else "Release" + # use Win32 instead of the default value when building x86 + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self._bx_path, ".build", "projects", genie_VS, "bx.sln"), targets=self._projs) + else: + # Not sure if XCode can be spefically handled by conan for building through, so assume everything not VS is make + # gcc-multilib and g++-multilib required for 32bit cross-compilation, should see if we can check and install through conan + + # Conan to Genie translation maps + compiler_str = str(self.settings.compiler) + compiler_and_os_to_genie = {"Windows": f"--gcc=mingw-{compiler_str}", "Linux": f"--gcc=linux-{compiler_str}", + "FreeBSD": "--gcc=freebsd", "Macos": "--gcc=osx", + "Android": "--gcc=android", "iOS": "--gcc=ios"} + gmake_os_to_proj = {"Windows": "mingw", "Linux": "linux", "FreeBSD": "freebsd", "Macos": "osx", "Android": "android", "iOS": "ios"} + gmake_arch_to_genie_suffix = {"x86": "-x86", "x86_64": "-x64", "armv8": "-arm64", "armv7": "-arm"} + os_to_use_arch_config_suffix = {"Windows": False, "Linux": False, "FreeBSD": False, "Macos": True, "Android": True, "iOS": True} + + build_type_to_make_config = {"Debug": "config=debug", "Release": "config=release"} + arch_to_make_config_suffix = {"x86": "32", "x86_64": "64"} + os_to_use_make_config_suffix = {"Windows": True, "Linux": True, "FreeBSD": True, "Macos": False, "Android": False, "iOS": False} + + # Generate projects through genie + genieGen = f"{self._genie_extra} {compiler_and_os_to_genie[str(self.settings.os)]}" + if os_to_use_arch_config_suffix[str(self.settings.os)]: + genieGen += f"{gmake_arch_to_genie_suffix[str(self.settings.arch)]}" + genieGen += " gmake" + self.run(f"genie {genieGen}", cwd=self._bx_path) + + # Build project folder and path from given settings + projFolder = f"gmake-{gmake_os_to_proj[str(self.settings.os)]}" + if self.settings.os == "Windows" or compiler_str not in ["gcc", "apple-clang"]: + projFolder += f"-{compiler_str}" #mingw-gcc or mingw-clang for windows; -clang for linux (where gcc on linux has no extra) + if os_to_use_arch_config_suffix[str(self.settings.os)]: + projFolder += gmake_arch_to_genie_suffix[str(self.settings.arch)] + proj_path = os.path.sep.join([self._bx_path, ".build", "projects", projFolder]) + + # Build make args from settings + conf = build_type_to_make_config[str(self.settings.build_type)] + if os_to_use_make_config_suffix[str(self.settings.os)]: + conf += arch_to_make_config_suffix[str(self.settings.arch)] + if self.settings.os == "Windows": + mingw = "MINGW=$MINGW_PREFIX" + proj_path = proj_path.replace("\\", "/") # Fix path for msys... + else: + mingw = "" + autotools = Autotools(self) + # Build with make + for proj in self._projs: + autotools.make(target=proj, args=["-R", f"-C {proj_path}", mingw, conf]) def package(self): - cmake = self._configure_cmake() - cmake.install() - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + # Set platform suffixes and prefixes + if self.settings.os == "Windows": + lib_ext = "*.lib" + package_lib_prefix = "" + elif self.settings.os in ["Linux", "FreeBSD"]: + lib_ext = "*.a" + package_lib_prefix = "lib" + elif self.settings.os == "Macos": + lib_ext = "*.a" + package_lib_prefix = "lib" + + # Get build bin folder + for bx_out_dir in os.listdir(os.path.join(self._bx_path, ".build")): + if not bx_out_dir=="projects": + build_bin = os.path.join(self._bx_path, ".build", bx_out_dir, "bin") + break + + # Copy license + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._bx_path) + # Copy includes + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._bx_path, "include")) + copy(self, pattern="*.inl", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._bx_path, "include")) + # Copy libs + copy(self, pattern=lib_ext, dst=os.path.join(self.package_folder, "lib"), src=build_bin, keep_path=False) + # Copy tools + if self.options.tools: + copy(self, pattern="bin2c*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + copy(self, pattern="lemon*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + + # Rename for consistency across platforms and configs + for bx_file in Path(os.path.join(self.package_folder, "lib")).glob("*bx*"): + rename(self, os.path.join(self.package_folder, "lib", bx_file.name), + os.path.join(self.package_folder, "lib", f"{package_lib_prefix}bx{bx_file.suffix}")) + if self.options.tools: + for bx_file in Path(os.path.join(self.package_folder, "bin")).glob("*bin2c*"): + rename(self, os.path.join(self.package_folder, "bin", bx_file.name), + os.path.join(self.package_folder, "bin", f"bin2c{bx_file.suffix}")) + for bx_file in Path(os.path.join(self.package_folder, "bin")).glob("*lemon*"): + rename(self, os.path.join(self.package_folder, "bin", bx_file.name), + os.path.join(self.package_folder, "bin", f"lemon{bx_file.suffix}")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.includedirs.append(os.path.join("include", "bx", "compat")) - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl", "pthread", "rt"] - if self.settings.os == "Macos": - self.cpp_info.frameworks = ["Foundation"] + self.cpp_info.includedirs = ["include"] + self.cpp_info.libs = ["bx"] + + self.cpp_info.set_property("cmake_file_name", "bx") + self.cpp_info.set_property("cmake_target_name", "bx::bx") + self.cpp_info.set_property("pkg_config_name", "bx") + + if self.settings.build_type == "Debug": + self.cpp_info.defines.extend(["BX_CONFIG_DEBUG=1"]) + else: + self.cpp_info.defines.extend(["BX_CONFIG_DEBUG=0"]) + + if self.settings.os == "Windows": + if self.settings.arch == "x86": + self.cpp_info.system_libs.extend(["psapi"]) + if is_msvc(self): + self.cpp_info.includedirs.extend(["include/compat/msvc"]) + self.cpp_info.cxxflags.extend(["/Zc:__cplusplus"]) + else: + self.cpp_info.includedirs.extend(["include/compat/mingw"]) + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["dl", "pthread"]) + if self.settings.os == "Linux": + self.cpp_info.includedirs.extend(["include/compat/linux"]) + else: + self.cpp_info.includedirs.extend(["include/compat/freebsd"]) + elif self.settings.os in ["Macos", "iOS"]: + self.cpp_info.frameworks.extend(["Foundation", "Cocoa"]) + if self.settings.os == "Macos": + self.cpp_info.includedirs.extend(["include/compat/osx"]) + else: + self.cpp_info.includedirs.extend(["include/compat/ios"]) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "bx" + self.cpp_info.filenames["cmake_find_package_multi"] = "bx" + self.cpp_info.names["cmake_find_package"] = "bx" + self.cpp_info.names["cmake_find_package_multi"] = "bx" diff --git a/recipes/bx/all/test_package/CMakeLists.txt b/recipes/bx/all/test_package/CMakeLists.txt index 57c0d429701ced..71a1766827d58c 100644 --- a/recipes/bx/all/test_package/CMakeLists.txt +++ b/recipes/bx/all/test_package/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES CXX) -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 14) +find_package(bx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} bx::bx) diff --git a/recipes/bx/all/test_package/conanfile.py b/recipes/bx/all/test_package/conanfile.py index 4903f1a7e8fa0f..7914baa4343981 100644 --- a/recipes/bx/all/test_package/conanfile.py +++ b/recipes/bx/all/test_package/conanfile.py @@ -1,9 +1,21 @@ -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 +required_conan_version = ">=1.50.0" + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + 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 +23,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/bx/all/test_package/test_package.cpp b/recipes/bx/all/test_package/test_package.cpp index 712588f0588978..e62d29351461ac 100644 --- a/recipes/bx/all/test_package/test_package.cpp +++ b/recipes/bx/all/test_package/test_package.cpp @@ -1,7 +1,8 @@ -#include +#include -int main() -{ - char tmp[1024]; - prettify(tmp, BX_COUNTOF(tmp), 4000, bx::Units::Kilo); +int main() { + float tLerp = bx::lerp(0.0f, 10.0f, 0.5f); + BX_TRACE("Lerped 0.0f to 10.0f at 0.5f, result %f", tLerp); + BX_ASSERT(bx::isEqual(tLerp, 5.0f, 0.1f), "isEqual failed"); + return 0; } diff --git a/recipes/bx/all/test_v1_package/CMakeLists.txt b/recipes/bx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..3a070c42e74472 --- /dev/null +++ b/recipes/bx/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(bx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} bx::bx) diff --git a/recipes/bx/all/test_v1_package/conanfile.py b/recipes/bx/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..d2959af78862a7 --- /dev/null +++ b/recipes/bx/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class BxTestPackageConan(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/bx/all/test_v1_package/test_package.cpp b/recipes/bx/all/test_v1_package/test_package.cpp new file mode 100644 index 00000000000000..e62d29351461ac --- /dev/null +++ b/recipes/bx/all/test_v1_package/test_package.cpp @@ -0,0 +1,8 @@ +#include + +int main() { + float tLerp = bx::lerp(0.0f, 10.0f, 0.5f); + BX_TRACE("Lerped 0.0f to 10.0f at 0.5f, result %f", tLerp); + BX_ASSERT(bx::isEqual(tLerp, 5.0f, 0.1f), "isEqual failed"); + return 0; +} diff --git a/recipes/bx/config.yml b/recipes/bx/config.yml index c46173d220255d..1156867d3e651c 100644 --- a/recipes/bx/config.yml +++ b/recipes/bx/config.yml @@ -1,5 +1,3 @@ versions: - "20200504": - folder: all - "20200716": + "cci.20221116": folder: all diff --git a/recipes/bzip3/all/conandata.yml b/recipes/bzip3/all/conandata.yml index 793290248520a6..eb1cfea3a1d614 100644 --- a/recipes/bzip3/all/conandata.yml +++ b/recipes/bzip3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.2": + url: "https://github.com/kspalaiologos/bzip3/archive/1.2.2.tar.gz" + sha256: "e7792f3c83f1d9efd0d7b18da2eb6a1f119ffcdeb5515cf441145c2e9b72652e" "1.2.1": url: "https://github.com/kspalaiologos/bzip3/archive/1.2.1.tar.gz" sha256: "f2fc4c9c7679d3b120e8f44d8c4ecd00f03af9981f53e13dc0f956b5996913c9" diff --git a/recipes/bzip3/all/conanfile.py b/recipes/bzip3/all/conanfile.py index 118e5fbf34f0cb..651e96036ca1cd 100644 --- a/recipes/bzip3/all/conanfile.py +++ b/recipes/bzip3/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class BZip3Conan(ConanFile): @@ -42,18 +42,9 @@ def config_options(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/bzip3/all/test_v1_package/CMakeLists.txt b/recipes/bzip3/all/test_v1_package/CMakeLists.txt index 8c1771e7b10810..925ecbe19e448d 100644 --- a/recipes/bzip3/all/test_v1_package/CMakeLists.txt +++ b/recipes/bzip3/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(bzip3 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE bzip3::bzip3) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/bzip3/config.yml b/recipes/bzip3/config.yml index a95d0b82239d84..e28ea261ce3048 100644 --- a/recipes/bzip3/config.yml +++ b/recipes/bzip3/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.2": + folder: all "1.2.1": folder: all "1.2.0": diff --git a/recipes/c-blosc/all/conandata.yml b/recipes/c-blosc/all/conandata.yml index dfd824d8023f04..c8c0ea232bc215 100644 --- a/recipes/c-blosc/all/conandata.yml +++ b/recipes/c-blosc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.21.3": + url: "https://github.com/Blosc/c-blosc/archive/v1.21.3.tar.gz" + sha256: "941016c4564bca662080bb01aea74f06630bd665e598c6f6967fd91b2e2e0bb6" "1.21.1": url: "https://github.com/Blosc/c-blosc/archive/v1.21.1.tar.gz" sha256: "f387149eab24efa01c308e4cba0f59f64ccae57292ec9c794002232f7903b55b" @@ -21,17 +24,35 @@ sources: url: "https://github.com/Blosc/c-blosc/archive/v1.17.1.tar.gz" sha256: "19a6948b579c27e8ac440b4f077f99fc90e7292b1d9cb896bec0fd781d68fba2" patches: + "1.21.3": + - patch_file: "patches/cmake-dependencies-1.21.2+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.21.1": - patch_file: "patches/cmake-dependencies-1.21.1+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.21.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.20.1": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.20.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.19.0": - patch_file: "patches/cmake-dependencies-1.19.0.patch" + patch_description: "use cci package" + patch_type: "conan" "1.18.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" + patch_description: "use cci package" + patch_type: "conan" "1.17.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/c-blosc/all/conanfile.py b/recipes/c-blosc/all/conanfile.py index 1a0282104d95b0..a349a37babbd2b 100644 --- a/recipes/c-blosc/all/conanfile.py +++ b/recipes/c-blosc/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class CbloscConan(ConanFile): @@ -47,18 +47,9 @@ def config_options(self): def configure(self): if self.options.shared: - 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") @@ -130,4 +121,4 @@ def package_info(self): prefix = "lib" if is_msvc(self) and not self.options.shared else "" self.cpp_info.libs = [f"{prefix}blosc"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.21.2+.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.2+.patch new file mode 100644 index 00000000000000..09a5a7401237e5 --- /dev/null +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.2+.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 54d4817..2ba937d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -134,7 +134,8 @@ include(GNUInstallDirs) + + if(NOT DEACTIVATE_LZ4) + if(PREFER_EXTERNAL_LZ4) +- find_package(LZ4) ++ find_package(lz4 REQUIRED CONFIG) ++ set(LZ4_FOUND TRUE) + else() + message(STATUS "Using LZ4 internal sources.") + endif() +@@ -156,7 +157,6 @@ endif() + if(NOT DEACTIVATE_ZLIB) + # import the ZLIB_ROOT environment variable to help finding the zlib library + if(PREFER_EXTERNAL_ZLIB) +- set(ZLIB_ROOT $ENV{ZLIB_ROOT}) + find_package(ZLIB) + if(NOT ZLIB_FOUND ) + message(STATUS "No zlib found. Using internal sources.") +@@ -171,7 +171,7 @@ endif() + + if(NOT DEACTIVATE_ZSTD) + if(PREFER_EXTERNAL_ZSTD) +- find_package(Zstd) ++ find_package(zstd REQUIRED CONFIG) + else() + message(STATUS "Using ZSTD internal sources.") + endif() +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index fd6d695..8ef909d 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -88,7 +88,7 @@ endif(WIN32) + + if(NOT DEACTIVATE_LZ4) + if(LZ4_FOUND) +- set(LIBS ${LIBS} ${LZ4_LIBRARY}) ++ set(LIBS ${LIBS} $,LZ4::lz4_shared,LZ4::lz4_static>) + else(LZ4_FOUND) + file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${LZ4_FILES}) +@@ -98,7 +98,7 @@ endif(NOT DEACTIVATE_LZ4) + + if(NOT DEACTIVATE_SNAPPY) + if(SNAPPY_FOUND) +- set(LIBS ${LIBS} ${SNAPPY_LIBRARY}) ++ set(LIBS ${LIBS} "Snappy::snappy") + else(SNAPPY_FOUND) + file(GLOB SNAPPY_FILES ${SNAPPY_LOCAL_DIR}/*.cc) + set(SOURCES ${SOURCES} ${SNAPPY_FILES}) +@@ -108,7 +108,7 @@ endif(NOT DEACTIVATE_SNAPPY) + + if(NOT DEACTIVATE_ZLIB) + if(ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARY}) ++ set(LIBS ${LIBS} "ZLIB::ZLIB") + else(ZLIB_FOUND) + file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${ZLIB_FILES}) +@@ -118,7 +118,7 @@ endif(NOT DEACTIVATE_ZLIB) + + if (NOT DEACTIVATE_ZSTD) + if (ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) + else (ZSTD_FOUND) + # Enable assembly code only when not using MSVC *and* x86 is there + if((NOT MSVC) AND COMPILER_SUPPORT_SSE2) # if SSE2 is here, this is an x86 platform diff --git a/recipes/c-blosc/all/test_v1_package/CMakeLists.txt b/recipes/c-blosc/all/test_v1_package/CMakeLists.txt index 178f209fe3a3a4..de3b75d9538de0 100644 --- a/recipes/c-blosc/all/test_v1_package/CMakeLists.txt +++ b/recipes/c-blosc/all/test_v1_package/CMakeLists.txt @@ -4,7 +4,5 @@ project(test_package LANGUAGES C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(c-blosc REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE c-blosc::c-blosc) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/c-blosc/config.yml b/recipes/c-blosc/config.yml index 600b8bb73358e5..5798e3590a6d3d 100644 --- a/recipes/c-blosc/config.yml +++ b/recipes/c-blosc/config.yml @@ -1,4 +1,6 @@ versions: + "1.21.3": + folder: all "1.21.1": folder: all "1.21.0": diff --git a/recipes/c-dbg-macro/all/conanfile.py b/recipes/c-dbg-macro/all/conanfile.py index 8c02b5c63b5a6c..d30bb72e433f78 100644 --- a/recipes/c-dbg-macro/all/conanfile.py +++ b/recipes/c-dbg-macro/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.files import get, copy +from conan.tools.layout import basic_layout +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.46.0" class DbgMacroConan(ConanFile): name = "c-dbg-macro" @@ -10,24 +13,27 @@ class DbgMacroConan(ConanFile): homepage = "https://github.com/eerimoq/dbg-macro" license = "MIT" description = "A dbg(...) macro for C" - topics = ("conan", "debugging", "macro", "pretty-printing", "header-only") + topics = ("debugging", "macro", "pretty-printing", "header-only") settings = ("compiler", "build_type", "os", "arch") no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("This library is not compatible with Windows") + def layout(self): + basic_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 package(self): - self.copy("include/dbg.h", dst=".", src=self._source_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "dbg.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + def package_id(self): - self.info.header_only() + self.info.clear() diff --git a/recipes/c-dbg-macro/all/test_package/CMakeLists.txt b/recipes/c-dbg-macro/all/test_package/CMakeLists.txt index 85e615074f940b..c764c0709047b2 100644 --- a/recipes/c-dbg-macro/all/test_package/CMakeLists.txt +++ b/recipes/c-dbg-macro/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -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(c-dbg-macro REQUIRED) -add_executable(test_package test_package.c) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE c-dbg-macro::c-dbg-macro) diff --git a/recipes/c-dbg-macro/all/test_package/conanfile.py b/recipes/c-dbg-macro/all/test_package/conanfile.py index c795b378cca50b..48499fa0989d9c 100644 --- a/recipes/c-dbg-macro/all/test_package/conanfile.py +++ b/recipes/c-dbg-macro/all/test_package/conanfile.py @@ -1,17 +1,27 @@ +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 +# It will become the standard on Conan 2.x 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 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 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/libzippp/all/CMakeLists.txt b/recipes/c-dbg-macro/all/test_v1_package/CMakeLists.txt similarity index 55% rename from recipes/libzippp/all/CMakeLists.txt rename to recipes/c-dbg-macro/all/test_v1_package/CMakeLists.txt index bcd4ccf17fd786..4c9e7ffdd2a286 100644 --- a/recipes/libzippp/all/CMakeLists.txt +++ b/recipes/c-dbg-macro/all/test_v1_package/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -set(CMAKE_CXX_STANDARD 11) +project(test_package C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -add_subdirectory("source_subfolder") +add_executable(test_package ../test_package/test_package.c) diff --git a/recipes/c-dbg-macro/all/test_v1_package/conanfile.py b/recipes/c-dbg-macro/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c795b378cca50b --- /dev/null +++ b/recipes/c-dbg-macro/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" + + 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/c4core/all/conandata.yml b/recipes/c4core/all/conandata.yml index 622bb4f50ac3af..3cf4bc0bf49101 100644 --- a/recipes/c4core/all/conandata.yml +++ b/recipes/c4core/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.11": + url: "https://github.com/biojppm/c4core/releases/download/v0.1.11/c4core-0.1.11-src.tgz" + sha256: "67f4443f3742424f42453594e26e656f616dddfcf225a1d810e00473a741408c" "0.1.10": url: "https://github.com/biojppm/c4core/releases/download/v0.1.10/c4core-0.1.10-src.tgz" sha256: "e8ab4dedd0e20f86af7c69527cfbe8bc1cf72c84b7fbc0cfd420656f28ae20b2" @@ -10,6 +13,10 @@ sources: sha256: "95c0663192c6bff7a098b50afcb05d22a34dd0fd8e6be2e1b61edad2b9675fde" patches: + "0.1.11": + - patch_file: "patches/0.1.11-0001-make-fast_float-external.patch" + patch_description: "use cci's fast_float recipe" + patch_type: "conan" "0.1.10": - patch_file: "patches/0.1.10-0001-make-fast_float-external.patch" patch_description: "use cci's fast_float recipe" diff --git a/recipes/c4core/all/patches/0.1.11-0001-make-fast_float-external.patch b/recipes/c4core/all/patches/0.1.11-0001-make-fast_float-external.patch new file mode 100644 index 00000000000000..7532d129ab0805 --- /dev/null +++ b/recipes/c4core/all/patches/0.1.11-0001-make-fast_float-external.patch @@ -0,0 +1,37 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 1207d1b..20ffe96 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -73,7 +73,6 @@ set(C4CORE_SRC_FILES + if(C4CORE_WITH_FASTFLOAT) + list(APPEND C4CORE_SRC_FILES + c4/ext/fast_float.hpp +- c4/ext/fast_float_all.h + ) + endif() + set(C4CORE_AMALGAMATED ${C4CORE_SRC_DIR}/../src_singleheader/c4/c4core_all.hpp) +@@ -92,7 +91,10 @@ c4_add_library(c4core + SOURCE_ROOT ${C4CORE_SRC_DIR} + SOURCES ${C4CORE_SRC_FILES} + ) +-if(NOT C4CORE_WITH_FASTFLOAT) ++if(C4CORE_WITH_FASTFLOAT) ++ find_package(FastFloat REQUIRED CONFIG) ++ target_link_libraries(c4core PUBLIC "FastFloat::fast_float") ++else() + target_compile_definitions(c4core PUBLIC -DC4CORE_NO_FAST_FLOAT) + endif() + if(C4CORE_NO_DEBUG_BREAK) +diff --git a/a/src/c4/ext/fast_float.hpp b/b/src/c4/ext/fast_float.hpp +index 9e75b5e..64aa2a4 100644 +--- a/a/src/c4/ext/fast_float.hpp ++++ b/b/src/c4/ext/fast_float.hpp +@@ -15,7 +15,7 @@ + # pragma GCC diagnostic ignored "-Wuseless-cast" + #endif + +-#include "c4/ext/fast_float_all.h" ++#include "fast_float/fast_float.h" + + #ifdef _MSC_VER + # pragma warning(pop) diff --git a/recipes/c4core/all/test_package/CMakeLists.txt b/recipes/c4core/all/test_package/CMakeLists.txt index 62cfc706469cd2..e0b34e28e562bc 100644 --- a/recipes/c4core/all/test_package/CMakeLists.txt +++ b/recipes/c4core/all/test_package/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(c4core REQUIRED CONFIG) diff --git a/recipes/c4core/all/test_v1_package/CMakeLists.txt b/recipes/c4core/all/test_v1_package/CMakeLists.txt index bfd5ba0ad4164a..bc541ea90b5128 100644 --- a/recipes/c4core/all/test_v1_package/CMakeLists.txt +++ b/recipes/c4core/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(c4core REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE c4core::c4core) -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/c4core/config.yml b/recipes/c4core/config.yml index 364da530085a94..b3f909b6c96645 100644 --- a/recipes/c4core/config.yml +++ b/recipes/c4core/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.11": + folder: all "0.1.10": folder: all "0.1.9": diff --git a/recipes/capnproto/all/CMakeLists.txt b/recipes/capnproto/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d4..00000000000000 --- a/recipes/capnproto/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/capnproto/all/conandata.yml b/recipes/capnproto/all/conandata.yml index 90455ae5133174..8a6eeaab5a8d19 100644 --- a/recipes/capnproto/all/conandata.yml +++ b/recipes/capnproto/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.10.3": + url: "https://github.com/capnproto/capnproto/archive/v0.10.3.tar.gz" + sha256: "e07446f56043c983e009038e69d18ff86a2924909f0b518ccf47eccf5ac03919" "0.10.1": url: "https://github.com/capnproto/capnproto/archive/v0.10.1.tar.gz" sha256: "2e9c918f02c198557c75ca7c635fe281337c9755b752a6ab3a841bcc1cf5176b" @@ -15,36 +18,24 @@ sources: url: "https://github.com/capnproto/capnproto/archive/v0.7.0.tar.gz" sha256: 76c7114a3d142ad08b7208b3964a26e72a6320ee81331d3f0b87569fc9c47a28 patches: + "0.10.3": + - patch_file: patches/0014-disable-tests-for-0.10.1.patch "0.10.1": - patch_file: patches/0014-disable-tests-for-0.10.1.patch - base_path: source_subfolder "0.10.0": - patch_file: patches/0013-disable-tests-for-0.10.0.patch - base_path: source_subfolder "0.9.1": - patch_file: patches/0010-disable-tests-for-0.9.1.patch - base_path: source_subfolder - patch_file: patches/0011-msvc-cpp17-hassubstring-fix-0.9.1.patch - base_path: source_subfolder - patch_file: patches/0012-msvc-nogdi-fix-0.9.1.patch - base_path: source_subfolder "0.8.0": - patch_file: patches/0001-disable-tests.patch - base_path: source_subfolder - patch_file: patches/0002-cmake-compat-header-install.patch - base_path: source_subfolder - patch_file: patches/0003-kj-tls-windows.patch - base_path: source_subfolder - patch_file: patches/0004-cmake-module-path.patch - base_path: source_subfolder - patch_file: patches/0005-msvc-16.7-ice-workaround.patch - base_path: source_subfolder - patch_file: patches/0009-windows-symlink-fix-0.8.0.patch - base_path: source_subfolder "0.7.0": - patch_file: patches/0006-symlink.patch - base_path: source_subfolder - patch_file: patches/0007-cmake-module-path.patch - base_path: source_subfolder - patch_file: patches/0008-disable-tests.patch - base_path: source_subfolder diff --git a/recipes/capnproto/all/conanfile.py b/recipes/capnproto/all/conanfile.py index 4d5fd86b03ef9f..31ac13800e74b2 100644 --- a/recipes/capnproto/all/conanfile.py +++ b/recipes/capnproto/all/conanfile.py @@ -1,19 +1,26 @@ -from conans import ConanFile, CMake, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import glob import os import textwrap -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class CapnprotoConan(ConanFile): name = "capnproto" description = "Cap'n Proto serialization/RPC system." license = "MIT" - topics = ("capnproto", "serialization", "rpc") + topics = ("serialization", "rpc") homepage = "https://capnproto.org" url = "https://github.com/conan-io/conan-center-index" @@ -31,114 +38,117 @@ class CapnprotoConan(ConanFile): "with_zlib": True, } - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return "14" @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "5", "apple-clang": "5.1", } + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + 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) < "0.8.0": + if Version(self.version) < "0.8.0": del self.options.with_zlib def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1o") + self.requires("openssl/1.1.1s") if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, self._min_cppstd) minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("Cap'n Proto requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("Cap'n Proto requires C++14, 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.", + ) if is_msvc(self) and self.options.shared: - raise ConanInvalidConfiguration("Cap'n Proto doesn't support shared libraries for Visual Studio") - if self.settings.os == "Windows" and tools.Version(self.version) < "0.8.0" and self.options.with_openssl: - raise ConanInvalidConfiguration("Cap'n Proto doesn't support OpenSSL on Windows pre 0.8.0") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support shared libraries for Visual Studio") + if self.settings.os == "Windows" and Version(self.version) < "0.8.0" and self.options.with_openssl: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support OpenSSL on Windows pre 0.8.0") def build_requirements(self): if self.settings.os != "Windows": - self.build_requires("libtool/2.4.6") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", 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) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["EXTERNAL_CAPNP"] = False - cmake.definitions["CAPNP_LITE"] = False - cmake.definitions["WITH_OPENSSL"] = self.options.with_openssl - cmake.configure(build_folder=self._build_subfolder) - return cmake - - @functools.lru_cache(1) - def _configure_autotools(self): - args = [ - "--enable-shared" if self.options.shared else "--disable-shared", - "--disable-static" if self.options.shared else "--enable-static", - "--with-openssl" if self.options.with_openssl else "--without-openssl", - "--enable-reflection", - ] - if tools.Version(self.version) >= "0.8.0": - args.append("--with-zlib" if self.options.with_zlib else "--without-zlib") - autotools = AutoToolsBuildEnvironment(self) - # Fix rpath on macOS - if self.settings.os == "Macos": - autotools.link_flags.append("-Wl,-rpath,@loader_path/../lib") - autotools.configure(args=args) - return autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["EXTERNAL_CAPNP"] = False + tc.variables["CAPNP_LITE"] = False + tc.variables["WITH_OPENSSL"] = self.options.with_openssl + tc.generate() + deps = CMakeDeps(self) + deps.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--with-openssl={yes_no(self.options.with_openssl)}", + "--enable-reflection", + ]) + if Version(self.version) >= "0.8.0": + tc.configure_args.append(f"--with-zlib={yes_no(self.options.with_zlib)}") + # Fix rpath on macOS + if self.settings.os == "Macos": + tc.extra_ldflags.append("-Wl,-rpath,@loader_path/../lib") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() else: - with tools.chdir(os.path.join(self._source_subfolder, "c++")): - self.run("{} -fiv".format(tools.get_env("AUTORECONF"))) - # 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() + with chdir(self, os.path.join(self.source_folder, "c++")): + autotools = Autotools(self) + # TODO: replace by a call to autootols.autoreconf() in c++ folder once https://github.com/conan-io/conan/issues/12103 implemented + self.run("autoreconf --force --install") + autotools.configure(build_script_folder=os.path.join(self.source_folder, "c++")) autotools.make() @property @@ -146,16 +156,17 @@ def _cmake_folder(self): return os.path.join("lib", "cmake", "CapnProto") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() else: - with tools.chdir(os.path.join(self._source_subfolder, "c++")): - autotools = self._configure_autotools() + with chdir(self, os.path.join(self.source_folder, "c++")): + autotools = Autotools(self) 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")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) for cmake_file in glob.glob(os.path.join(self.package_folder, self._cmake_folder, "*")): if os.path.basename(cmake_file) != "CapnProtoMacros.cmake": os.remove(cmake_file) @@ -175,7 +186,7 @@ def package(self): set(CAPNP_INCLUDE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../../../include") function(CAPNP_GENERATE_CPP SOURCES HEADERS) """) - tools.replace_in_file(os.path.join(self.package_folder, self._cmake_folder, "CapnProtoMacros.cmake"), + replace_in_file(self, os.path.join(self.package_folder, self._cmake_folder, "CapnProtoMacros.cmake"), "function(CAPNP_GENERATE_CPP SOURCES HEADERS)", find_execs) @@ -198,7 +209,7 @@ def package_info(self): components.append({"name": "kj-gzip", "requires": ["kj", "kj-async", "zlib::zlib"]}) if self.options.with_openssl: components.append({"name": "kj-tls", "requires": ["kj", "kj-async", "openssl::openssl"]}) - if tools.Version(self.version) >= "0.9.0": + if Version(self.version) >= "0.9.0": components.append({ "name": "capnp-websocket", "requires": ["capnp", "capnp-rpc", "kj-http", "kj-async", "kj"], @@ -214,18 +225,17 @@ def package_info(self): elif self.settings.os == "Windows": self.cpp_info.components["kj-async"].system_libs = ["ws2_32"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with: {}".format(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"] = "CapnProto" self.cpp_info.names["cmake_find_package_multi"] = "CapnProto" self.cpp_info.components["kj"].build_modules = [capnprotomacros] + 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) def _register_component(self, component): name = component["name"] - self.cpp_info.components[name].set_property("cmake_target_name", "CapnProto::{}".format(name)) + self.cpp_info.components[name].set_property("cmake_target_name", f"CapnProto::{name}") self.cpp_info.components[name].builddirs.append(self._cmake_folder) self.cpp_info.components[name].set_property("pkg_config_name", name) self.cpp_info.components[name].libs = [name] diff --git a/recipes/capnproto/all/test_package/CMakeLists.txt b/recipes/capnproto/all/test_package/CMakeLists.txt index 44e90440833f5b..8ffc65e9ffa4be 100644 --- a/recipes/capnproto/all/test_package/CMakeLists.txt +++ b/recipes/capnproto/all/test_package/CMakeLists.txt @@ -1,20 +1,16 @@ -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(CapnProto REQUIRED capnp capnp-rpc CONFIG) capnp_generate_cpp(addressbookSources addressbookHeaders addressbook.capnp) add_executable(addressbook addressbook.c++ ${addressbookSources}) -target_link_libraries(addressbook CapnProto::capnp) target_include_directories(addressbook PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -set_property(TARGET addressbook PROPERTY CXX_STANDARD 14) +target_link_libraries(addressbook PRIVATE CapnProto::capnp) +target_compile_features(addressbook PRIVATE cxx_std_14) capnp_generate_cpp(calculatorSources calculatorHeaders calculator.capnp) -add_library(calculator_protocol STATIC) -target_sources(calculator_protocol PRIVATE ${calculatorSources}) +add_library(calculator_protocol STATIC ${calculatorSources}) target_include_directories(calculator_protocol PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(calculator_protocol PUBLIC CapnProto::capnp-rpc) target_compile_features(calculator_protocol PUBLIC cxx_std_14) diff --git a/recipes/capnproto/all/test_package/conanfile.py b/recipes/capnproto/all/test_package/conanfile.py index 10650773f736a3..d4d32590a51cc5 100644 --- a/recipes/capnproto/all/test_package/conanfile.py +++ b/recipes/capnproto/all/test_package/conanfile.py @@ -1,14 +1,31 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires(str(self.requires["capnproto"])) + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires(self.tested_reference_str) + + def generate(self): + VirtualRunEnv(self).generate() + if hasattr(self, "settings_build") and cross_building(self): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") def build(self): cmake = CMake(self) @@ -16,6 +33,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "addressbook") - self.run("{} write".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "addressbook") + self.run(f"{bin_path} write", env="conanrun") diff --git a/recipes/capnproto/all/test_v1_package/CMakeLists.txt b/recipes/capnproto/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/capnproto/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/capnproto/all/test_v1_package/conanfile.py b/recipes/capnproto/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..9c7aa58ab88686 --- /dev/null +++ b/recipes/capnproto/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" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if hasattr(self, "settings_build"): + self.build_requires(self.tested_reference_str) + + def build(self): + with tools.no_op() if hasattr(self, "settings_build") else tools.run_environment(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "addressbook") + self.run(f"{bin_path} write", run_environment=True) diff --git a/recipes/capnproto/config.yml b/recipes/capnproto/config.yml index b46b8cb89082c6..89d97bce3d8502 100644 --- a/recipes/capnproto/config.yml +++ b/recipes/capnproto/config.yml @@ -1,4 +1,6 @@ versions: + "0.10.3": + folder: all "0.10.1": folder: all "0.10.0": diff --git a/recipes/catch2/2.x.x/conandata.yml b/recipes/catch2/2.x.x/conandata.yml index a0d3adb7f0e99e..c945ab03130017 100644 --- a/recipes/catch2/2.x.x/conandata.yml +++ b/recipes/catch2/2.x.x/conandata.yml @@ -1,16 +1,16 @@ sources: - "2.11.3": - url: "https://github.com/catchorg/Catch2/archive/v2.11.3.tar.gz" - sha256: "9a6967138062688f04374698fce4ce65908f907d8c0fe5dfe8dc33126bd46543" - "2.12.4": - url: "https://github.com/catchorg/Catch2/archive/v2.12.4.tar.gz" - sha256: "5436725bbc6ee131a0bc9545bef31f0adabbb21fbc39fb6f1b2a42c12e4f8107" - "2.13.7": - url: "https://github.com/catchorg/Catch2/archive/v2.13.7.tar.gz" - sha256: "3cdb4138a072e4c0290034fe22d9f0a80d3bcfb8d7a8a5c49ad75d3a5da24fae" - "2.13.8": - url: "https://github.com/catchorg/Catch2/archive/v2.13.8.tar.gz" - sha256: "b9b592bd743c09f13ee4bf35fc30eeee2748963184f6bea836b146e6cc2a585a" "2.13.9": url: "https://github.com/catchorg/Catch2/archive/v2.13.9.tar.gz" sha256: "06dbc7620e3b96c2b69d57bf337028bf245a211b3cddb843835bfe258f427a52" + "2.13.8": + url: "https://github.com/catchorg/Catch2/archive/v2.13.8.tar.gz" + sha256: "b9b592bd743c09f13ee4bf35fc30eeee2748963184f6bea836b146e6cc2a585a" + "2.13.7": + url: "https://github.com/catchorg/Catch2/archive/v2.13.7.tar.gz" + sha256: "3cdb4138a072e4c0290034fe22d9f0a80d3bcfb8d7a8a5c49ad75d3a5da24fae" + "2.12.4": + url: "https://github.com/catchorg/Catch2/archive/v2.12.4.tar.gz" + sha256: "5436725bbc6ee131a0bc9545bef31f0adabbb21fbc39fb6f1b2a42c12e4f8107" + "2.11.3": + url: "https://github.com/catchorg/Catch2/archive/v2.11.3.tar.gz" + sha256: "9a6967138062688f04374698fce4ce65908f907d8c0fe5dfe8dc33126bd46543" diff --git a/recipes/catch2/2.x.x/conanfile.py b/recipes/catch2/2.x.x/conanfile.py index 44ba8e97757aa9..e72193ff6fadc4 100644 --- a/recipes/catch2/2.x.x/conanfile.py +++ b/recipes/catch2/2.x.x/conanfile.py @@ -11,7 +11,7 @@ class Catch2Conan(ConanFile): name = "catch2" description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD" - topics = ("catch2", "header-only", "unit-test", "tdd", "bdd") + topics = ("header-only", "unit-test", "tdd", "bdd") homepage = "https://github.com/catchorg/Catch2" url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" @@ -46,7 +46,7 @@ def configure(self): self.options.rm_safe("with_benchmark") def package_id(self): - if not self.options.with_main: + if not self.info.options.with_main: self.info.clear() def layout(self): diff --git a/recipes/catch2/2.x.x/test_package/conanfile.py b/recipes/catch2/2.x.x/test_package/conanfile.py index e5d217bf13ce53..d9d04e82d4e3ca 100644 --- a/recipes/catch2/2.x.x/test_package/conanfile.py +++ b/recipes/catch2/2.x.x/test_package/conanfile.py @@ -2,19 +2,20 @@ from conan.tools.cmake import CMake, CMakeToolchain from conan.tools.build import can_run from conan.tools.cmake import cmake_layout +from conan.tools.files import save, load import os -import yaml +import json + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" - _tests_todo = [] @property def _todos_filename(self): - return os.path.join(self.recipe_folder, self.folders.generators, "catch2_test_to_do.yml") + return os.path.join(self.build_folder, "catch2_test_to_do.yml") def requirements(self): self.requires(self.tested_reference_str) @@ -22,20 +23,18 @@ def requirements(self): def generate(self): tc = CMakeToolchain(self) catch_opts = self.dependencies[self.tested_reference_str].options - tc.variables["WITH_PREFIX"] = catch_opts.with_prefix - tc.variables["WITH_MAIN"] = catch_opts.with_main + tc.variables["WITH_PREFIX"] = catch_opts.with_prefix + tc.variables["WITH_MAIN"] = catch_opts.with_main tc.variables["WITH_BENCHMARK"] = not catch_opts.with_prefix and catch_opts.with_main and catch_opts.with_benchmark tc.generate() # note: this is required as self.dependencies is not available in test() - self._tests_todo.append("test_package") + tests_todo = ["test_package"] if catch_opts.with_main: - self._tests_todo.append("standalone") + tests_todo.append("standalone") if not catch_opts.with_prefix and catch_opts.with_main and catch_opts.with_benchmark: - self._tests_todo.append("benchmark") - - with open(self._todos_filename, "w", encoding="utf-8") as file: - yaml.dump(self._tests_todo, file) + tests_todo.append("benchmark") + save(self, self._todos_filename, json.dumps(tests_todo)) def layout(self): cmake_layout(self) @@ -46,8 +45,7 @@ def build(self): cmake.build() def test(self): - with open(self._todos_filename, "r", encoding="utf-8") as file: - self._tests_todo = yaml.safe_load(file) + tests_todo = json.loads(load(self, self._todos_filename)) if can_run(self): - for test_name in self._tests_todo: + for test_name in tests_todo: self.run(os.path.join(self.cpp.build.bindirs[0], test_name), env="conanrun") diff --git a/recipes/charls/all/conandata.yml b/recipes/charls/all/conandata.yml index 0c25d16afadd4f..44bdf87dad81c1 100644 --- a/recipes/charls/all/conandata.yml +++ b/recipes/charls/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.4.1": + url: "https://github.com/team-charls/charls/archive/2.4.1.tar.gz" + sha256: "f313f556b5acb9215961d9718c21235aafcd43bce6b357bf66f772e5692bba75" + "2.4.0": + url: "https://github.com/team-charls/charls/archive/2.4.0.tar.gz" + sha256: "721f4fd6a8dc3ec6a334d1c3c15d1cb9faa149afddd0eff703466c20e775c294" "2.3.4": url: "https://github.com/team-charls/charls/archive/2.3.4.tar.gz" sha256: "28e895a6e22daee76c24cf4d36c62bb20fd60fad0c9cfefc2eb8fa9b6045ae84" diff --git a/recipes/charls/all/conanfile.py b/recipes/charls/all/conanfile.py index 97c3e37e316b8a..b252de9d9dec05 100644 --- a/recipes/charls/all/conanfile.py +++ b/recipes/charls/all/conanfile.py @@ -7,7 +7,7 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class CharlsConan(ConanFile): @@ -39,7 +39,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: @@ -108,6 +108,8 @@ def package_info(self): self.cpp_info.libs = collect_libs(self) if not self.options.shared: self.cpp_info.defines.append("CHARLS_STATIC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/charls/all/test_package/CMakeLists.txt b/recipes/charls/all/test_package/CMakeLists.txt index 4f9a1f4112d6f9..a05d57b66979e3 100644 --- a/recipes/charls/all/test_package/CMakeLists.txt +++ b/recipes/charls/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES C CXX) find_package(charls CONFIG REQUIRED) diff --git a/recipes/charls/all/test_v1_package/CMakeLists.txt b/recipes/charls/all/test_v1_package/CMakeLists.txt index 47ece1bc01777a..be00a8c7f57c71 100644 --- a/recipes/charls/all/test_v1_package/CMakeLists.txt +++ b/recipes/charls/all/test_v1_package/CMakeLists.txt @@ -4,12 +4,5 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(charls CONFIG REQUIRED) - -add_executable(test_package_c ../test_package/test_package.c) -target_link_libraries(test_package_c PRIVATE charls) -set_target_properties(test_package_c PROPERTIES LINKER_LANGUAGE CXX) - -add_executable(test_package_cpp ../test_package/test_package.cpp) -target_link_libraries(test_package_cpp PRIVATE charls) -target_compile_features(test_package_cpp PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/charls/config.yml b/recipes/charls/config.yml index a9e865d288a54b..96f2c11fde345c 100644 --- a/recipes/charls/config.yml +++ b/recipes/charls/config.yml @@ -1,4 +1,8 @@ versions: + "2.4.1": + folder: all + "2.4.0": + folder: all "2.3.4": folder: all "2.2.0": diff --git a/recipes/cimg/all/conandata.yml b/recipes/cimg/all/conandata.yml index 939c703cb331f5..eea92963062f72 100644 --- a/recipes/cimg/all/conandata.yml +++ b/recipes/cimg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.0": + url: "https://cimg.eu/files/CImg_3.2.0.zip" + sha256: "7a923357c3127d8839696c7b0f4eb4c23982c090d3f49fb133f2c8556ca74a88" "3.0.2": url: "https://cimg.eu/files/CImg_3.0.2.zip" sha256: "ee55a37c33d503a64ff264b53952e502ba7c2887b59ded47c47c86ea52ac5c31" diff --git a/recipes/cimg/config.yml b/recipes/cimg/config.yml index 57d368a954f0b4..570cd2f89fed48 100644 --- a/recipes/cimg/config.yml +++ b/recipes/cimg/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.0": + folder: all "3.0.2": folder: all "3.0.0": diff --git a/recipes/cista/all/conandata.yml b/recipes/cista/all/conandata.yml index dd598e2bd2c5c4..1547b3bc2b229b 100644 --- a/recipes/cista/all/conandata.yml +++ b/recipes/cista/all/conandata.yml @@ -1,4 +1,9 @@ sources: + "0.11": + - url: "https://github.com/felixguendling/cista/releases/download/v0.11/cista.h" + sha256: "e2e37fa1f7278e7f1a8dab7d84b6b00f5a0a4fb48f42fbe5761b7ddd0d07314c" + - url: "https://raw.githubusercontent.com/felixguendling/cista/v0.11/LICENSE" + sha256: "fcd47e35fd6dc22feec454c5c1e572ccb7587dedd91d824528ebbb00a7f37c56" "0.10": - url: "https://github.com/felixguendling/cista/releases/download/v0.10/cista.h" sha256: "c06162c73c0fb034170198d79940d2eeecc233140797ab7e3b66053d61a0169b" diff --git a/recipes/cista/all/conanfile.py b/recipes/cista/all/conanfile.py index 6021efe7f66009..a5a461c964a048 100644 --- a/recipes/cista/all/conanfile.py +++ b/recipes/cista/all/conanfile.py @@ -3,10 +3,10 @@ from conan.tools.build import check_min_cppstd from conan.tools.files import copy, download from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" - +required_conan_version = ">=1.52.0" class CistaConan(ConanFile): name = "cista" @@ -21,10 +21,15 @@ class CistaConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _min_cppstd(self): + return 17 + @property def _compilers_minimum_version(self): return { - "Visual Studio": "15.7", + "Visual Studio": "15.7" if Version(self.version) < "0.11" else "16", + "msvc": "191" if Version(self.version) < "0.11" else "192", "gcc": "8", "clang": "6", "apple-clang": "9.1" @@ -35,7 +40,7 @@ def package_id(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -46,7 +51,7 @@ def loose_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), None) if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - f"{self.name} {self.version} requires C++17, which your compiler does not support.", + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", ) def layout(self): @@ -64,7 +69,6 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "cista") self.cpp_info.set_property("cmake_target_name", "cista::cista") + self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/cista/all/test_package/CMakeLists.txt b/recipes/cista/all/test_package/CMakeLists.txt index d342da86f8d00e..17a27c55f0b491 100644 --- a/recipes/cista/all/test_package/CMakeLists.txt +++ b/recipes/cista/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(cista REQUIRED CONFIG) diff --git a/recipes/cista/all/test_v1_package/CMakeLists.txt b/recipes/cista/all/test_v1_package/CMakeLists.txt index d27dfd94cab14e..be00a8c7f57c71 100644 --- a/recipes/cista/all/test_v1_package/CMakeLists.txt +++ b/recipes/cista/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cista REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE cista::cista) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cista/config.yml b/recipes/cista/config.yml index 5808152f9189f9..ac2c19b16c2784 100644 --- a/recipes/cista/config.yml +++ b/recipes/cista/config.yml @@ -1,4 +1,6 @@ versions: + "0.11": + folder: all "0.10": folder: all "0.9": diff --git a/recipes/cityhash/all/conanfile.py b/recipes/cityhash/all/conanfile.py index 35e373369c7eb1..2459b5205cee16 100644 --- a/recipes/cityhash/all/conanfile.py +++ b/recipes/cityhash/all/conanfile.py @@ -1,10 +1,15 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager -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 VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +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.54.0" class CityhashConan(ConanFile): @@ -25,14 +30,6 @@ class CityhashConan(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) @@ -47,69 +44,63 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + 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.options.shared: raise ConanInvalidConfiguration("cityhash does not support shared builds with Visual Studio") def build_requirements(self): - 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") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", 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) - - @contextmanager - def _build_context(self): - if self._is_msvc: - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link -nologo", - "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 = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-shared={}".format(yes_no(self.options.shared)), - ] - if self._is_msvc: - autotools.cxx_flags.append("-EHsc") - if not (self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) < "12"): - autotools.flags.append("-FS") - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + 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 is_msvc(self): + tc.extra_cxxflags.append("-EHsc") + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + env = tc.environment() + if is_msvc(self): + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def build(self): - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.autoreconf() + 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() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["cityhash"] diff --git a/recipes/cityhash/all/test_package/CMakeLists.txt b/recipes/cityhash/all/test_package/CMakeLists.txt index 895a4298a7cae1..9fbe304115d9e0 100644 --- a/recipes/cityhash/all/test_package/CMakeLists.txt +++ b/recipes/cityhash/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(cityhash REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cityhash::cityhash) +target_link_libraries(${PROJECT_NAME} PRIVATE cityhash::cityhash) diff --git a/recipes/cityhash/all/test_package/conanfile.py b/recipes/cityhash/all/test_package/conanfile.py index 38f4483872d47f..0a6bc68712d901 100644 --- a/recipes/cityhash/all/test_package/conanfile.py +++ b/recipes/cityhash/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/cityhash/all/test_v1_package/CMakeLists.txt b/recipes/cityhash/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/cityhash/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/cityhash/all/test_v1_package/conanfile.py b/recipes/cityhash/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/cityhash/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/civetweb/all/conanfile.py b/recipes/civetweb/all/conanfile.py index fd01f187e2af3b..181978c12d7a64 100644 --- a/recipes/civetweb/all/conanfile.py +++ b/recipes/civetweb/all/conanfile.py @@ -99,13 +99,13 @@ def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def generate(self): tc = CMakeToolchain(self) if self.options.with_ssl: - openssl_version = Version(self.dependencies["openssl"].ref.version[:-1]) + openssl_version = Version(str(self.dependencies["openssl"].ref.version)[:-1]) tc.variables["CIVETWEB_ENABLE_SSL"] = self.options.with_ssl tc.variables["CIVETWEB_ENABLE_SSL_DYNAMIC_LOADING"] = self.options.ssl_dynamic_loading tc.variables["CIVETWEB_SSL_OPENSSL_API_1_0"] = openssl_version.minor == "0" diff --git a/recipes/cli11/all/conandata.yml b/recipes/cli11/all/conandata.yml index 36add26ccbad70..fb856253269aa2 100644 --- a/recipes/cli11/all/conandata.yml +++ b/recipes/cli11/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.2": + url: "https://github.com/CLIUtils/CLI11/archive/v2.3.2.tar.gz" + sha256: "aac0ab42108131ac5d3344a9db0fdf25c4db652296641955720a4fbe52334e22" "2.3.1": url: "https://github.com/CLIUtils/CLI11/archive/v2.3.1.tar.gz" sha256: "378da73d2d1d9a7b82ad6ed2b5bda3e7bc7093c4034a1d680a2e009eb067e7b2" diff --git a/recipes/cli11/config.yml b/recipes/cli11/config.yml index 404e9fa4a9f550..37bc8ba7326b9e 100644 --- a/recipes/cli11/config.yml +++ b/recipes/cli11/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.2": + folder: all "2.3.1": folder: all "2.3.0": diff --git a/recipes/cmake/3.x.x/conandata.yml b/recipes/cmake/3.x.x/conandata.yml index 6d9ebddf32aadc..77f6af017496fc 100644 --- a/recipes/cmake/3.x.x/conandata.yml +++ b/recipes/cmake/3.x.x/conandata.yml @@ -20,3 +20,6 @@ sources: "3.25.0": url: "https://github.com/Kitware/CMake/releases/download/v3.25.0/cmake-3.25.0.tar.gz" sha256: "306463f541555da0942e6f5a0736560f70c487178b9d94a5ae7f34d0538cdd48" + "3.25.1": + url: "https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz" + sha256: "1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8" diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index e0d41c4a94794d..96b67934a6d19f 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,20 +1,24 @@ -import os from conan import ConanFile +from conan.tools.files import chdir, copy, rmdir, get, save, load +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version -from conan.tools.files import rmdir, get -from conans import tools, AutoToolsBuildEnvironment, CMake -from conan.errors import ConanInvalidConfiguration, ConanException +from conan.errors import ConanInvalidConfiguration +import os +import json -required_conan_version = ">=1.49.0" +required_conan_version = ">=1.50.0" class CMakeConan(ConanFile): name = "cmake" + package_type = "application" description = "Conan installer for CMake" topics = ("cmake", "build", "installer") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Kitware/CMake" license = "BSD-3-Clause" - generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = { @@ -26,9 +30,6 @@ class CMakeConan(ConanFile): "bootstrap": False, } - _source_subfolder = "source_subfolder" - _cmake = None - def config_options(self): if self.settings.os == "Windows": self.options.with_openssl = False @@ -38,103 +39,112 @@ def requirements(self): self.requires("openssl/1.1.1s") def validate(self): - if self.settings.os == "Macos" and self.settings.arch == "x86": - raise ConanInvalidConfiguration("CMake does not support x86 for macOS") - if self.settings.os == "Windows" and self.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") + if self.settings.os == "Macos" and self.settings.arch == "x86": + raise ConanInvalidConfiguration("CMake does not support x86 for macOS") + minimal_cpp_standard = "11" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, minimal_cpp_standard) minimal_version = { "gcc": "4.8", "clang": "3.3", "apple-clang": "9", "Visual Studio": "14", + "msvc": "190", } compiler = str(self.settings.compiler) if compiler not in minimal_version: - self.output.warn( - "{} recipe lacks information about the {} compiler standard version support".format(self.name, compiler)) - self.output.warn( - "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + self.output.warning( + f"{self.name} recipe lacks information about the {compiler} compiler standard version support") + self.output.warning( + f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") return version = Version(self.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration( - "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") + + def layout(self): + if self.options.bootstrap: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - rmdir(self, os.path.join(self._source_subfolder, "Tests", "RunCMake", "find_package")) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + rmdir(self, os.path.join(self.source_folder, "Tests", "RunCMake", "find_package")) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) + def generate(self): + if self.options.bootstrap: + tc = AutotoolsToolchain(self) + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + bootstrap_cmake_options = ["--"] + bootstrap_cmake_options.append(f'-DCMAKE_CXX_STANDARD={"11" if not self.settings.compiler.cppstd else self.settings.compiler.cppstd}') + if self.settings.os == "Linux": + if self.options.with_openssl: + openssl = self.dependencies["openssl"] + bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=ON") + bootstrap_cmake_options.append(f'-DOPENSSL_USE_STATIC_LIBS={"FALSE" if openssl.options.shared else "TRUE"}') + else: + bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=OFF") + save(self, "bootstrap_args", json.dumps({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)})) + else: + tc = CMakeToolchain(self) if not self.settings.compiler.cppstd: - self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 - self._cmake.definitions["CMAKE_BOOTSTRAP"] = False + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["CMAKE_BOOTSTRAP"] = False if self.settings.os == "Linux": - self._cmake.definitions["CMAKE_USE_OPENSSL"] = self.options.with_openssl + tc.variables["CMAKE_USE_OPENSSL"] = self.options.with_openssl if self.options.with_openssl: - self._cmake.definitions["OPENSSL_USE_STATIC_LIBS"] = not self.options["openssl"].shared - if tools.cross_building(self): - self._cmake.definitions["HAVE_POLL_FINE_EXITCODE"] = '' - self._cmake.definitions["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' - self._cmake.configure(source_folder=self._source_subfolder) - - return self._cmake + openssl = self.dependencies["openssl"] + tc.variables["OPENSSL_USE_STATIC_LIBS"] = not openssl.options.shared + if cross_building(self): + tc.variables["HAVE_POLL_FINE_EXITCODE"] = '' + tc.variables["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' + tc.generate() def build(self): if self.options.bootstrap: - with tools.chdir(self._source_subfolder): - self.run(['./bootstrap', '--prefix={}'.format(self.package_folder), '--parallel={}'.format(tools.cpu_count())]) - autotools = AutoToolsBuildEnvironment(self) + toolchain_file_content = json.loads(load(self, os.path.join(self.generators_folder, "bootstrap_args"))) + bootstrap_cmake_options = toolchain_file_content.get("bootstrap_cmake_options") + with chdir(self, self.source_folder): + self.run(f'./bootstrap --prefix="" --parallel={build_jobs(self)} {bootstrap_cmake_options}') + autotools = Autotools(self) autotools.make() else: - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "project(CMake)", - "project(CMake)\ninclude(\"{}/conanbuildinfo.cmake\")\nconan_basic_setup(NO_OUTPUT_DIRS)".format( - self.install_folder.replace("\\", "/"))) - if self.settings.os == "Linux": - tools.replace_in_file(os.path.join(self._source_subfolder, "Utilities", "cmcurl", "CMakeLists.txt"), - "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})", - "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} pthread)") - - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("Copyright.txt", dst="licenses", src=self._source_subfolder) + copy(self, "Copyright.txt", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) if self.options.bootstrap: - with tools.chdir(self._source_subfolder): - autotools = AutoToolsBuildEnvironment(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() else: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "doc")) def package_id(self): del self.info.settings.compiler + del self.info.options.bootstrap def package_info(self): - module_version = "{}.{}".format(Version(self.version).major, Version(self.version).minor) + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + # Needed for compatibility with v1.x - Remove when 2.0 becomes the default 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) - - 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", 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): - raise ConanException("Module path not found: %s" % mod_path) - - self.cpp_info.includedirs = [] diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index 0b0c4858e1c60e..df50a01c37d6f0 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,23 +1,24 @@ -import os from six import StringIO from conan import ConanFile -from conan.tools.build import can_run +import re class TestPackageConan(ConanFile): - settings = "os", "arch" - generators = "VirtualRunEnv" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - output = StringIO() - 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) - self.output.info("Expected version: {}".format(require_version)) - assert_cmake_version = "cmake version %s" % require_version - assert(assert_cmake_version in output_str) + output = StringIO() + # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it + self.run("cmake --version", output) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + tokens = re.split('[@#]', self.tested_reference_str) + require_version = tokens[0].split("/", 1)[1] + 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/3.x.x/test_v1_package/conanfile.py b/recipes/cmake/3.x.x/test_v1_package/conanfile.py index efb629f7d57250..df9415b7cf880e 100644 --- a/recipes/cmake/3.x.x/test_v1_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_v1_package/conanfile.py @@ -1,23 +1,23 @@ import os from six import StringIO from conan import ConanFile -from conan.tools.build import can_run +import re class TestPackageConan(ConanFile): - settings = "os", "arch" + settings = "os", "arch", "compiler", "build_type" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) + def build_requirements(self): + self.tool_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) + output = StringIO() + self.run("cmake --version", output=output, run_environment=False) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + tokens = re.split('[@#]', self.tested_reference_str) + require_version = tokens[0].split("/", 1)[1] + 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 6075464de552da..ccea93393d10dd 100644 --- a/recipes/cmake/config.yml +++ b/recipes/cmake/config.yml @@ -13,3 +13,5 @@ versions: folder: "3.x.x" "3.25.0": folder: "3.x.x" + "3.25.1": + folder: "3.x.x" diff --git a/recipes/coin-utils/all/conandata.yml b/recipes/coin-utils/all/conandata.yml index 53efde04b8eaaf..66e5f00bfc3438 100644 --- a/recipes/coin-utils/all/conandata.yml +++ b/recipes/coin-utils/all/conandata.yml @@ -2,7 +2,13 @@ sources: "2.11.4": url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.4.tar.gz" sha256: "d4effff4452e73356eed9f889efd9c44fe9cd68bd37b608a5ebb2c58bd45ef81" + "2.11.6": + url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.6.tar.gz" + sha256: "6ea31d5214f7eb27fa3ffb2bdad7ec96499dd2aaaeb4a7d0abd90ef852fc79ca" patches: "2.11.4": - patch_file: "patches/0001-no-check-pkgconfig.patch" base_path: "source_subfolder" + "2.11.6": + - patch_file: "patches/0001-no-check-pkgconfig.patch" + base_path: "source_subfolder" diff --git a/recipes/coin-utils/config.yml b/recipes/coin-utils/config.yml index 2cbd50d2508a16..0500c349417c7b 100644 --- a/recipes/coin-utils/config.yml +++ b/recipes/coin-utils/config.yml @@ -1,3 +1,5 @@ versions: "2.11.4": folder: "all" + "2.11.6": + folder: "all" diff --git a/recipes/commata/all/conandata.yml b/recipes/commata/all/conandata.yml new file mode 100644 index 00000000000000..9371922d5a0ab6 --- /dev/null +++ b/recipes/commata/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.2.3": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v0.2.3.tar.gz" + sha256: "47521aa27b26fe650bd985c4e07df44453f9d09ab0d61ee98dd6877afe4c25a0" diff --git a/recipes/commata/all/conanfile.py b/recipes/commata/all/conanfile.py new file mode 100644 index 00000000000000..3b9d7e615f7d78 --- /dev/null +++ b/recipes/commata/all/conanfile.py @@ -0,0 +1,66 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class CommataConan(ConanFile): + name = "commata" + description = "Just another header-only C++17 CSV parser" + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/furfurylic/commata" + topics = ("csv", "parser", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + 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) + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], 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="*.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/commata/all/test_package/CMakeLists.txt b/recipes/commata/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..f69f5f2677dd57 --- /dev/null +++ b/recipes/commata/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(commata REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE commata::commata) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/commata/all/test_package/conanfile.py b/recipes/commata/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/commata/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/commata/all/test_package/test_package.cpp b/recipes/commata/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..5221c81aef9014 --- /dev/null +++ b/recipes/commata/all/test_package/test_package.cpp @@ -0,0 +1,58 @@ +#include +#include + +#include "commata/parse_csv.hpp" + +template +class test_collector +{ + std::vector>>* field_values_; + std::basic_string field_value_; + +public: + using char_type = Ch; + + explicit test_collector( + std::vector>>& field_values) : + field_values_(&field_values) + {} + + void start_record(const Ch* /*record_begin*/) + { + field_values_->emplace_back(); + } + + void update(const Ch* first, const Ch* last) + { + field_value_.append(first, last); + } + + void finalize(const Ch* first, const Ch* last) + { + field_value_.append(first, last); + field_values_->back().emplace_back(); + field_values_->back().back().swap(field_value_); + // field_value_ is cleared here + } + + void end_record(const Ch* /*record_end*/) + {} +}; + +int main(void) { + std::string s = R"(,"col1", col2 ,col3,)" "\r\n" + "\n" + R"( cell10 ,,"cell)" "\r\n" + R"(12","cell""13""","")" "\n"; + + std::stringbuf buf(s); + + std::vector> field_values; + + test_collector collector(field_values); + commata::parse_csv(&buf, collector); + + std::cout << field_values.size() << '\n'; + + return 0; +} diff --git a/recipes/commata/all/test_v1_package/CMakeLists.txt b/recipes/commata/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/commata/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +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/commata/all/test_v1_package/conanfile.py b/recipes/commata/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/commata/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/commata/config.yml b/recipes/commata/config.yml new file mode 100644 index 00000000000000..cfc2b98c1a462c --- /dev/null +++ b/recipes/commata/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.3": + folder: all diff --git a/recipes/continuable/all/conandata.yml b/recipes/continuable/all/conandata.yml index b1c9fe04e8ebc8..13887549bde390 100644 --- a/recipes/continuable/all/conandata.yml +++ b/recipes/continuable/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.2.1": + url: "https://github.com/Naios/continuable/archive/4.2.1.tar.gz" + sha256: "19c7c2371c94ec759eac8169dea593703b54057551322b5d682643548c9c0146" "4.2.0": url: "https://github.com/Naios/continuable/archive/4.2.0.tar.gz" sha256: "d85bed930ac19d4b36b23778ad9ae943c2981f7492982bd51dadb89e8908d53f" diff --git a/recipes/continuable/config.yml b/recipes/continuable/config.yml index 71d2cb6211de66..52fa67bcd41e8a 100644 --- a/recipes/continuable/config.yml +++ b/recipes/continuable/config.yml @@ -1,4 +1,6 @@ versions: + "4.2.1": + folder: all "4.2.0": folder: all "4.1.0": diff --git a/recipes/cpp-httplib/all/conandata.yml b/recipes/cpp-httplib/all/conandata.yml index dbdbe18e1b5acd..9d3f0340d9f7b4 100644 --- a/recipes/cpp-httplib/all/conandata.yml +++ b/recipes/cpp-httplib/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.11.4": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.11.4.tar.gz" + sha256: "28f76b875a332fb80972c3212980c963f0a7d2e11a8fe94a8ed0d847b9a2256f" "0.11.3": url: "https://github.com/yhirose/cpp-httplib/archive/v0.11.3.tar.gz" sha256: "799b2daa0441d207f6cd1179ae3a34869722084a434da6614978be1682c1e12d" @@ -17,21 +20,6 @@ sources: "0.10.8": url: "https://github.com/yhirose/cpp-httplib/archive/v0.10.8.tar.gz" sha256: "2959ae3669e34ca8934dfe066cd72fc2bfff44ba53bfc26f3b2cb81ed664ca0d" - "0.10.7": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.7.tar.gz" - sha256: "f89e2e74f64821f3cd925750dcee5dde7160600b1122e692253a4ebed8e1b1b1" - "0.10.6": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.6.tar.gz" - sha256: "c9024e1f41881f28ca276f0f35c1916eb34dab8c52b6aa32a3c360d4e40eb440" - "0.10.4": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.4.tar.gz" - sha256: "7719ff9f309c807dd8a574048764836b6a12bcb7d6ae9e129e7e4289cfdb4bd4" - "0.10.3": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.3.tar.gz" - sha256: "2c02fe6bca8407fb260944ecca68de367475e7221912b104f882c278b46d4776" - "0.10.1": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.1.tar.gz" - sha256: "c3fb2019ed77482681b80b9a5d74ddf49df61a024703be1a5379b28fa13dfa2f" "0.9.10": url: "https://github.com/yhirose/cpp-httplib/archive/v0.9.10.tar.gz" sha256: "49dfa101ced75f8536ec7c865f872ab8fca157c8b49e29be5ef2d2aa11f716e8" diff --git a/recipes/cpp-httplib/all/conanfile.py b/recipes/cpp-httplib/all/conanfile.py index 7129662e2807e4..b61cc9bed61d1d 100644 --- a/recipes/cpp-httplib/all/conanfile.py +++ b/recipes/cpp-httplib/all/conanfile.py @@ -12,7 +12,7 @@ class CpphttplibConan(ConanFile): name = "cpp-httplib" description = "A C++11 single-file header-only cross platform HTTP/HTTPS library." license = "MIT" - topics = ("cpp-httplib", "http", "https", "header-only") + topics = ("http", "https", "header-only") homepage = "https://github.com/yhirose/cpp-httplib" url = "https://github.com/conan-io/conan-center-index" diff --git a/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt b/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt index 72809bb080c2cd..be00a8c7f57c71 100644 --- a/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt +++ b/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(httplib REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE httplib::httplib) -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/cpp-httplib/config.yml b/recipes/cpp-httplib/config.yml index 7b7f02579048ef..6960c85b0ed81d 100644 --- a/recipes/cpp-httplib/config.yml +++ b/recipes/cpp-httplib/config.yml @@ -1,4 +1,6 @@ versions: + "0.11.4": + folder: all "0.11.3": folder: all "0.11.2": @@ -11,16 +13,6 @@ versions: folder: all "0.10.8": folder: all - "0.10.7": - folder: all - "0.10.6": - folder: all - "0.10.4": - folder: all - "0.10.3": - folder: all - "0.10.1": - folder: all "0.9.10": folder: all "0.8.9": diff --git a/recipes/cpp-sort/all/conandata.yml b/recipes/cpp-sort/all/conandata.yml index 75a1298f3e54ef..092fe59db4a196 100644 --- a/recipes/cpp-sort/all/conandata.yml +++ b/recipes/cpp-sort/all/conandata.yml @@ -1,31 +1,34 @@ sources: + "1.14.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.14.0.tar.gz" + sha256: "3b85cd4580f54ae3f171777d0630b4f7c89c33cf96e9ae24a1dbebbf200c3195" "1.13.2": - sha256: f5384ed9c8abef2f26cb010df2687ac8bba52f0e1726935826a80e83c1347b23 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.2.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.2.tar.gz" + sha256: "f5384ed9c8abef2f26cb010df2687ac8bba52f0e1726935826a80e83c1347b23" "1.13.1": - sha256: 139912c6004df8748bb1cfd3b94f2c6bfc2713885ed4b8e927a783d6b66963a8 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.1.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.1.tar.gz" + sha256: "139912c6004df8748bb1cfd3b94f2c6bfc2713885ed4b8e927a783d6b66963a8" "1.13.0": - sha256: 646eca5c592d20cbde0fbff41c65527940bb6430be68e0224fb5fcbf38b0df92 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.0.tar.gz" + sha256: "646eca5c592d20cbde0fbff41c65527940bb6430be68e0224fb5fcbf38b0df92" "1.12.1": - sha256: 5b0b6f3b4d9ecc339d6c2204a18479edca49fbc4d487413e0ec747e143569e2a - url: https://github.com/Morwenn/cpp-sort/archive/1.12.1.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.12.1.tar.gz" + sha256: "5b0b6f3b4d9ecc339d6c2204a18479edca49fbc4d487413e0ec747e143569e2a" "1.12.0": - sha256: 70877c1993fa1e5eb53974ac30aeb713448c206344379f193dec8ee887c23998 - url: https://github.com/Morwenn/cpp-sort/archive/1.12.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.12.0.tar.gz" + sha256: "70877c1993fa1e5eb53974ac30aeb713448c206344379f193dec8ee887c23998" "1.11.0": - sha256: a53b3ea240d6f8d8ea9da0a7e0c8e313cf5e714daedf1617473ab34f111ffeec - url: https://github.com/Morwenn/cpp-sort/archive/1.11.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.11.0.tar.gz" + sha256: "a53b3ea240d6f8d8ea9da0a7e0c8e313cf5e714daedf1617473ab34f111ffeec" "1.10.0": - sha256: 48951cac0051d48fee286c3bc02804975f9d83269d80c10dfc5589e76a542765 - url: https://github.com/Morwenn/cpp-sort/archive/1.10.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.10.0.tar.gz" + sha256: "48951cac0051d48fee286c3bc02804975f9d83269d80c10dfc5589e76a542765" "1.9.0": - sha256: e83f3daad30bd91fed668bdb56ad379c4aeea39d7dc640484fdcc55149b6d0e4 - url: https://github.com/Morwenn/cpp-sort/archive/1.9.0.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.9.0.tar.gz" + sha256: "e83f3daad30bd91fed668bdb56ad379c4aeea39d7dc640484fdcc55149b6d0e4" "1.8.1": - sha256: 04d518dabb422614fcb4a2b4e258c515f31dd01d51c26e9eaaec76e77c4d3d40 - url: https://github.com/Morwenn/cpp-sort/archive/1.8.1.tar.gz + url: "https://github.com/Morwenn/cpp-sort/archive/1.8.1.tar.gz" + sha256: "04d518dabb422614fcb4a2b4e258c515f31dd01d51c26e9eaaec76e77c4d3d40" "1.8.0": sha256: a3de426a66cffbe9f8865feb7518ff4f4d1b3aadf3725161b8e118dcbf6fe9b9 url: https://github.com/Morwenn/cpp-sort/archive/1.8.0.tar.gz diff --git a/recipes/cpp-sort/all/conanfile.py b/recipes/cpp-sort/all/conanfile.py index 881a2c63d61be7..cfda199bf6a781 100644 --- a/recipes/cpp-sort/all/conanfile.py +++ b/recipes/cpp-sort/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir -from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version required_conan_version = ">=1.50.0" @@ -14,12 +14,12 @@ class CppSortConan(ConanFile): name = "cpp-sort" description = "Additional sorting algorithms & related tools" - topics = "cpp-sort", "sorting", "algorithms" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Morwenn/cpp-sort" - license = "MIT" + topics = "cpp-sort", "sorting", "algorithms" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "os", "compiler", "build_type", "arch" @property def _minimum_cpp_standard(self): @@ -28,6 +28,8 @@ def _minimum_cpp_standard(self): @property def _compilers_minimum_version(self): return { + "Visual Studio": "16", + "msvc": "192", "apple-clang": "9.4", "clang": "3.8", "gcc": "5.5" @@ -36,29 +38,37 @@ def _compilers_minimum_version(self): def layout(self): cmake_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) - if is_msvc(self): - if Version(self.version) < "1.10.0": - raise ConanInvalidConfiguration("cpp-sort versions older than 1.10.0 do not support MSVC") - check_min_vs(self, 192) - return + if is_msvc(self) and Version(self.version) < "1.10.0": + raise ConanInvalidConfiguration(f"{self.ref} versions older than 1.10.0 do not support MSVC") + + 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] - compiler = self.settings.compiler + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) try: - min_version = self._compilers_minimum_version[str(compiler)] - if Version(compiler.version) < min_version: + minimum_version = self._compilers_minimum_version[str(compiler)] + if minimum_version and loose_lt_semver(version, minimum_version): msg = ( - "{} requires C++{} features which are not supported by compiler {} {}." - ).format(self.name, self._minimum_cpp_standard, compiler, compiler.version) + f"{self.ref} requires C++{self._minimum_cpp_standard} features " + f"which are not supported by compiler {compiler} {version}." + ) raise ConanInvalidConfiguration(msg) except KeyError: msg = ( - "{} recipe lacks information about the {} compiler, " - "support for the required C++{} features is assumed" - ).format(self.name, compiler, self._minimum_cpp_standard) + f"{self.ref} recipe lacks information about the {compiler} compiler, " + f"support for the required C++{self._minimum_cpp_standard} features is assumed" + ) self.output.warn(msg) def source(self): @@ -87,10 +97,9 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "cpp-sort" - self.cpp_info.names["cmake_find_package_multi"] = "cpp-sort" - if self.settings.compiler == "Visual Studio": + self.cpp_info.set_property("cmake_file_name", "cpp-sort") + self.cpp_info.set_property("cmake_target_name", "cpp-sort::cpp-sort") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if is_msvc(self): self.cpp_info.cxxflags = ["/permissive-"] - - def package_id(self): - self.info.clear() diff --git a/recipes/cpp-sort/all/test_package/CMakeLists.txt b/recipes/cpp-sort/all/test_package/CMakeLists.txt index fe9c658362ade3..da13330ac49af6 100644 --- a/recipes/cpp-sort/all/test_package/CMakeLists.txt +++ b/recipes/cpp-sort/all/test_package/CMakeLists.txt @@ -5,5 +5,5 @@ project(test_package LANGUAGES CXX) find_package(cpp-sort REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} cpp-sort-integrity.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} cpp-sort::cpp-sort) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE cpp-sort::cpp-sort) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt b/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt index 4ebb96b60a2931..2a9b48732268c7 100644 --- a/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt +++ b/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,9 @@ 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(cpp-sort REQUIRED CONFIG) - -add_executable(${CMAKE_PROJECT_NAME} cpp-sort-integrity.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} cpp-sort::cpp-sort) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cpp-sort/all/test_v1_package/cpp-sort-integrity.cpp b/recipes/cpp-sort/all/test_v1_package/cpp-sort-integrity.cpp deleted file mode 100644 index 05f269569147f2..00000000000000 --- a/recipes/cpp-sort/all/test_v1_package/cpp-sort-integrity.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2018-2020 Morwenn. - * - * SPDX-License-Identifier: MIT - */ -#include -#include -#include -#include -#include - -int main() -{ - int arr[] = { 5, 8, 3, 2, 9 }; - cppsort::smooth_sort(arr); - assert(std::is_sorted(std::begin(arr), std::end(arr))); - - // should print 2 3 5 8 9 - for (int val: arr) { - std::cout << val << ' '; - } -} diff --git a/recipes/cpp-sort/config.yml b/recipes/cpp-sort/config.yml index 55b2c50d93416f..c097db627e4151 100644 --- a/recipes/cpp-sort/config.yml +++ b/recipes/cpp-sort/config.yml @@ -1,4 +1,6 @@ versions: + "1.14.0": + folder: all "1.13.2": folder: all "1.13.1": diff --git a/recipes/cppcheck/all/conandata.yml b/recipes/cppcheck/all/conandata.yml index d97f5c1a31a95d..43c1f6aca7810e 100644 --- a/recipes/cppcheck/all/conandata.yml +++ b/recipes/cppcheck/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.9.3": + url: "https://github.com/danmar/cppcheck/archive/2.9.3.tar.gz" + sha256: "46319ca73e33e4b2bd91981a76a0d4f184cd3f86b62dc18e8938eabacd3ad2e3" "2.9.2": url: "https://github.com/danmar/cppcheck/archive/2.9.2.tar.gz" sha256: "93920d24d4442856bf7916ee0e3fc31308bc23948e7029b4fd332e01cac63c3e" @@ -9,6 +12,16 @@ sources: url: "https://github.com/danmar/cppcheck/archive/2.7.5.tar.gz" sha256: "6c7ac29e57fa8b3ac7be224510200e579d5a90217e2152591ef46ffc947d8f78" patches: + "2.9.3": + - patch_file: "patches/0001-cli-remove-dmake-cmake.patch" + patch_description: "Remove dmake tool from target ALL" + patch_type: "portability" + - patch_file: "patches/0002-htmlreport-python3.patch" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" "2.9.2": - patch_file: "patches/0001-cli-remove-dmake-cmake.patch" patch_description: "Remove dmake tool from target ALL" diff --git a/recipes/cppcheck/all/conanfile.py b/recipes/cppcheck/all/conanfile.py index 4427cdebe7d181..bccb77ffc64c6c 100644 --- a/recipes/cppcheck/all/conanfile.py +++ b/recipes/cppcheck/all/conanfile.py @@ -1,5 +1,4 @@ from conan import ConanFile -from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version @@ -20,7 +19,7 @@ class CppcheckConan(ConanFile): default_options = {"with_z3": True, "have_rules": True} def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def export_sources(self): export_conandata_patches(self) @@ -45,8 +44,7 @@ def generate(self): tc.variables["HAVE_RULES"] = self.options.have_rules tc.variables["USE_MATCHCOMPILER"] = "Auto" tc.variables["ENABLE_OSS_FUZZ"] = False - if is_apple_os(self): - tc.variables["FILESDIR"] = os.path.join(self.package_folder, "bin", "cfg") + tc.variables["FILESDIR"] = os.path.join(self.package_folder, "res").replace('\\', '/') tc.generate() deps = CMakeDeps(self) @@ -60,7 +58,6 @@ def build(self): def package(self): copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder)) - copy(self, "*", dst=os.path.join(self.package_folder, "bin", "cfg"), src=os.path.join(self.source_folder, "cfg")) copy(self, "cppcheck-htmlreport", dst=os.path.join(self.package_folder, "bin"), src=os.path.join(self.source_folder, "htmlreport")) cmake = CMake(self) cmake.install() @@ -71,7 +68,7 @@ def package_info(self): self.cpp_info.libdirs = [] bin_folder = os.path.join(self.package_folder, "bin") - self.output.info("Append %s to environment variable PATH" % bin_folder) + self.output.info(f"Append {bin_folder} to environment variable PATH") self.env_info.PATH.append(bin_folder) cppcheck_htmlreport = os.path.join(bin_folder, "cppcheck-htmlreport") self.env_info.CPPCHECK_HTMLREPORT = cppcheck_htmlreport diff --git a/recipes/cppcheck/config.yml b/recipes/cppcheck/config.yml index bc6d13a4fc4ca3..ec0fd43bf08caf 100644 --- a/recipes/cppcheck/config.yml +++ b/recipes/cppcheck/config.yml @@ -1,4 +1,6 @@ versions: + "2.9.3": + folder: all "2.9.2": folder: all "2.8.2": diff --git a/recipes/cppfront/all/conandata.yml b/recipes/cppfront/all/conandata.yml index 9256a02f34f3ac..3db3937d63c0d5 100644 --- a/recipes/cppfront/all/conandata.yml +++ b/recipes/cppfront/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20230103": + url: "https://github.com/hsutter/cppfront/archive/808db2bd6ae92f869166827dfda66cfa42dde0ab.zip" + sha256: "479252c99d66db477c4cd98a6e1707a8929a70afdf000c75589841d944c539f4" "cci.20221024": url: "https://github.com/hsutter/cppfront/archive/b1754dbd53a496a9104b43ecde6064c9980246bd.zip" sha256: "8668bddbd7fc06d4975c867521c005f898eca8f83f018e7c28b54dbcf9aa3ab9" diff --git a/recipes/cppfront/config.yml b/recipes/cppfront/config.yml index 58e5c15a9b457a..50c5629b6e0252 100644 --- a/recipes/cppfront/config.yml +++ b/recipes/cppfront/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20230103": + folder: all "cci.20221024": folder: all "cci.20220924": diff --git a/recipes/cpr/all/conandata.yml b/recipes/cpr/all/conandata.yml index ae148b6df8b7da..b89a362a8deb44 100644 --- a/recipes/cpr/all/conandata.yml +++ b/recipes/cpr/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.9.3": + url: "https://github.com/libcpr/cpr/archive/refs/tags/1.9.3.tar.gz" + sha256: "df53e7213d80fdc24583528521f7d3349099f5bb4ed05ab05206091a678cc53c" "1.9.0": url: "https://github.com/libcpr/cpr/archive/refs/tags/1.9.0.tar.gz" sha256: "67023cde8979e8371f5ee7d6e586d6d0761af4a3a3a3be6270256353c9bf411f" @@ -18,19 +21,43 @@ sources: url: "https://github.com/libcpr/cpr/archive/1.4.0.tar.gz" sha256: "13baffba95445e02291684e31906b04df41d8c6a3020a1a55253047c6756a004" patches: + "1.9.3": + - patch_file: "patches/005-1.9.3-fix-curl-components.patch" + patch_description: "use cci package" + patch_type: "conan" "1.9.0": - patch_file: "patches/005-1.9.0-fix-curl-components.patch" + patch_description: "use cci package" + patch_type: "conan" "1.8.1": - patch_file: "patches/005-1.8.1-fix-curl-components.patch" + patch_description: "use cci package" + patch_type: "conan" - patch_file: "patches/007-fix-dll-install.patch" + patch_description: "fix install path for dll" + patch_type: "conan" "1.7.2": - patch_file: "patches/005-1.7.2-fix-curl-components.patch" + patch_description: "use cci package" + patch_type: "conan" - patch_file: "patches/007-fix-dll-install.patch" + patch_description: "fix install path for dll" + patch_type: "conan" "1.6.2": - patch_file: "patches/005-1.6.2-fix-curl-components.patch" + patch_description: "use cci package" + patch_type: "conan" "1.5.2": - patch_file: "patches/005-1.5.2-fix-curl-components.patch" + patch_description: "use cci package" + patch_type: "conan" "1.4.0": - patch_file: "patches/002-1.4.0-create-install.patch" + patch_description: "add install definition" + patch_type: "conan" - patch_file: "patches/003-1.4.0-curl-use-target.patch" + patch_description: "link curl library as target name" + patch_type: "portability" - patch_file: "patches/004-1.4.0-curl-global-scope.patch" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/cpr/all/conanfile.py b/recipes/cpr/all/conanfile.py index 59e6531931412b..e22134e21d95ee 100644 --- a/recipes/cpr/all/conanfile.py +++ b/recipes/cpr/all/conanfile.py @@ -152,7 +152,7 @@ def validate(self): if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") - if Version(self.version) == "1.9.0" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": + if Version(self.version) >= "1.9.0" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc < 6") def source(self): diff --git a/recipes/cpr/all/patches/005-1.9.3-fix-curl-components.patch b/recipes/cpr/all/patches/005-1.9.3-fix-curl-components.patch new file mode 100644 index 00000000000000..dee08272019c76 --- /dev/null +++ b/recipes/cpr/all/patches/005-1.9.3-fix-curl-components.patch @@ -0,0 +1,21 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 0c10971..9627982 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -150,6 +150,8 @@ endif() + + # Curl configuration + if(CPR_FORCE_USE_SYSTEM_CURL) ++ find_package(CURL REQUIRED) ++ if(0) + if(CPR_ENABLE_SSL) + find_package(CURL COMPONENTS HTTP HTTPS) + if(CURL_FOUND) +@@ -174,6 +176,7 @@ if(CPR_FORCE_USE_SYSTEM_CURL) + message(FATAL_ERROR "Curl not found on this system. To use the build in version set CPR_FORCE_USE_SYSTEM_CURL to OFF.") + endif() + endif() ++ endif() + else() + message(STATUS "Configuring build in curl...") + diff --git a/recipes/cpr/config.yml b/recipes/cpr/config.yml index 3ceff74829cd98..d3e1bfcad9ced4 100644 --- a/recipes/cpr/config.yml +++ b/recipes/cpr/config.yml @@ -1,4 +1,6 @@ versions: + "1.9.3": + folder: all "1.9.0": folder: all "1.8.1": diff --git a/recipes/cryptopp/all/conanfile.py b/recipes/cryptopp/all/conanfile.py index 7c5dae06bd13b1..b83ed6c1a84a1b 100644 --- a/recipes/cryptopp/all/conanfile.py +++ b/recipes/cryptopp/all/conanfile.py @@ -36,9 +36,20 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + def build_requirements(self): - if Version(self.version) >= "8.7.0": - self.tool_requires("cmake/3.24.0") + if Version(self.version) >= "8.7.0" and not self._cmake_new_enough("3.20"): + self.tool_requires("cmake/3.20.6") def validate(self): if self.options.shared and Version(self.version) >= "8.7.0": diff --git a/recipes/csvmonkey/all/conanfile.py b/recipes/csvmonkey/all/conanfile.py index 70c4748ec7036c..49542ed86e55ce 100644 --- a/recipes/csvmonkey/all/conanfile.py +++ b/recipes/csvmonkey/all/conanfile.py @@ -1,56 +1,78 @@ -import os - +from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan import ConanFile, tools +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class CSVMONEKYConan(ConanFile): name = "csvmonkey" + description = "Header-only vectorized, lazy-decoding, zero-copy CSV file parser" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" - description = "Header-only vectorized, lazy-decoding, zero-copy CSV file parser " - topics = ("csv-parser", "header-only", "vectorized") homepage = "https://github.com/dw/csvmonkey/" - settings = "arch", "compiler" + topics = ("csv-parser", "header-only", "vectorized") + settings = "os", "arch", "compiler", "build_type" + options = { + "with_spirit": [True, False], + } + default_options = { + "with_spirit": False, + } no_copy_source = True - options = {"with_spirit": [True, False]} - default_options = {"with_spirit": False} @property - def _source_subfolder(self): - return "source_subfolder" - - def validate(self): - if self.settings.arch not in ("x86", "x86_64",): - raise ConanInvalidConfiguration("{} requires x86 architecture.".format(self.name)) + def _min_cppstd(self): + return 11 - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("{} doesn't support Visual Studio C++.".format(self.name)) + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_spirit: - self.requires("boost/1.77.0") + self.requires("boost/1.81.0") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if self.settings.arch not in ("x86", "x86_64",): + raise ConanInvalidConfiguration(f"{self.ref} requires x86 architecture.") + + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio C++.") 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], strip_root=True) def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) - - def package_id(self): - self.info.header_only() + 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 = [] + self.cpp_info.set_property("cmake_file_name", "csvmonkey") self.cpp_info.set_property("cmake_target_name", "csvmonkey::csvmonkey") self.cpp_info.set_property("pkg_config_name", "csvmonkey") + if self.options.with_spirit: + self.cpp_info.defines.append("USE_SPIRIT") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "csvmonkey" self.cpp_info.filenames["cmake_find_package_multi"] = "csvmonkey" self.cpp_info.names["cmake_find_package"] = "csvmonkey" self.cpp_info.names["cmake_find_package_multi"] = "csvmonkey" - - if self.options.with_spirit: - self.cpp_info.defines.append("USE_SPIRIT") diff --git a/recipes/csvmonkey/all/test_package/CMakeLists.txt b/recipes/csvmonkey/all/test_package/CMakeLists.txt index 6f39b9addc9e6b..fd4b892a1c012a 100644 --- a/recipes/csvmonkey/all/test_package/CMakeLists.txt +++ b/recipes/csvmonkey/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(csvmonkey CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} csvmonkey::csvmonkey) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE csvmonkey::csvmonkey) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/csvmonkey/all/test_package/conanfile.py b/recipes/csvmonkey/all/test_package/conanfile.py index 69bc51936474f1..a9fb96656f2039 100644 --- a/recipes/csvmonkey/all/test_package/conanfile.py +++ b/recipes/csvmonkey/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 conan import ConanFile, tools -from conans import CMake -class CSVMonkeyTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + +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) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.build.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/csvmonkey/all/test_v1_package/CMakeLists.txt b/recipes/csvmonkey/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/csvmonkey/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/csvmonkey/all/test_v1_package/conanfile.py b/recipes/csvmonkey/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/csvmonkey/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/czmq/all/CMakeLists.txt b/recipes/czmq/all/CMakeLists.txt deleted file mode 100644 index 9b9d3d634acc0e..00000000000000 --- a/recipes/czmq/all/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -if(MSVC) - add_definitions("-D_NOEXCEPT=noexcept") -endif() - -if(NOT BUILD_SHARED_LIBS) - add_definitions("-DCZMQ_STATIC") -endif() - -add_subdirectory(source_subfolder) - -foreach(TARGET zmakecert zsp test_randof czmq_selftest) - set_target_properties("${TARGET}" - PROPERTIES EXCLUDE_FROM_ALL ON) -endforeach() diff --git a/recipes/czmq/all/conandata.yml b/recipes/czmq/all/conandata.yml index ae7b2a74b8950c..9c67f10778c980 100644 --- a/recipes/czmq/all/conandata.yml +++ b/recipes/czmq/all/conandata.yml @@ -1,14 +1,20 @@ sources: + "4.2.1": + url: "https://github.com/zeromq/czmq/archive/v4.2.1.tar.gz" + sha256: "83457cd32a2c2615b8d7ebcf91b198cb0d8df383a2072b96835ab250164d8a83" "4.2.0": url: "https://github.com/zeromq/czmq/archive/v4.2.0.tar.gz" sha256: "31185090b500b64855003be2450ced00efa6b58544639acfc68aa13c9ec249f8" patches: + "4.2.1": + - patch_file: patches/4.2.1-0001-fix-cmake.patch + patch_description: "set LINKER_LANGUAGE, disable executable and tests" + patch_type: "conan" + - patch_file: patches/4.2.1-0002-fix-zsys_thread-issue.patch + patch_description: "addresses three problems related to ZSYS_THREAD_NAME_PREFIX / ZSYS_THREAD_NAME_PREFIX_STR:" + patch_type: "bugfix" + patch_source: "https://github.com/zeromq/czmq/pull/2162" "4.2.0": - - base_path: source_subfolder - patch_file: patches/0001-allow-cmake-subproject.patch - - base_path: source_subfolder - patch_file: patches/0002-dont-build-zmakecert.patch - - base_path: source_subfolder - patch_file: patches/0003-fix-cmake-find-package.patch - - base_path: source_subfolder - patch_file: patches/0004-make-czmq-link-using-cxx-compiler.patch + - patch_file: patches/4.2.0-0001-fix-cmake.patch + patch_description: "add options which are added in 4.2.1, set LINKER_LANGUAGE, disable executable and tests" + patch_type: "conan" diff --git a/recipes/czmq/all/conanfile.py b/recipes/czmq/all/conanfile.py index 916303c3f9b24c..ca6710a21cdb37 100644 --- a/recipes/czmq/all/conanfile.py +++ b/recipes/czmq/all/conanfile.py @@ -1,112 +1,122 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.apple import is_apple_os +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, save +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.errors import ConanInvalidConfiguration import os import textwrap -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class CzmqConan(ConanFile): name = "czmq" - homepage = "https://github.com/zeromq/czmq" description = "High-level C binding for ZeroMQ" - topics = ("zmq", "libzmq", "message-queue", "asynchronous") - url = "https://github.com/conan-io/conan-center-index" license = "MPL-2.0" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/zeromq/czmq" + topics = ("zmq", "libzmq", "message-queue", "asynchronous") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "enable_drafts": [True, False], "with_libcurl": [True, False], "with_lz4": [True, False], "with_libuuid": [True, False], + "with_systemd": [True, False], } default_options = { "shared": False, + "enable_drafts": False, "fPIC": True, "with_libcurl": True, "with_lz4": True, "with_libuuid": True, + "with_systemd": False, } - 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": del self.options.fPIC # libuuid is not available on Windows del self.options.with_libuuid + if self.settings.os == "Linux": + del self.options.with_systemd def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/1.1.1m") # zdigest depends on openssl + self.requires("openssl/1.1.1s") # zdigest depends on openssl self.requires("zeromq/4.3.4") + if self.options.enable_drafts: + self.requires("libmicrohttpd/0.9.75") if self.options.with_libcurl: - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.86.0") if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.get_safe("with_libuuid"): self.requires("libuuid/1.0.3") + if self.options.get_safe("with_systemd"): + self.requires("libsystemd/252.4") + + def validate(self): + if is_apple_os(self) and self.options.shared and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared and debug on apple-clang.") 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["CZMQ_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["CZMQ_BUILD_STATIC"] = not self.options.shared - 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.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["CZMQ_BUILD_SHARED"] = self.options.shared + tc.variables["CZMQ_BUILD_STATIC"] = not self.options.shared + tc.variables["CZMQ_WITH_UUID"] = self.options.get_safe("with_libuuid", False) + tc.variables["CZMQ_WITH_SYSTEMD"] = self.options.get_safe("with_systemd", False) + tc.variables["CZMQ_WITH_LZ4"] = self.options.get_safe("with_lz4", False) + tc.variables["CZMQ_WITH_LIBCURL"] = self.options.get_safe("with_libcurl", False) + tc.variables["CZMQ_WITH_LIBMICROHTTPD"] = self.options.enable_drafts + if is_msvc(self): + tc.preprocessor_definitions["_NOEXCEPT"] = "noexcept" + if self.options.shared: + tc.preprocessor_definitions["CZMQ_STATIC"] = 1 + tc.generate() + + dpes = CMakeDeps(self) + dpes.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + # remove custom Finduuid.cmake to use cci Finduuid.cmake + rm(self, "Finduuid.cmake", self.source_folder) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - 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, "CMake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed + rmdir(self, 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, "share")) + self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {self._czmq_target: "czmq::czmq"} ) - @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("""\ @@ -115,7 +125,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): @@ -129,18 +139,14 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "czmq") self.cpp_info.set_property("cmake_target_name", self._czmq_target) self.cpp_info.set_property("pkg_config_name", "libczmq") - prefix = "lib" if self._is_msvc and not self.options.shared else "" - self.cpp_info.libs = ["{}czmq".format(prefix)] + prefix = "lib" if is_msvc(self) and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix}czmq"] if not self.options.shared: self.cpp_info.defines.append("CZMQ_STATIC") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["pthread", "m"]) elif self.settings.os == "Windows": self.cpp_info.system_libs.append("rpcrt4") - if not self.options.shared: - stdcpp_library = tools.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.system_libs.append(stdcpp_library) # 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/czmq/all/patches/0001-allow-cmake-subproject.patch b/recipes/czmq/all/patches/0001-allow-cmake-subproject.patch deleted file mode 100644 index ba289825b0a1f6..00000000000000 --- a/recipes/czmq/all/patches/0001-allow-cmake-subproject.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -74,7 +74,7 @@ endif() - - file(REMOVE "${SOURCE_DIR}/src/platform.h") - --file(WRITE "${CMAKE_BINARY_DIR}/platform.h.in" " -+file(WRITE "${PROJECT_BINARY_DIR}/platform.h.in" " - #cmakedefine HAVE_LINUX_WIRELESS_H - #cmakedefine HAVE_NET_IF_H - #cmakedefine HAVE_NET_IF_MEDIA_H -@@ -82,7 +82,7 @@ file(WRITE "${CMAKE_BINARY_DIR}/platform.h.in" " - #cmakedefine HAVE_FREEIFADDRS - ") - --configure_file("${CMAKE_BINARY_DIR}/platform.h.in" "${CMAKE_BINARY_DIR}/platform.h") -+configure_file("${PROJECT_BINARY_DIR}/platform.h.in" "${PROJECT_BINARY_DIR}/platform.h") - - #The MSVC C compiler is too out of date, - #so the sources have to be compiled as c++ -@@ -299,7 +299,7 @@ install(FILES ${czmq_headers} DESTINATION include) - ######################################################################## - - --include_directories("${SOURCE_DIR}/src" "${SOURCE_DIR}/include" "${CMAKE_BINARY_DIR}") -+include_directories("${SOURCE_DIR}/src" "${SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}") - set (czmq_sources - src/zactor.c - src/zarmour.c -@@ -658,17 +658,17 @@ ENDIF (ENABLE_DRAFTS) - - add_custom_target( - copy-selftest-ro ALL -- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/selftest-ro ${CMAKE_BINARY_DIR}/src/selftest-ro -+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/src/selftest-ro ${PROJECT_BINARY_DIR}/src/selftest-ro - ) - - add_custom_target( - make-selftest-rw ALL -- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/src/selftest-rw -+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/src/selftest-rw - ) - - set_directory_properties( - PROPERTIES -- ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/src/selftest-ro;${CMAKE_BINARY_DIR}/src/selftest-rw" -+ ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_BINARY_DIR}/src/selftest-ro;${PROJECT_BINARY_DIR}/src/selftest-rw" - ) - - foreach(TEST_CLASS ${TEST_CLASSES}) -@@ -693,22 +693,22 @@ include(CTest) - ######################################################################## - add_custom_target (distclean @echo Cleaning for source distribution) - --set(cmake_generated ${CMAKE_BINARY_DIR}/CMakeCache.txt -- ${CMAKE_BINARY_DIR}/cmake_install.cmake -- ${CMAKE_BINARY_DIR}/Makefile -- ${CMAKE_BINARY_DIR}/CMakeFiles -- ${CMAKE_BINARY_DIR}/CTestTestfile.cmake -- ${CMAKE_BINARY_DIR}/DartConfiguration.tcl -- ${CMAKE_BINARY_DIR}/Testing -- ${CMAKE_BINARY_DIR}/compile_commands.json -- ${CMAKE_BINARY_DIR}/platform.h -- ${CMAKE_BINARY_DIR}/src/libczmq.pc -- ${CMAKE_BINARY_DIR}/src/libczmq.so -- ${CMAKE_BINARY_DIR}/src/czmq_selftest -- ${CMAKE_BINARY_DIR}/src/zmakecert -- ${CMAKE_BINARY_DIR}/src/zsp -- ${CMAKE_BINARY_DIR}/src/test_randof -- ${CMAKE_BINARY_DIR}/src/czmq_selftest -+set(cmake_generated ${PROJECT_BINARY_DIR}/CMakeCache.txt -+ ${PROJECT_BINARY_DIR}/cmake_install.cmake -+ ${PROJECT_BINARY_DIR}/Makefile -+ ${PROJECT_BINARY_DIR}/CMakeFiles -+ ${PROJECT_BINARY_DIR}/CTestTestfile.cmake -+ ${PROJECT_BINARY_DIR}/DartConfiguration.tcl -+ ${PROJECT_BINARY_DIR}/Testing -+ ${PROJECT_BINARY_DIR}/compile_commands.json -+ ${PROJECT_BINARY_DIR}/platform.h -+ ${PROJECT_BINARY_DIR}/src/libczmq.pc -+ ${PROJECT_BINARY_DIR}/src/libczmq.so -+ ${PROJECT_BINARY_DIR}/src/czmq_selftest -+ ${PROJECT_BINARY_DIR}/src/zmakecert -+ ${PROJECT_BINARY_DIR}/src/zsp -+ ${PROJECT_BINARY_DIR}/src/test_randof -+ ${PROJECT_BINARY_DIR}/src/czmq_selftest - ) - - add_custom_command( --- -2.21.0 - diff --git a/recipes/czmq/all/patches/0002-dont-build-zmakecert.patch b/recipes/czmq/all/patches/0002-dont-build-zmakecert.patch deleted file mode 100644 index 069bf10a74ad83..00000000000000 --- a/recipes/czmq/all/patches/0002-dont-build-zmakecert.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -502,7 +502,7 @@ - # executables - ######################################################################## - add_executable( -+ zmakecert EXCLUDE_FROM_ALL -- zmakecert - "${SOURCE_DIR}/src/zmakecert.c" - ) - if (TARGET czmq) -@@ -522,9 +522,9 @@ - ${OPTIONAL_LIBRARIES_STATIC} - ) - endif() --install(TARGETS zmakecert -- RUNTIME DESTINATION bin --) -+#install(TARGETS zmakecert -+# RUNTIME DESTINATION bin -+#) - add_executable( - zsp - "${SOURCE_DIR}/src/zsp.c" diff --git a/recipes/czmq/all/patches/0003-fix-cmake-find-package.patch b/recipes/czmq/all/patches/0003-fix-cmake-find-package.patch deleted file mode 100644 index ff1a6455a6955d..00000000000000 --- a/recipes/czmq/all/patches/0003-fix-cmake-find-package.patch +++ /dev/null @@ -1,203 +0,0 @@ ---- Findlibcurl.cmake -+++ Findlibcurl.cmake -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBCURL "libcurl") - if (PC_LIBCURL_FOUND) -@@ -17,17 +17,9 @@ - endif(PC_LIBCURL_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBCURL_INCLUDE_DIRS -- NAMES curl/curl.h -- HINTS ${PC_LIBCURL_INCLUDE_HINTS} --) -- --find_library ( -- LIBCURL_LIBRARIES -- NAMES curl -- HINTS ${PC_LIBCURL_LIBRARY_HINTS} --) -+set(LIBCURL_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_CURL}) -+ -+set(LIBCURL_LIBRARIES CONAN_PKG::CURL) - - include(FindPackageHandleStandardArgs) - ---- Findlibmicrohttpd.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlibmicrohttpd.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBMICROHTTPD "libmicrohttpd") - if (PC_LIBMICROHTTPD_FOUND) -@@ -17,17 +17,9 @@ - endif(PC_LIBMICROHTTPD_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBMICROHTTPD_INCLUDE_DIRS -- NAMES microhttpd.h -- HINTS ${PC_LIBMICROHTTPD_INCLUDE_HINTS} --) -- --find_library ( -- LIBMICROHTTPD_LIBRARIES -- NAMES microhttpd -- HINTS ${PC_LIBMICROHTTPD_LIBRARY_HINTS} --) -+set(LIBMICROHTTPD_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBMICROHTTPD}) -+link_directories(${CONAN_LIB_DIRS_LIBMICROHTTPD}) -+set(LIBLIBMICROHTTPD_LIBRARIES_DIRS ${CONAN_LIBS_LIBLIBMICROHTTPD} ${CONAN_SYSTEM_LIBS_LIBLIBMICROHTTPD}) - - include(FindPackageHandleStandardArgs) - ---- Findlibsodium.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlibsodium.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Please refer to the README for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBSODIUM "libsodium") - if (NOT PC_LIBSODIUM_FOUND) -@@ -18,17 +18,10 @@ - endif(PC_LIBSODIUM_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBSODIUM_INCLUDE_DIRS -- NAMES sodium.h -- HINTS ${PC_LIBSODIUM_INCLUDE_HINTS} --) -- --find_library ( -- LIBSODIUM_LIBRARIES -- NAMES sodium -- HINTS ${PC_LIBSODIUM_LIBRARY_HINTS} --) -+set(LIBSODIUM_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBSODIUM}) -+link_directories(${CONAN_LIB_DIRS_LIBSODIUM}) -+set(LIBSODIUM_LIBRARIES ${CONAN_LIBS_LIBSODIUM} ${CONAN_SYSTEM_LIBS_LIBSODIUM}) -+add_definitions(${CONAN_DEFINES_LIBSODIUM}) - - include(FindPackageHandleStandardArgs) - ---- Findlibzmq.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlibzmq.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBZMQ "libzmq") - if (PC_LIBZMQ_FOUND) -@@ -17,19 +17,16 @@ - endif(PC_LIBZMQ_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBZMQ_INCLUDE_DIRS -- NAMES zmq.h -- HINTS ${PC_LIBZMQ_INCLUDE_HINTS} --) -- --find_library ( -- LIBZMQ_LIBRARIES -- NAMES zmq -- HINTS ${PC_LIBZMQ_LIBRARY_HINTS} --) -- -+set(LIBZMQ_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_ZEROMQ}) -+link_directories(${CONAN_LIB_DIRS_ZEROMQ}) -+set(LIBZMQ_LIBRARIES ${CONAN_LIBS_ZEROMQ} ${CONAN_SYSTEM_LIBS_ZEROMQ}) - include(FindPackageHandleStandardArgs) -+add_definitions(${CONAN_DEFINES_ZEROMQ}) -+ -+if(DEFINED CONAN_INCLUDE_DIRS_LIBSODIUM) -+ find_package(libsodium REQUIRED) -+ list(APPEND LIBZMQ_LIBRARIES ${LIBSODIUM_LIBRARIES}) -+endif() - - find_package_handle_standard_args( - LIBZMQ ---- Findlz4.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlz4.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LZ4 "liblz4") - if (PC_LZ4_FOUND) -@@ -17,17 +17,10 @@ - endif(PC_LZ4_FOUND) - endif (NOT MSVC) - --find_path ( -- LZ4_INCLUDE_DIRS -- NAMES lz4.h -- HINTS ${PC_LZ4_INCLUDE_HINTS} --) -- --find_library ( -- LZ4_LIBRARIES -- NAMES lz4 -- HINTS ${PC_LZ4_LIBRARY_HINTS} --) -+set(LZ4_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LZ4}) -+link_directories(${CONAN_LIB_DIRS_LZ4}) -+set(LZ4_LIBRARIES ${CONAN_LIBS_LZ4} ${CONAN_SYSTEM_LIBS_LZ4}) -+add_definitions(${CONAN_DEFINES_LZ4}) - - include(FindPackageHandleStandardArgs) - ---- Finduuid.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Finduuid.cmake 2019-12-14 14:54:53.668244813 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_UUID "uuid") - if (PC_UUID_FOUND) -@@ -17,17 +17,10 @@ - endif(PC_UUID_FOUND) - endif (NOT MSVC) - --find_path ( -- UUID_INCLUDE_DIRS -- NAMES uuid/uuid.h -- HINTS ${PC_UUID_INCLUDE_HINTS} --) -- --find_library ( -- UUID_LIBRARIES -- NAMES uuid -- HINTS ${PC_UUID_LIBRARY_HINTS} --) -+set(UUID_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBUUID}) -+link_directories(${CONAN_LIB_DIRS_LIBUUID}) -+set(UUID_LIBRARIES ${CONAN_LIBS_LIBUUID} ${CONAN_SYSTEM_LIBS_LIBUUID}) -+add_definitions(${CONAN_DEFINES_LIBUUID}) - - include(FindPackageHandleStandardArgs) - diff --git a/recipes/czmq/all/patches/0004-make-czmq-link-using-cxx-compiler.patch b/recipes/czmq/all/patches/0004-make-czmq-link-using-cxx-compiler.patch deleted file mode 100644 index 5137f6e7d0c154..00000000000000 --- a/recipes/czmq/all/patches/0004-make-czmq-link-using-cxx-compiler.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -380,5 +380,6 @@ - ENDIF (MSVC) - - set_target_properties (czmq PROPERTIES -+ LINKER_LANGUAGE CXX - PUBLIC_HEADER "${public_headers}" - DEFINE_SYMBOL "CZMQ_EXPORTS" diff --git a/recipes/czmq/all/patches/4.2.0-0001-fix-cmake.patch b/recipes/czmq/all/patches/4.2.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..962bae9a6cb998 --- /dev/null +++ b/recipes/czmq/all/patches/4.2.0-0001-fix-cmake.patch @@ -0,0 +1,152 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index de4e150..93a0727 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -120,25 +120,26 @@ set(OPTIONAL_LIBRARIES_STATIC) + ######################################################################## + # LIBZMQ dependency + ######################################################################## +-find_package(libzmq REQUIRED) +-IF (LIBZMQ_FOUND) +- include_directories(${LIBZMQ_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBZMQ_LIBRARIES}) ++find_package(ZeroMQ REQUIRED) ++IF (ZeroMQ_FOUND) ++ include_directories(${ZeroMQ_INCLUDE_DIRS}) ++ list(APPEND MORE_LIBRARIES ${ZeroMQ_LIBRARIES}) + IF (PC_LIBZMQ_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libzmq") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBZMQ_STATIC_LDFLAGS}) + ELSE (PC_LIBZMQ_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lzmq") + ENDIF (PC_LIBZMQ_FOUND) +-ELSE (LIBZMQ_FOUND) ++ELSE (ZeroMQ_FOUND) + message( FATAL_ERROR "libzmq not found." ) +-ENDIF (LIBZMQ_FOUND) ++ENDIF (ZeroMQ_FOUND) + + ######################################################################## + # UUID dependency + ######################################################################## + find_package(uuid) +-IF (UUID_FOUND) ++option(CZMQ_WITH_UUID "Build czmq with uuid" ${UUID_FOUND}) ++IF (CZMQ_WITH_UUID AND UUID_FOUND) + include_directories(${UUID_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${UUID_LIBRARIES}) + IF (PC_UUID_FOUND) +@@ -149,13 +150,14 @@ IF (UUID_FOUND) + ENDIF (PC_UUID_FOUND) + add_definitions(-DHAVE_UUID) + list(APPEND OPTIONAL_LIBRARIES ${UUID_LIBRARIES}) +-ENDIF (UUID_FOUND) ++ENDIF (CZMQ_WITH_UUID AND UUID_FOUND) + + ######################################################################## + # SYSTEMD dependency + ######################################################################## + find_package(systemd) +-IF (SYSTEMD_FOUND) ++option(CZMQ_WITH_SYSTEMD "Build czmq with systemd" ${SYSTEMD_FOUND}) ++IF (CZMQ_WITH_SYSTEMD AND SYSTEMD_FOUND) + include_directories(${SYSTEMD_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${SYSTEMD_LIBRARIES}) + IF (PC_SYSTEMD_FOUND) +@@ -166,13 +168,14 @@ IF (SYSTEMD_FOUND) + ENDIF (PC_SYSTEMD_FOUND) + add_definitions(-DHAVE_LIBSYSTEMD) + list(APPEND OPTIONAL_LIBRARIES ${SYSTEMD_LIBRARIES}) +-ENDIF (SYSTEMD_FOUND) ++ENDIF (CZMQ_WITH_SYSTEMD AND SYSTEMD_FOUND) + + ######################################################################## + # LZ4 dependency + ######################################################################## + find_package(lz4) +-IF (LZ4_FOUND) ++option(CZMQ_WITH_LZ4 "Build czmq with lz4" ${LZ4_FOUND}) ++IF (CZMQ_WITH_LZ4 AND LZ4_FOUND) + include_directories(${LZ4_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${LZ4_LIBRARIES}) + IF (PC_LZ4_FOUND) +@@ -183,13 +186,14 @@ IF (LZ4_FOUND) + ENDIF (PC_LZ4_FOUND) + add_definitions(-DHAVE_LIBLZ4) + list(APPEND OPTIONAL_LIBRARIES ${LZ4_LIBRARIES}) +-ENDIF (LZ4_FOUND) ++ENDIF (CZMQ_WITH_LZ4 AND LZ4_FOUND) + + ######################################################################## + # LIBCURL dependency + ######################################################################## + find_package(libcurl) +-IF (LIBCURL_FOUND) ++option(CZMQ_WITH_LIBCURL "Build czmq with libcurl" ${LIBCURL_FOUND}) ++IF (CZMQ_WITH_LIBCURL AND LIBCURL_FOUND) + include_directories(${LIBCURL_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${LIBCURL_LIBRARIES}) + IF (PC_LIBCURL_FOUND) +@@ -200,13 +204,14 @@ IF (LIBCURL_FOUND) + ENDIF (PC_LIBCURL_FOUND) + add_definitions(-DHAVE_LIBCURL) + list(APPEND OPTIONAL_LIBRARIES ${LIBCURL_LIBRARIES}) +-ENDIF (LIBCURL_FOUND) ++ENDIF (CZMQ_WITH_LIBCURL AND LIBCURL_FOUND) + + ######################################################################## + # LIBMICROHTTPD dependency + ######################################################################## + find_package(libmicrohttpd) +-IF (LIBMICROHTTPD_FOUND) ++option(CZMQ_WITH_LIBMICROHTTPD "Build czmq with libmicrohttpd" ${LIBMICROHTTPD_FOUND}) ++IF (CZMQ_WITH_LIBMICROHTTPD AND LIBMICROHTTPD_FOUND) + include_directories(${LIBMICROHTTPD_INCLUDE_DIRS}) + list(APPEND MORE_LIBRARIES ${LIBMICROHTTPD_LIBRARIES}) + IF (PC_LIBMICROHTTPD_FOUND) +@@ -217,7 +222,7 @@ IF (LIBMICROHTTPD_FOUND) + ENDIF (PC_LIBMICROHTTPD_FOUND) + add_definitions(-DHAVE_LIBMICROHTTPD) + list(APPEND OPTIONAL_LIBRARIES ${LIBMICROHTTPD_LIBRARIES}) +-ENDIF (LIBMICROHTTPD_FOUND) ++ENDIF (CZMQ_WITH_LIBMICROHTTPD AND LIBMICROHTTPD_FOUND) + + ######################################################################## + # version +@@ -380,6 +385,7 @@ if (CZMQ_BUILD_SHARED) + ENDIF (MSVC) + + set_target_properties (czmq PROPERTIES ++ LINKER_LANGUAGE CXX + PUBLIC_HEADER "${public_headers}" + DEFINE_SYMBOL "CZMQ_EXPORTS" + SOVERSION "4" +@@ -501,6 +507,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/czmqConfig.cmake + ######################################################################## + # executables + ######################################################################## ++if(0) # disable executables + add_executable( + zmakecert + "${SOURCE_DIR}/src/zmakecert.c" +@@ -588,10 +595,12 @@ target_link_libraries( + ${OPTIONAL_LIBRARIES_STATIC} + ) + endif() ++endif() # disable executables + + ######################################################################## + # tests + ######################################################################## ++if(0) # disable tests + set(CLASSTEST_TIMEOUT 60 CACHE STRING "Timeout of the selftest of a class") + set(TOTAL_TIMEOUT 600 CACHE STRING "Timout of the total testsuite") + +@@ -687,6 +696,7 @@ foreach(TEST_CLASS ${TEST_CLASSES}) + endforeach(TEST_CLASS) + + include(CTest) ++endif() # disable tests + + ######################################################################## + # cleanup diff --git a/recipes/czmq/all/patches/4.2.1-0001-fix-cmake.patch b/recipes/czmq/all/patches/4.2.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..d28f290d16d5eb --- /dev/null +++ b/recipes/czmq/all/patches/4.2.1-0001-fix-cmake.patch @@ -0,0 +1,67 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index d51cba0..d12a024 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -130,19 +130,19 @@ set(OPTIONAL_LIBRARIES_STATIC) + ######################################################################## + # LIBZMQ dependency + ######################################################################## +-find_package(libzmq REQUIRED) +-IF (LIBZMQ_FOUND) +- include_directories(${LIBZMQ_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBZMQ_LIBRARIES}) ++find_package(ZeroMQ REQUIRED) ++IF (ZeroMQ_FOUND) ++ include_directories(${ZeroMQ_INCLUDE_DIRS}) ++ list(APPEND MORE_LIBRARIES ${ZeroMQ_LIBRARIES}) + IF (PC_LIBZMQ_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libzmq") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBZMQ_STATIC_LDFLAGS}) + ELSE (PC_LIBZMQ_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lzmq") + ENDIF (PC_LIBZMQ_FOUND) +-ELSE (LIBZMQ_FOUND) ++ELSE (ZeroMQ_FOUND) + message( FATAL_ERROR "libzmq not found." ) +-ENDIF (LIBZMQ_FOUND) ++ENDIF (ZeroMQ_FOUND) + + ######################################################################## + # UUID dependency +@@ -419,6 +419,7 @@ if (CZMQ_BUILD_SHARED) + ENDIF(APPLE) + + set_target_properties (czmq PROPERTIES ++ LINKER_LANGUAGE CXX + PUBLIC_HEADER "${public_headers}" + DEFINE_SYMBOL "CZMQ_EXPORTS" + SOVERSION "4" +@@ -544,6 +545,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/czmqConfig.cmake + ######################################################################## + # executables + ######################################################################## ++if(0) # disable executables + add_executable( + zmakecert + "${SOURCE_DIR}/src/zmakecert.c" +@@ -631,10 +633,12 @@ target_link_libraries( + ${OPTIONAL_LIBRARIES_STATIC} + ) + endif() ++endif() # disable executables + + ######################################################################## + # tests + ######################################################################## ++if(0) # disable tests + set(CLASSTEST_TIMEOUT 60 CACHE STRING "Timeout of the selftest of a class") + set(TOTAL_TIMEOUT 600 CACHE STRING "Timout of the total testsuite") + +@@ -743,6 +747,7 @@ foreach(TEST_CLASS ${TEST_CLASSES}) + endforeach(TEST_CLASS) + + include(CTest) ++endif() # disable tests + + ######################################################################## + # cleanup diff --git a/recipes/czmq/all/patches/4.2.1-0002-fix-zsys_thread-issue.patch b/recipes/czmq/all/patches/4.2.1-0002-fix-zsys_thread-issue.patch new file mode 100644 index 00000000000000..82cede05404718 --- /dev/null +++ b/recipes/czmq/all/patches/4.2.1-0002-fix-zsys_thread-issue.patch @@ -0,0 +1,43 @@ +diff --git a/src/zsock.c b/src/zsock.c +index 46bbb63..36ad5e0 100644 +--- a/src/zsock.c ++++ b/src/zsock.c +@@ -2376,6 +2376,7 @@ zsock_test (bool verbose) + zstr_free (&addr); + zstr_free (&message); + ++#ifndef __APPLE__ + // ZMQ_DGRAM ipv4 multicast test + zsock_t* mdgramr = zsock_new_dgram ("udp://225.25.25.25:7777"); + assert (mdgramr); +@@ -2389,6 +2390,7 @@ zsock_test (bool verbose) + + char *mdmessage, *maddr; + ++ // this call blocks forever on MacOS + zmsg_t *mdmsg = zmsg_recv( mdgramr ); + assert (mdmsg); + maddr = zmsg_popstr (mdmsg); +@@ -2400,6 +2402,7 @@ zsock_test (bool verbose) + zstr_free (&mdmessage); + zstr_free (&maddr); + zstr_free (&mdmessage); ++#endif + + // // ipv6 (not supported yet) + // zsys_set_ipv6(1); +diff --git a/src/zsys.c b/src/zsys.c +index 7c7301b..f384051 100644 +--- a/src/zsys.c ++++ b/src/zsys.c +@@ -334,9 +334,7 @@ zsys_init (void) + zsys_set_thread_name_prefix (s_thread_name_prefix); + + if (getenv ("ZSYS_THREAD_NAME_PREFIX_STR")) +- zsys_set_thread_name_prefix_str (getenv ("ZSYS_THREAD_NAME_PREFIX")); +- else +- zsys_set_thread_name_prefix_str (s_thread_name_prefix_str); ++ zsys_set_thread_name_prefix_str (getenv ("ZSYS_THREAD_NAME_PREFIX_STR")); + + return s_process_ctx; + } diff --git a/recipes/czmq/all/test_package/CMakeLists.txt b/recipes/czmq/all/test_package/CMakeLists.txt index 48b3bf1fe3b3f9..379c1eec90db58 100644 --- a/recipes/czmq/all/test_package/CMakeLists.txt +++ b/recipes/czmq/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) +project(test_package LANGUAGES CXX) find_package(czmq REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:"WITH_LIBSODIUM">) if(TARGET czmq-static) - target_link_libraries(${PROJECT_NAME} czmq-static) + target_link_libraries(${PROJECT_NAME} PRIVATE czmq-static) else() - target_link_libraries(${PROJECT_NAME} czmq) + target_link_libraries(${PROJECT_NAME} PRIVATE czmq) endif() diff --git a/recipes/czmq/all/test_package/conanfile.py b/recipes/czmq/all/test_package/conanfile.py index 5eac88580e1080..de4d02115f1c4d 100644 --- a/recipes/czmq/all/test_package/conanfile.py +++ b/recipes/czmq/all/test_package/conanfile.py @@ -1,18 +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, CMakeToolchain import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "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) + tc.variables["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" 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/czmq/all/test_v1_package/CMakeLists.txt b/recipes/czmq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/czmq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +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/czmq/all/test_v1_package/conanfile.py b/recipes/czmq/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5eac88580e1080 --- /dev/null +++ b/recipes/czmq/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["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" + 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/czmq/config.yml b/recipes/czmq/config.yml index da3be1903f085f..5074502634e2b3 100644 --- a/recipes/czmq/config.yml +++ b/recipes/czmq/config.yml @@ -1,3 +1,5 @@ versions: + "4.2.1": + folder: all "4.2.0": folder: all diff --git a/recipes/dataframe/all/conandata.yml b/recipes/dataframe/all/conandata.yml index 91566611b6db34..61fe550263e995 100644 --- a/recipes/dataframe/all/conandata.yml +++ b/recipes/dataframe/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.22.0": + url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/1.22.0.tar.gz" + sha256: "4b244241cd56893fccb22f7c874588f0d86b444912382ed6e9a4cf95e55ffda2" "1.21.0": url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/1.21.0.tar.gz" sha256: "a6b07eaaf628225a34e4402c1a6e311430e8431455669ac03691d92f44081172" @@ -9,31 +12,20 @@ sources: url: "https://github.com/hosseinmoein/DataFrame/archive/1.19.0.tar.gz" sha256: "81382e9c68df7c52f69f645b1830fcd3634eedc07fa3d2024ee6c57cf2cdb7ff" "1.18.0": - sha256: 8cdb8b246263fbd8fcef07b6300f6aefb58b3a54cd67e5cbe5383bc948305844 - url: https://github.com/hosseinmoein/DataFrame/archive/1.18.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.18.0.tar.gz" + sha256: "8cdb8b246263fbd8fcef07b6300f6aefb58b3a54cd67e5cbe5383bc948305844" "1.17.0": - sha256: 669e9663de358330b15eacaa783ccf42fe16db27b9556fdcd18f1114c0335557 - url: https://github.com/hosseinmoein/DataFrame/archive/1.17.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.17.0.tar.gz" + sha256: "669e9663de358330b15eacaa783ccf42fe16db27b9556fdcd18f1114c0335557" "1.16.0": - sha256: a5a24ec07fb4761a294a291d7bed7c72e82e2dde8bba8bfc1ca2f68e07afd7fc - url: https://github.com/hosseinmoein/DataFrame/archive/1.16.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.16.0.tar.gz" + sha256: "a5a24ec07fb4761a294a291d7bed7c72e82e2dde8bba8bfc1ca2f68e07afd7fc" "1.15.0": - sha256: 68eb3fca66dff3f8473722d561e9391800957a09c2c6d4dde5f9ad37cbf88954 - url: https://github.com/hosseinmoein/DataFrame/archive/1.15.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.15.0.tar.gz" + sha256: "68eb3fca66dff3f8473722d561e9391800957a09c2c6d4dde5f9ad37cbf88954" "1.14.0": - sha256: 45991cc16e478b24641d0548aab24fd59ad534ada30fca8776fd9990e1914ac7 - url: https://github.com/hosseinmoein/DataFrame/archive/1.14.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.14.0.tar.gz" + sha256: "45991cc16e478b24641d0548aab24fd59ad534ada30fca8776fd9990e1914ac7" "1.12.0": - sha256: e951a699bd048bd7a034ac60bdd45f15cf066a04fda33cb22030d192b91a836c - url: https://github.com/hosseinmoein/DataFrame/archive/1.12.0.tar.gz - "1.8.0": - sha256: 43b057f6dedbdfc328667dc4dcdcd3384b4551cc2825ca546405ec955fb8cb35 - url: https://github.com/hosseinmoein/DataFrame/archive/1.8.0.tar.gz - "1.7.0": - sha256: b5f25e331bcd25f2ddd222e65563df3c316d726d92134789f043338545faa4d4 - url: https://github.com/hosseinmoein/DataFrame/archive/1.7.0.tar.gz -patches: - "1.8.0": - - patch_file: "patches/0001-remove-tests-bin-for-conan-package.patch" - "1.7.0": - - patch_file: "patches/0001-remove-tests-bin-for-conan-package.patch" + url: "https://github.com/hosseinmoein/DataFrame/archive/1.12.0.tar.gz" + sha256: "e951a699bd048bd7a034ac60bdd45f15cf066a04fda33cb22030d192b91a836c" diff --git a/recipes/dataframe/all/conanfile.py b/recipes/dataframe/all/conanfile.py index 33492673970a78..f596bf9ba05f78 100644 --- a/recipes/dataframe/all/conanfile.py +++ b/recipes/dataframe/all/conanfile.py @@ -52,9 +52,10 @@ class DataFrameConan(ConanFile): def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "7", "clang": "6", - "apple-clang": "10.0" if Version(self.version) >= "1.12.0" else "9.0", + "apple-clang": "10.0", } def export_sources(self): @@ -144,7 +145,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "DataFrame") self.cpp_info.libs = ["DataFrame"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.extend(["pthread", "rt"]) + self.cpp_info.system_libs.extend(["pthread", "rt", "m"]) if is_msvc(self): self.cpp_info.defines.append("_USE_MATH_DEFINES") if Version(self.version) < "1.20.0" and not self.options.shared: diff --git a/recipes/dataframe/all/patches/0001-remove-tests-bin-for-conan-package.patch b/recipes/dataframe/all/patches/0001-remove-tests-bin-for-conan-package.patch deleted file mode 100644 index 1eae4efbddc429..00000000000000 --- a/recipes/dataframe/all/patches/0001-remove-tests-bin-for-conan-package.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 6cfbda5ec6f3d1d5987242c00af16ed4c1a65e7d Mon Sep 17 00:00:00 2001 -From: "Jimmy M. Gong" -Date: Mon, 10 Feb 2020 22:05:52 +0800 -Subject: [PATCH] remove tests bin for conan package - ---- - CMakeLists.txt | 146 ------------------------------------------------- - 1 file changed, 146 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 362bd95..b33ed49 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -216,149 +216,3 @@ endif(MSVC) - - # Add the uninstall target - include(AddUninstallTarget) -- --# Build the test binary --add_executable(dataframe_tester test/dataframe_tester.cc) --add_executable(dataframe_performance test/dataframe_performance.cc) --add_executable(vectors_tester test/vectors_tester.cc) --add_executable(vector_ptr_view_tester test/vector_ptr_view_tester.cc) --add_executable(date_time_tester test/date_time_tester.cc) --add_executable(mmfile_tester test/mmfile_tester.cc) --add_executable(obj_vector_tester test/obj_vector_tester.cc) --add_executable(obj_vector_erase_tester test/obj_vector_erase_tester.cc) --add_executable(sharedmem_tester test/sharedmem_tester.cc) --add_executable(gen_rand_tester test/gen_rand_tester.cc) -- --# Link the DataFrame library to the test binary --target_link_libraries(dataframe_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(dataframe_performance DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(vectors_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(vector_ptr_view_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(date_time_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(mmfile_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(obj_vector_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(obj_vector_erase_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(sharedmem_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(gen_rand_tester DataFrame) -- --if (UNIX) -- # Find pthreads library -- set(THREADS_PREFER_PTHREAD_FLAG ON) -- find_package(Threads REQUIRED) -- target_link_libraries(dataframe_tester Threads::Threads) -- target_link_libraries(dataframe_performance Threads::Threads) -- target_link_libraries(vectors_tester Threads::Threads) -- target_link_libraries(vector_ptr_view_tester Threads::Threads) -- target_link_libraries(date_time_tester Threads::Threads) -- target_link_libraries(mmfile_tester Threads::Threads) -- target_link_libraries(obj_vector_tester Threads::Threads) -- target_link_libraries(obj_vector_erase_tester Threads::Threads) -- target_link_libraries(sharedmem_tester Threads::Threads) -- target_link_libraries(gen_rand_tester Threads::Threads) --endif (UNIX) -- --if (UNIX AND NOT APPLE) -- target_link_libraries(dataframe_tester rt) -- target_link_libraries(dataframe_performance rt) -- target_link_libraries(vectors_tester rt) -- target_link_libraries(vector_ptr_view_tester rt) -- target_link_libraries(date_time_tester rt) -- target_link_libraries(mmfile_tester rt) -- target_link_libraries(obj_vector_tester rt) -- target_link_libraries(obj_vector_erase_tester rt) -- target_link_libraries(sharedmem_tester rt) -- target_link_libraries(gen_rand_tester rt) --endif() -- --# Enable ctest, testing so we can see if unit tests pass or fail in CI --enable_testing() --add_test(NAME dataframe_tester -- COMMAND dataframe_tester -- WORKING_DIRECTORY $) -- --# For some unknown reason to me, this test sigfaults in AppVeyor --# --# add_test(NAME vectors_tester --# COMMAND vectors_tester --# WORKING_DIRECTORY $) -- --add_test(NAME vector_ptr_view_tester -- COMMAND vector_ptr_view_tester -- WORKING_DIRECTORY $) --add_test(NAME date_time_tester -- COMMAND date_time_tester -- WORKING_DIRECTORY $) -- --# For some unknown reason to me, this test hangs in Travis CI --# --# add_test(NAME mmfile_tester --# COMMAND mmfile_tester --# WORKING_DIRECTORY $) -- --add_test(NAME obj_vector_tester -- COMMAND obj_vector_tester -- WORKING_DIRECTORY $) -- --add_test(NAME obj_vector_erase_tester -- COMMAND obj_vector_erase_tester -- WORKING_DIRECTORY $) --add_test(NAME gen_rand_tester -- COMMAND gen_rand_tester -- WORKING_DIRECTORY $) -- --message("-- Copying files for testing") --# Ctest require this files in the build dir, on all platforms --add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.csv -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data.csv) --add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.json -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data.json) --add_custom_command( -- TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_dt_index.csv -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data_dt_index.csv) --add_custom_command( -- TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_string_index.csv -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data_string_index.csv) -- --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.json -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.json -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_dt_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_dt_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_string_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_string_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --message("-- Copying files for testing - done") --- -2.25.0 - diff --git a/recipes/dataframe/all/test_v1_package/CMakeLists.txt b/recipes/dataframe/all/test_v1_package/CMakeLists.txt index ff71d0aea5f2ca..be00a8c7f57c71 100644 --- a/recipes/dataframe/all/test_v1_package/CMakeLists.txt +++ b/recipes/dataframe/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(DataFrame REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE DataFrame::DataFrame) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/dataframe/all/test_v1_package/conanfile.py b/recipes/dataframe/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/dataframe/all/test_v1_package/conanfile.py +++ b/recipes/dataframe/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/dataframe/config.yml b/recipes/dataframe/config.yml index ee0214f11ffb33..55fe67d4b45816 100644 --- a/recipes/dataframe/config.yml +++ b/recipes/dataframe/config.yml @@ -1,4 +1,6 @@ versions: + "1.22.0": + folder: all "1.21.0": folder: all "1.20.0": @@ -17,7 +19,3 @@ versions: folder: all "1.12.0": folder: all - "1.8.0": - folder: all - "1.7.0": - folder: all diff --git a/recipes/daw_header_libraries/all/conandata.yml b/recipes/daw_header_libraries/all/conandata.yml index 5d3fc84d353b8d..ed2e2f4b08ab60 100644 --- a/recipes/daw_header_libraries/all/conandata.yml +++ b/recipes/daw_header_libraries/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.85.1": + url: "https://github.com/beached/header_libraries/archive/v2.85.1.tar.gz" + sha256: "fb4880e254a481e3c750261fdb75a1696afc9ef4404e095a7f3ba0683bcd9930" "2.79.0": url: "https://github.com/beached/header_libraries/archive/v2.79.0.tar.gz" sha256: "2dfa8fc9495499379cff39ed648c6bba156a87eb177fc91a860045a410aebb99" @@ -23,9 +26,6 @@ sources: "2.68.3": url: "https://github.com/beached/header_libraries/archive/v2.68.3.tar.gz" sha256: "9bb7d25d161b89ad4a0ac857c28734c061cf53f6e80212c7fe70b8e0fd14789f" - "2.68.1": - url: "https://github.com/beached/header_libraries/archive/v2.68.1.tar.gz" - sha256: "51bdb042959373729009f91449c492f58bb63262146463a767f17d3de6fb2687" "1.29.7": url: "https://github.com/beached/header_libraries/archive/refs/tags/v1.29.7.tar.gz" sha256: "524c34f3f5d2af498e7bcaff7802b914ba42acde29f7e3ecce41a035db0bf5bd" diff --git a/recipes/daw_header_libraries/all/conanfile.py b/recipes/daw_header_libraries/all/conanfile.py index 50f3611d7a2d82..81865adfe60e7b 100644 --- a/recipes/daw_header_libraries/all/conanfile.py +++ b/recipes/daw_header_libraries/all/conanfile.py @@ -57,8 +57,12 @@ def package(self): copy(self, pattern="*.h", 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 = [] + self.cpp_info.set_property("cmake_file_name", "daw-header-libraries") self.cpp_info.set_property("cmake_target_name", "daw::daw-header-libraries") + self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-header-libraries") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "daw-header-libraries" @@ -67,4 +71,3 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "daw" self.cpp_info.components["daw"].names["cmake_find_package"] = "daw-header-libraries" self.cpp_info.components["daw"].names["cmake_find_package_multi"] = "daw-header-libraries" - self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-header-libraries") diff --git a/recipes/daw_header_libraries/config.yml b/recipes/daw_header_libraries/config.yml index cfc27ab8efedce..e18abeaf72479e 100644 --- a/recipes/daw_header_libraries/config.yml +++ b/recipes/daw_header_libraries/config.yml @@ -1,4 +1,6 @@ versions: + "2.85.1": + folder: all "2.79.0": folder: all "2.76.3": @@ -15,7 +17,5 @@ versions: folder: all "2.68.3": folder: all - "2.68.1": - folder: all "1.29.7": folder: all diff --git a/recipes/daw_json_link/all/conandata.yml b/recipes/daw_json_link/all/conandata.yml index 9aef5d14cf6161..d36a5c60a18037 100644 --- a/recipes/daw_json_link/all/conandata.yml +++ b/recipes/daw_json_link/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.14.0": + url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.14.tar.gz" + sha256: "07171e1b8f09f525116627015b6618990dc9cfb32357ba821512c0508730c9a4" "3.12.0": url: "https://github.com/beached/daw_json_link/archive/v3.12.0.tar.gz" sha256: "b32097954caae14071893232fd85febbfda1deec34bb939f6aad76c077c6c5d5" @@ -23,15 +26,6 @@ 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" - "3.0.5": - url: "https://github.com/beached/daw_json_link/archive/v3.0.5.tar.gz" - sha256: "77abe2ca525083d59a1e4e8e9aa1d2633e5382d98a0d5d838cd2379eaf8d7edf" "2.15.3": url: "https://github.com/beached/daw_json_link/archive/v2.15.3.tar.gz" sha256: "ec0457a5682a76c5aec709f2d6959ef7bafa0b54c5e7740f911d97991188ee84" - "2.14.0": - url: "https://github.com/beached/daw_json_link/archive/v2.14.0.tar.gz" - sha256: "811d0c5ab9ed9c79c84fc5837c8e7ef48f1f45177b7931bc849363c48a62261b" diff --git a/recipes/daw_json_link/all/conanfile.py b/recipes/daw_json_link/all/conanfile.py index c31ac48f8445e0..c3f0164810694a 100644 --- a/recipes/daw_json_link/all/conanfile.py +++ b/recipes/daw_json_link/all/conanfile.py @@ -37,7 +37,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("daw_header_libraries/2.76.3") + self.requires("daw_header_libraries/2.79.0") self.requires("daw_utf_range/2.2.3") def package_id(self): diff --git a/recipes/daw_json_link/config.yml b/recipes/daw_json_link/config.yml index b61c457f393af3..be0c9ca0953a7e 100644 --- a/recipes/daw_json_link/config.yml +++ b/recipes/daw_json_link/config.yml @@ -1,4 +1,6 @@ versions: + "3.14.0": + folder: "all" "3.12.0": folder: "all" "3.11.1": @@ -15,11 +17,5 @@ versions: folder: "all" "3.1.1": folder: "all" - "3.1.0": - folder: "all" - "3.0.5": - folder: "all" "2.15.3": folder: "all" - "2.14.0": - folder: "all" diff --git a/recipes/daw_utf_range/all/conanfile.py b/recipes/daw_utf_range/all/conanfile.py index b3e630fee1e5aa..b572b095a9b69c 100644 --- a/recipes/daw_utf_range/all/conanfile.py +++ b/recipes/daw_utf_range/all/conanfile.py @@ -27,16 +27,18 @@ def _minimum_cpp_standard(self): @property def _compilers_minimum_version(self): return { + "Visual Studio": "16", + "msvc": "192", "gcc": "8", "clang": "7", - "apple-clang": "12.0", + "apple-clang": "12", } def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("daw_header_libraries/2.76.3") + self.requires("daw_header_libraries/2.79.0") def package_id(self): self.info.clear() @@ -44,13 +46,11 @@ def package_id(self): def validate(self): if self.settings.get_safe("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." - ) + 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): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt b/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt index ab1c8bbe0a5e15..be00a8c7f57c71 100644 --- a/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt +++ b/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/dbus/1.x.x/conanfile.py b/recipes/dbus/1.x.x/conanfile.py index 58568ed049ff77..eac8625ebd775d 100644 --- a/recipes/dbus/1.x.x/conanfile.py +++ b/recipes/dbus/1.x.x/conanfile.py @@ -67,15 +67,15 @@ def layout(self): def build_requirements(self): if self._meson_available: - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.0.0") self.tool_requires("pkgconf/1.9.3") def requirements(self): self.requires("expat/2.5.0") if self.options.with_glib: - self.requires("glib/2.75.0") + self.requires("glib/2.75.2") if self.options.get_safe("with_systemd"): - self.requires("libsystemd/251.4") + self.requires("libsystemd/252.4") if self.options.with_selinux: self.requires("libselinux/3.3") if self.options.get_safe("with_x11"): diff --git a/recipes/dcmtk/all/conanfile.py b/recipes/dcmtk/all/conanfile.py index a22b5ac9d4a21f..9b544546330a2f 100644 --- a/recipes/dcmtk/all/conanfile.py +++ b/recipes/dcmtk/all/conanfile.py @@ -1,11 +1,15 @@ +from conans import CMake +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan.tools.scm import Version import functools import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class DCMTKConan(ConanFile): @@ -33,6 +37,7 @@ class DCMTKConan(ConanFile): "builtin_private_tags": [True, False], "external_dictionary": [None, True, False], "wide_io": [True, False], + "enable_stl": [True, False], } default_options = { "shared": False, @@ -50,6 +55,7 @@ class DCMTKConan(ConanFile): "builtin_private_tags": False, "external_dictionary": None, "wide_io": False, + "enable_stl": True, } generators = "cmake", "cmake_find_package" @@ -68,8 +74,7 @@ def _is_msvc(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": @@ -103,13 +108,13 @@ def requirements(self): self.requires("tcp-wrappers/7.6") def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self) and \ + if hasattr(self, "settings_build") and cross_building(self) and \ self.settings.os == "Macos" and self.settings.arch == "armv8": # FIXME: Probable issue with flags, build includes header 'mmintrin.h' raise ConanInvalidConfiguration("Cross building to Macos M1 is not supported (yet)") 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) @@ -146,7 +151,10 @@ def _configure_cmake(self): if self.options.with_zlib: cmake.definitions["WITH_ZLIBINC"] = self.deps_cpp_info["zlib"].rootpath - cmake.definitions["DCMTK_ENABLE_STL"] = "ON" + if self.options.enable_stl: + cmake.definitions["DCMTK_ENABLE_STL"] = "ON" + else: + cmake.definitions["DCMTK_ENABLE_STL"] = "OFF" cmake.definitions["DCMTK_ENABLE_CXX11"] = True cmake.definitions["DCMTK_ENABLE_MANPAGE"] = False @@ -170,12 +178,8 @@ def _configure_cmake(self): cmake.configure(build_folder=self._build_subfolder) return cmake - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - def build(self): - self._patch_sources() + apply_conandata_patches(self) cmake = self._configure_cmake() cmake.build() @@ -185,18 +189,17 @@ def package(self): cmake = self._configure_cmake() 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, "etc")) - 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, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "share")) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {target: "DCMTK::{}".format(target) for target in self._dcmtk_components.keys()} + {target: f"DCMTK::{target}" for target in self._dcmtk_components} ) - @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("""\ @@ -205,7 +208,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): @@ -213,8 +216,7 @@ def _module_subfolder(self): @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(self._module_subfolder, "conan-official-{self.name}-targets.cmake") @property def _dcmtk_components(self): @@ -241,7 +243,7 @@ def tcpwrappers(): def xml2(): return ["libxml2::libxml2"] if self.options.with_libxml2 else [] - charls = "dcmtkcharls" if tools.Version("3.6.6") <= self.version else "charls" + charls = "dcmtkcharls" if Version("3.6.6") <= self.version else "charls" return { "ofstd" : charset_conversion(), @@ -309,12 +311,12 @@ def register_components(components): register_components(self._dcmtk_components) dcmdictpath = os.path.join(self._dcm_datadictionary_path, "dcmtk", "dicom.dic") - self.output.info("Settings DCMDICTPATH environment variable: {}".format(dcmdictpath)) + self.output.info(f"Settings DCMDICTPATH environment variable: {dcmdictpath}") self.runenv_info.define_path("DCMDICTPATH", dcmdictpath) self.env_info.DCMDICTPATH = dcmdictpath # remove in conan v2? if self.options.with_applications: self.buildenv_info.define_path("DCMDICTPATH", dcmdictpath) 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/dcmtk/all/test_package/conanfile.py b/recipes/dcmtk/all/test_package/conanfile.py index 38f4483872d47f..c5fa77486cfa53 100644 --- a/recipes/dcmtk/all/test_package/conanfile.py +++ b/recipes/dcmtk/all/test_package/conanfile.py @@ -1,4 +1,6 @@ -from conans import ConanFile, CMake, tools +from conans import CMake +from conan import ConanFile +from conan.tools.build import cross_building import os @@ -12,6 +14,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(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/docopt.cpp/all/CMakeLists.txt b/recipes/docopt.cpp/all/CMakeLists.txt deleted file mode 100644 index c55df0a582d8f7..00000000000000 --- a/recipes/docopt.cpp/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/docopt.cpp/all/conandata.yml b/recipes/docopt.cpp/all/conandata.yml index 9c028b4d8773f7..ce21cb936020ce 100644 --- a/recipes/docopt.cpp/all/conandata.yml +++ b/recipes/docopt.cpp/all/conandata.yml @@ -8,13 +8,18 @@ sources: patches: "0.6.3": - patch_file: "patches/cmake-library-0.6.3.patch" - base_path: "source_subfolder" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" - patch_file: "patches/msvc-dll-export-0.6.3.patch" - base_path: "source_subfolder" + patch_description: "export ostream<< to dll" + patch_type: "portability" "0.6.2": - patch_file: "patches/include-stdexcept.patch" - base_path: "source_subfolder" + patch_description: "include stdexcept" + patch_type: "portability" - patch_file: "patches/cmake-library-0.6.2.patch" - base_path: "source_subfolder" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" - patch_file: "patches/msvc-dll-export-0.6.2.patch" - base_path: "source_subfolder" + patch_description: "export ostream<< to dll" + patch_type: "portability" diff --git a/recipes/docopt.cpp/all/conanfile.py b/recipes/docopt.cpp/all/conanfile.py index 1342254943457d..0745cc959331b1 100644 --- a/recipes/docopt.cpp/all/conanfile.py +++ b/recipes/docopt.cpp/all/conanfile.py @@ -1,14 +1,17 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, save +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os import textwrap -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class DocoptCppConan(ConanFile): name = "docopt.cpp" - license = "MIT" description = "C++11 port of docopt" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/docopt/docopt.cpp" topics = ("cli", "getopt", "options", "argparser") @@ -25,25 +28,12 @@ class DocoptCppConan(ConanFile): "boost_regex": False, } - 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 _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": @@ -51,40 +41,42 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.boost_regex: - self.requires("boost/1.76.0") + self.requires("boost/1.81.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, self._min_cppstd) 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_BOOST_REGEX"] = self.options.boost_regex + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_BOOST_REGEX"] = self.options.boost_regex - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + dpes = CMakeDeps(self) + dpes.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")) - 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( @@ -96,8 +88,7 @@ def package(self): def _cmake_target(self): return "docopt" if self.options.shared else "docopt_s" - @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("""\ @@ -106,7 +97,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): @@ -120,7 +111,7 @@ def package_info(self): self.cpp_info.components["docopt"].libs = ["docopt"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["docopt"].system_libs = ["m"] - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.options.shared: self.cpp_info.components["docopt"].defines = ["DOCOPT_DLL"] if self.options.boost_regex: self.cpp_info.components["docopt"].requires.append("boost::boost") diff --git a/recipes/docopt.cpp/all/test_package/CMakeLists.txt b/recipes/docopt.cpp/all/test_package/CMakeLists.txt index bfb18efe2d7e06..2f25c54702003d 100644 --- a/recipes/docopt.cpp/all/test_package/CMakeLists.txt +++ b/recipes/docopt.cpp/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(docopt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(TARGET docopt_s) - target_link_libraries(${PROJECT_NAME} docopt_s) + target_link_libraries(${PROJECT_NAME} PRIVATE docopt_s) else() - target_link_libraries(${PROJECT_NAME} docopt) + target_link_libraries(${PROJECT_NAME} PRIVATE docopt) endif() diff --git a/recipes/docopt.cpp/all/test_package/conanfile.py b/recipes/docopt.cpp/all/test_package/conanfile.py index 96f53ca4b9bf0e..c72c51b464c6d3 100644 --- a/recipes/docopt.cpp/all/test_package/conanfile.py +++ b/recipes/docopt.cpp/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): - exec_path = os.path.join("bin", "test_package") - self.run("{} --help".format(exec_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} --help", env="conanrun") diff --git a/recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt b/recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/docopt.cpp/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/docopt.cpp/all/test_v1_package/conanfile.py b/recipes/docopt.cpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..85a33f95801480 --- /dev/null +++ b/recipes/docopt.cpp/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(f"{bin_path} --help", run_environment=True) diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index 948067d576e190..05e8a3e45cfa14 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake -from conan.tools.files import copy, get, apply_conandata_patches, rmdir +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, rmdir from conan.tools.build import check_min_cppstd from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53.0" class DrogonConan(ConanFile): name = "drogon" @@ -46,8 +46,7 @@ class DrogonConan(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": @@ -55,7 +54,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") self.options["trantor"].shared = True if not self.options.with_orm: del self.options.with_postgres @@ -66,26 +65,39 @@ def configure(self): elif not self.options.with_postgres: del self.options.with_postgres_batch + @property + def _min_cppstd(self): + return 14 if Version(self.version) < "1.8.2" else 17 + @property def _compilers_minimum_version(self): - return { - "Visual Studio": "15" if Version(self.version) < "1.8.2" else "16", - "msvc": "191" if Version(self.version) < "1.8.2" else "192", - "gcc": "6", - "clang": "5", - "apple-clang": "10", - } + if Version(self.version) < "1.8.2": + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "6", + "clang": "5", + "apple-clang": "10", + } + else: + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } def validate(self): if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "14") + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version: if Version(self.info.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++14, which your compiler does not support.".format(self.name)) + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") else: - self.output.warn("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name)) + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") def requirements(self): self.requires("trantor/1.5.8") @@ -97,7 +109,7 @@ def requirements(self): if self.options.with_profile: self.requires("coz/cci.20210322") if self.options.with_boost: - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") if self.options.with_brotli: self.requires("brotli/1.0.9") if self.options.get_safe("with_postgres"): @@ -154,7 +166,7 @@ def package_info(self): if self.options.with_ctl: 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) self.cpp_info.set_property("cmake_file_name", "Drogon") diff --git a/recipes/drogon/all/test_package/CMakeLists.txt b/recipes/drogon/all/test_package/CMakeLists.txt index 196b33faabaf77..cf16e9b501eaa8 100644 --- a/recipes/drogon/all/test_package/CMakeLists.txt +++ b/recipes/drogon/all/test_package/CMakeLists.txt @@ -8,7 +8,7 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Drogon::Drogon) # drogon uses string_view when MSVC_VERSION is greater than 1900. # https://github.com/drogonframework/drogon/blob/v1.7.5/lib/inc/drogon/utils/string_view.h#L16 -if(DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) +if((DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) OR Drogon_VERSION VERSION_GREATER_EQUAL "1.8.2") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) else() target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/elfio/all/conandata.yml b/recipes/elfio/all/conandata.yml index 267559b70048a0..f57351ff19434e 100644 --- a/recipes/elfio/all/conandata.yml +++ b/recipes/elfio/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.11": + sha256: 3307b104c205399786edbba203906de9517e36297709fe747faf9478d55fbb91 + url: https://github.com/serge1/ELFIO/releases/download/Release_3.11/elfio-3.11.tar.gz "3.10": sha256: cdc6362ede2e0c8d1d6db15d7da4b526f461d9cfae6f6337369e416a8bc60234 url: https://github.com/serge1/ELFIO/releases/download/Release_3.10/elfio-3.10.tar.gz diff --git a/recipes/elfio/all/conanfile.py b/recipes/elfio/all/conanfile.py index 497de23753765c..8efd907fc132d8 100644 --- a/recipes/elfio/all/conanfile.py +++ b/recipes/elfio/all/conanfile.py @@ -1,5 +1,9 @@ +from conan import ConanFile +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version import os -from conans import ConanFile, tools class ElfioConan(ConanFile): @@ -7,26 +11,43 @@ class ElfioConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://elfio.sourceforge.net" description = "A header-only C++ library that provides a simple interface for reading and generating files in ELF binary format." - topics = ("conan", "elfio", "elf") + topics = ("elfio", "elf") license = "MIT" settings = "compiler" 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) + if Version(self.version) < "3.11": + check_min_cppstd(self, 11) + else: + check_min_cppstd(self, 14) + + def layout(self): + basic_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("elfio-{}".format(self.version), self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package_id(self): - self.info.header_only() + self.info.clear() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy(pattern=os.path.join("elfio", "*.hpp"), src=self._source_subfolder, dst="include") + copy( + self, + pattern="COPYING", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + copy( + self, + pattern="LICENSE*", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + copy( + self, + pattern=os.path.join("elfio", "*.hpp"), + src=self.source_folder, + dst=os.path.join(self.package_folder, "include"), + ) diff --git a/recipes/elfio/all/test_package/CMakeLists.txt b/recipes/elfio/all/test_package/CMakeLists.txt index 055d849f41b284..8980e10b063e69 100755 --- a/recipes/elfio/all/test_package/CMakeLists.txt +++ b/recipes/elfio/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ 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(elfio REQUIRED CONFIG) add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_target_properties(example PROPERTIES - CXX_STANDARD 11 # Elfio requires at least c++11 - CXX_STANDARD_REQUIRED ON) +target_link_libraries(example PRIVATE elfio::elfio) +target_compile_features(example PRIVATE cxx_std_14) diff --git a/recipes/elfio/all/test_package/conanfile.py b/recipes/elfio/all/test_package/conanfile.py index 23f4017aae4890..8a039654ce69f3 100755 --- a/recipes/elfio/all/test_package/conanfile.py +++ b/recipes/elfio/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 ElfioTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "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.settings): - 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], "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/elfio/all/test_v1_package/CMakeLists.txt b/recipes/elfio/all/test_v1_package/CMakeLists.txt new file mode 100755 index 00000000000000..8980e10b063e69 --- /dev/null +++ b/recipes/elfio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(elfio REQUIRED CONFIG) + +add_executable(example example.cpp) +target_link_libraries(example PRIVATE elfio::elfio) +target_compile_features(example PRIVATE cxx_std_14) diff --git a/recipes/elfio/all/test_v1_package/conanfile.py b/recipes/elfio/all/test_v1_package/conanfile.py new file mode 100755 index 00000000000000..2653a9aa71c861 --- /dev/null +++ b/recipes/elfio/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class ElfioTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + 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], "example") + self.run(bin_path, env="conanrun") diff --git a/recipes/elfio/all/test_v1_package/example.cpp b/recipes/elfio/all/test_v1_package/example.cpp new file mode 100755 index 00000000000000..08728f016b5542 --- /dev/null +++ b/recipes/elfio/all/test_v1_package/example.cpp @@ -0,0 +1,14 @@ + +#include +#include + +using namespace ELFIO; + +int main() { + // just check we can create an reader, that means the recipe works + elfio reader; + if ( !reader.load( "/does/not/exist" ) ) { + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} diff --git a/recipes/elfio/config.yml b/recipes/elfio/config.yml index 9fda1f4e349b2c..387fbf23f814ba 100644 --- a/recipes/elfio/config.yml +++ b/recipes/elfio/config.yml @@ -1,4 +1,6 @@ versions: + "3.11": + folder: all "3.10": folder: all "3.9": diff --git a/recipes/emsdk/all/conandata.yml b/recipes/emsdk/all/conandata.yml index 97335d64e50ee9..13960aa77279e1 100644 --- a/recipes/emsdk/all/conandata.yml +++ b/recipes/emsdk/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.1.30": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.30.tar.gz" + sha256: "7b9c4e0b19f08df9f0d807112926f3908fe73a2960b752a87c3862956da8b9a8" + "3.1.29": + url: "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.29.tar.gz" + sha256: "506376d0d2a71fc3dd1a4dba6fb4cf18f0a2fa4e1936aa04ba4b59f2d435bf3f" "3.1.23": url: "https://github.com/emscripten-core/emsdk/archive/3.1.23.tar.gz" sha256: "a2609fd97580e4e332acbf49b6cc363714982f06cb6970d54c9789df8e91381c" diff --git a/recipes/emsdk/config.yml b/recipes/emsdk/config.yml index 7591f3687c3226..dcab8dc9efb2f7 100644 --- a/recipes/emsdk/config.yml +++ b/recipes/emsdk/config.yml @@ -1,4 +1,8 @@ versions: + "3.1.30": + folder: all + "3.1.29": + folder: all "3.1.23": folder: all "3.1.20": diff --git a/recipes/etl/all/conandata.yml b/recipes/etl/all/conandata.yml index 2de0fd014134d5..1c7a7976936cdc 100644 --- a/recipes/etl/all/conandata.yml +++ b/recipes/etl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "20.35.8": + url: "https://github.com/ETLCPP/etl/archive/20.35.8.tar.gz" + sha256: "7d0a6402b24fc91cf66328b95391a38c52d20f582f42497fb9b0a99d71ab8879" "20.35.7": url: "https://github.com/ETLCPP/etl/archive/20.35.7.tar.gz" sha256: "20127e36c12a33142645dd5ec0a08d12b34ce9b33986847eeaa8c4201e025895" diff --git a/recipes/etl/config.yml b/recipes/etl/config.yml index 7f5a085892dfb4..0fe84ca008d0e8 100644 --- a/recipes/etl/config.yml +++ b/recipes/etl/config.yml @@ -1,4 +1,6 @@ versions: + "20.35.8": + folder: all "20.35.7": folder: all "20.35.5": diff --git a/recipes/faac/all/conandata.yml b/recipes/faac/all/conandata.yml index 187de5684ab948..a217e9fd92fd5c 100644 --- a/recipes/faac/all/conandata.yml +++ b/recipes/faac/all/conandata.yml @@ -2,10 +2,15 @@ sources: "1.30": url: "https://github.com/knik0/faac/archive/1_30.tar.gz" sha256: "adc387ce588cca16d98c03b6ec1e58f0ffd9fc6eadb00e254157d6b16203b2d2" - "1.28": - url: "https://github.com/knik0/faac/archive/refs/tags/faac1_28.tar.gz" - sha256: "fec821797a541e8359f086fef454b947a7f7246fe8ec6207668968b86606a7dd" patches: "1.30": - - patch_file: "patches/001-fix-out-of-root-build.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.30-0001-fix-out-of-root-build.patch" + patch_description: "Fix out of root build" + patch_source: "https://github.com/knik0/faac/commit/c8d12a5c7c5b6f1c4593f0a6c1eeceacc4d7c941.patch" + patch_type: "conan" + - patch_file: "patches/1.30-0002-dont-hardcode-x86.patch" + patch_description: "Allow to build for x86_64" + patch_type: "portability" + - patch_file: "patches/1.30-0003-relax-windows-sdk.patch" + patch_description: "Don't constrain Windows SDK" + patch_type: "portability" diff --git a/recipes/faac/all/conanfile.py b/recipes/faac/all/conanfile.py index bd64d9ff6cbb83..101a73acd4cc45 100644 --- a/recipes/faac/all/conanfile.py +++ b/recipes/faac/all/conanfile.py @@ -1,10 +1,15 @@ -from conan.tools.files import apply_conandata_patches -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration -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 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 Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class FaacConan(ConanFile): @@ -29,14 +34,6 @@ class FaacConan(ConanFile): "drm": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" @@ -47,11 +44,18 @@ def _settings_build(self): @property def _has_mp4_option(self): - return tools.Version(self.version) < "1.29.1" + return Version(self.version) < "1.29.1" + + @property + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + @property + def _sln_folder(self): + return os.path.join(self.source_folder, "project", "msvc") 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": @@ -61,69 +65,127 @@ 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): # FIXME: libfaac depends on kissfft. Try to unvendor this dependency pass def validate(self): - if self._is_msvc: - # FIXME: add msvc support since there are MSBuild files upstream - raise ConanInvalidConfiguration("libfaac conan-center recipe doesn't support building with Visual Studio yet") + if is_msvc(self): + if self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration(f"{self.ref} only supports x86 and x86_64 with Visual Studio") + if self.options.drm and not self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} with drm support can't be built as static with Visual Studio") if self.options.get_safe("with_mp4"): # TODO: as mpv4v2 as a conan package raise ConanInvalidConfiguration("building with mp4v2 is not supported currently") def build_requirements(self): - 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") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - @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)), - "--enable-drm={}".format(yes_no(self.options.drm)), - ] - if self._has_mp4_option: - args.append("--with-mp4v2={}".format(yes_no(self.options.with_mp4))) - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.generate() + else: + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.append(f"--enable-drm={yes_no(self.options.drm)}") + if self._has_mp4_option: + tc.configure_args.append(f"--with-mp4v2={yes_no(self.options.with_mp4)}") + tc.generate() def build(self): apply_conandata_patches(self) - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") + if is_msvc(self): + #========================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_files = ["faac.vcxproj", "libfaac.vcxproj", "libfaac_dll.vcxproj", "libfaac_dll_drm.vcxproj"] + platform_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, os.path.join(self._sln_folder, vcxproj_file), + "v141", + f"{platform_toolset}", + ) + replace_in_file( + self, os.path.join(self._sln_folder, vcxproj_file), + "", + f"", + ) + #========================== + + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + # Allow to build for other archs than Win32 + if self.settings.arch != "x86": + for vc_proj_file in ( + "faac.sln", "faac.vcxproj", "libfaac.vcxproj", + "libfaac_dll.vcxproj", "libfaac_dll_drm.vcxproj" + ): + replace_in_file(self, os.path.join(self._sln_folder, vc_proj_file), "Win32", msbuild.platform) + targets = ["faac"] + if self.options.drm: + targets.append("libfaac_dll_drm") + else: + targets.append("libfaac_dll" if self.options.shared else "libfaac") + msbuild.build(os.path.join(self._sln_folder, "faac.sln"), targets=targets) + else: + autotools = Autotools(self) + autotools.autoreconf() if self._is_mingw and self.options.shared: - tools.replace_in_file(os.path.join("libfaac", "Makefile"), - "\nlibfaac_la_LIBADD = ", - "\nlibfaac_la_LIBADD = -no-undefined ") - autotools = self._configure_autotools() - autotools.make() + replace_in_file(self, os.path.join(self.build_folder, "libfaac", "Makefile"), + "\nlibfaac_la_LIBADD = ", + "\nlibfaac_la_LIBADD = -no-undefined ") + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - 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") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + output_folder = os.path.join(self._sln_folder, "bin", self._msbuild_configuration) + copy(self, "*.exe", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.dll", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + if self.options.drm: + old_libname = "libfaacdrm.lib" + new_libname = "faac_drm.lib" + else: + old_libname = "libfaac_dll.lib" if self.options.shared else "libfaac.lib" + new_libname = "faac.lib" + lib_folder = os.path.join(self.package_folder, "lib") + copy(self, old_libname, src=output_folder, dst=lib_folder, keep_path=False) + rename(self, os.path.join(lib_folder, old_libname), os.path.join(lib_folder, new_libname)) + else: + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.libs = ["faac"] + suffix = "_drm" if self.options.drm else "" + self.cpp_info.libs = [f"faac{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/faac/all/patches/001-fix-out-of-root-build.patch b/recipes/faac/all/patches/1.30-0001-fix-out-of-root-build.patch similarity index 100% rename from recipes/faac/all/patches/001-fix-out-of-root-build.patch rename to recipes/faac/all/patches/1.30-0001-fix-out-of-root-build.patch diff --git a/recipes/faac/all/patches/1.30-0002-dont-hardcode-x86.patch b/recipes/faac/all/patches/1.30-0002-dont-hardcode-x86.patch new file mode 100644 index 00000000000000..f39de0190d9d74 --- /dev/null +++ b/recipes/faac/all/patches/1.30-0002-dont-hardcode-x86.patch @@ -0,0 +1,74 @@ +--- a/project/msvc/faac.vcxproj ++++ b/project/msvc/faac.vcxproj +@@ -66,7 +66,7 @@ + 0x0413 + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + true + Console +@@ -89,7 +89,7 @@ + 0x0413 + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + Console + +--- a/project/msvc/libfaac_dll.vcxproj ++++ b/project/msvc/libfaac_dll.vcxproj +@@ -61,10 +61,9 @@ + true + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def +- MachineX86 + + + Retrieving package version... +@@ -84,11 +83,10 @@ + EditAndContinue + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def + true +- MachineX86 + + + Retrieving package version... +--- a/project/msvc/libfaac_dll_drm.vcxproj ++++ b/project/msvc/libfaac_dll_drm.vcxproj +@@ -61,10 +61,9 @@ + true + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def +- MachineX86 + $(OutDir)libfaacdrm.lib + + +@@ -85,11 +84,10 @@ + EditAndContinue + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def + true +- MachineX86 + $(OutDir)libfaacdrm.lib + + diff --git a/recipes/faac/all/patches/1.30-0003-relax-windows-sdk.patch b/recipes/faac/all/patches/1.30-0003-relax-windows-sdk.patch new file mode 100644 index 00000000000000..772fe863051a4a --- /dev/null +++ b/recipes/faac/all/patches/1.30-0003-relax-windows-sdk.patch @@ -0,0 +1,40 @@ +--- a/project/msvc/faac.vcxproj ++++ b/project/msvc/faac.vcxproj +@@ -12,7 +12,6 @@ + + + {92992E74-AEDE-46DC-AD8C-ADEA876F1A4C} +- 8.1 + + + +--- a/project/msvc/libfaac.vcxproj ++++ b/project/msvc/libfaac.vcxproj +@@ -13,7 +13,6 @@ + + libfaac + {9CC48C6E-92EB-4814-AD37-97AB3622AB65} +- 8.1 + + + +--- a/project/msvc/libfaac_dll.vcxproj ++++ b/project/msvc/libfaac_dll.vcxproj +@@ -13,7 +13,6 @@ + + libfaac_dll + {856BB8CF-B944-4D7A-9D59-4945316229AA} +- 8.1 + + + +--- a/project/msvc/libfaac_dll_drm.vcxproj ++++ b/project/msvc/libfaac_dll_drm.vcxproj +@@ -13,7 +13,6 @@ + + libfaac_dll_drm + {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F} +- 8.1 + + + diff --git a/recipes/faac/all/test_package/CMakeLists.txt b/recipes/faac/all/test_package/CMakeLists.txt index 366ecce0962e72..d2d4532f8451ff 100644 --- a/recipes/faac/all/test_package/CMakeLists.txt +++ b/recipes/faac/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1.0) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) find_package(faac REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} faac::faac) +target_link_libraries(${PROJECT_NAME} PRIVATE faac::faac) diff --git a/recipes/faac/all/test_package/conanfile.py b/recipes/faac/all/test_package/conanfile.py index 697dfef261b53b..0a6bc68712d901 100644 --- a/recipes/faac/all/test_package/conanfile.py +++ b/recipes/faac/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", "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/faac/all/test_v1_package/CMakeLists.txt b/recipes/faac/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/faac/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/faac/all/test_v1_package/conanfile.py b/recipes/faac/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/faac/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/faac/config.yml b/recipes/faac/config.yml index e34a7ad292edbb..a6f1b0cffc2ddf 100644 --- a/recipes/faac/config.yml +++ b/recipes/faac/config.yml @@ -1,5 +1,3 @@ versions: "1.30": folder: all - "1.28": - folder: all diff --git a/recipes/flecs/all/conandata.yml b/recipes/flecs/all/conandata.yml index 66aade00ad726c..cccdeded9497c5 100644 --- a/recipes/flecs/all/conandata.yml +++ b/recipes/flecs/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1.3": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.3.tar.gz" + sha256: "52da12a8bae260be21bf29d97af622241efd822737d0a15e551cd92e30abd5c9" "3.1.2": url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.2.tar.gz" sha256: "1fe4f78b44f2ded1355179a8395bb254fbd8a9db88b9f8ecd890472d60acf723" diff --git a/recipes/flecs/config.yml b/recipes/flecs/config.yml index 9d7fa5cf5dd91b..3560a32c7e5efc 100644 --- a/recipes/flecs/config.yml +++ b/recipes/flecs/config.yml @@ -1,4 +1,6 @@ versions: + "3.1.3": + folder: all "3.1.2": folder: all "3.1.1": diff --git a/recipes/foonathan-lexy/all/conandata.yml b/recipes/foonathan-lexy/all/conandata.yml index 3b5935228f47a8..98cd033191be37 100644 --- a/recipes/foonathan-lexy/all/conandata.yml +++ b/recipes/foonathan-lexy/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2022.12.1": + url: "https://github.com/foonathan/lexy/releases/download/v2022.12.1/lexy-src.zip" + sha256: "4c16efd31d03f908c7125352ebacbdb6c028de3788ca56940175e7017dbc6c7f" "2022.12.00": url: "https://github.com/foonathan/lexy/releases/download/v2022.12.0/lexy-src.zip" sha256: "62afda502963abce28f051416b977dcc8f11581ba0773f4b1da39a9b4842b19d" diff --git a/recipes/foonathan-lexy/config.yml b/recipes/foonathan-lexy/config.yml index e64d73ad800958..9b16b933ef1b66 100644 --- a/recipes/foonathan-lexy/config.yml +++ b/recipes/foonathan-lexy/config.yml @@ -1,4 +1,6 @@ versions: + "2022.12.1": + folder: all "2022.12.00": folder: all "2022.05.01": diff --git a/recipes/foonathan-memory/all/conandata.yml b/recipes/foonathan-memory/all/conandata.yml index 7a847a5e8afc78..5438e06adfb025 100644 --- a/recipes/foonathan-memory/all/conandata.yml +++ b/recipes/foonathan-memory/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.3": + url: "https://github.com/foonathan/memory/archive/refs/tags/v0.7-3.tar.gz" + sha256: "4203d15db22a94a3978eeb1afb59a37d35c57c0f148733f0f1a53a6281cb74dd" "0.7.2": url: "https://github.com/foonathan/memory/archive/refs/tags/v0.7-2.tar.gz" sha256: "8aba7211bb0e59b7538decda453e492cc6e36f8781508ed92b38cbafe8a48762" @@ -11,3 +14,5 @@ sources: patches: "0.7.0": - patch_file: "patches/0.7.0-0001-fix-virtualAllocFromApp.patch" + patch_description: "use VirtualAlloc on Desktop environment" + patch_type: "portability" diff --git a/recipes/foonathan-memory/config.yml b/recipes/foonathan-memory/config.yml index 75789cf28caa84..d4d016ea9d4235 100644 --- a/recipes/foonathan-memory/config.yml +++ b/recipes/foonathan-memory/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.3": + folder: all "0.7.2": folder: all "0.7.1": diff --git a/recipes/g3log/all/conandata.yml b/recipes/g3log/all/conandata.yml index 140d23e5b67d19..81ba1376072ad0 100644 --- a/recipes/g3log/all/conandata.yml +++ b/recipes/g3log/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1": + url: "https://github.com/KjellKod/g3log/archive/2.1.tar.gz" + sha256: "13c9d8cc0387792301f264c4f623618fc4dea9814d9b5844931ffbfd9aafb1fe" "1.3.4": url: "https://github.com/KjellKod/g3log/archive/refs/tags/1.3.4.tar.gz" sha256: "2fe8815e5f5afec6b49bdfedfba1e86b8e58a5dc89fd97f4868fb7f3141aed19" @@ -14,3 +17,5 @@ sources: patches: "1.3.2": - patch_file: "patches/0002-remove-explicit-stdlib-setting.patch" + patch_description: "fix compilation and link errors on Linux" + patch_type: "portability" diff --git a/recipes/g3log/all/conanfile.py b/recipes/g3log/all/conanfile.py index 298068a223096d..560379c7334960 100644 --- a/recipes/g3log/all/conanfile.py +++ b/recipes/g3log/all/conanfile.py @@ -8,20 +8,19 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class G3logConan(ConanFile): name = "g3log" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/KjellKod/g3log" - license = "The Unlicense" description = ( "G3log is an asynchronous, \"crash safe\", logger that is easy to use " "with default logging sinks or you can add your own." ) - topics = ("g3log", "log") - + license = "The Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/KjellKod/g3log" + topics = ("logging", "log", "asynchronous") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -46,14 +45,28 @@ class G3logConan(ConanFile): "debug_break_at_fatal_signal": False, } + @property + def _min_cppstd(self): + return 14 if Version(self.version) < "2.0" else 17 + @property def _compilers_minimum_version(self): - return { - "gcc": "6.1", - "clang": "3.4", - "apple-clang": "5.1", - "Visual Studio": "15", - } + if Version(self.version) < "2.0": + return { + "gcc": "6.1", + "clang": "3.4", + "apple-clang": "5.1", + "Visual Studio": "15", + "msvc": "191", + } + else: + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } def export_sources(self): for p in self.conan_data.get("patches", {}).get(self.version, []): @@ -68,11 +81,11 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "14") + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -82,9 +95,7 @@ def loose_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration( - "{} requires C++14, which your compiler does not support.".format(self.name) - ) + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") def layout(self): cmake_layout(self, src_folder="src") @@ -147,8 +158,13 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "g3log") self.cpp_info.set_property("cmake_target_name", "g3log") self.cpp_info.libs = ["g3logger" if Version(self.version) < "1.3.4" else "g3log"] - if self.settings.os in ["Linux", "Android"]: + + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("rt") self.cpp_info.system_libs.append("pthread") + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("dbghelp") # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/g3log/all/test_package/CMakeLists.txt b/recipes/g3log/all/test_package/CMakeLists.txt index 6bcbaa08a0d71c..c9d535ba3d96a1 100644 --- a/recipes/g3log/all/test_package/CMakeLists.txt +++ b/recipes/g3log/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(g3log REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE g3log) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +if(g3log_VERSION VERSION_LESS 2.0) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/g3log/all/test_v1_package/CMakeLists.txt b/recipes/g3log/all/test_v1_package/CMakeLists.txt index a12ddaa2ea9489..be00a8c7f57c71 100644 --- a/recipes/g3log/all/test_v1_package/CMakeLists.txt +++ b/recipes/g3log/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(g3log REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE g3log) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/g3log/config.yml b/recipes/g3log/config.yml index c34ce10c74ca3e..64be3dabf4e85a 100644 --- a/recipes/g3log/config.yml +++ b/recipes/g3log/config.yml @@ -1,4 +1,6 @@ versions: + "2.1": + folder: all "1.3.4": folder: all "1.3.3": diff --git a/recipes/gcc/all/conandata.yml b/recipes/gcc/all/conandata.yml index dcd31b786fcb02..f7f34296518837 100644 --- a/recipes/gcc/all/conandata.yml +++ b/recipes/gcc/all/conandata.yml @@ -1,7 +1,10 @@ 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 + "11.3.0": + sha256: 98438e6cc7294298b474cf0da7655d9a8c8b796421bb0210531c294a950374ed + url: https://ftp.gnu.org/gnu/gcc/gcc-11.3.0/gcc-11.3.0.tar.gz + "10.2.0": + sha256: 27e879dccc639cd7b0cc08ed575c1669492579529b53c9ff27b0b96265fa867d + url: https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz diff --git a/recipes/gcc/all/conanfile.py b/recipes/gcc/all/conanfile.py index 309ef5f64d0ab6..1d20bad3fdda20 100644 --- a/recipes/gcc/all/conanfile.py +++ b/recipes/gcc/all/conanfile.py @@ -1,126 +1,196 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.errors import ConanInvalidConfiguration +from conan.tools.layout import basic_layout +from conan.tools.apple import XCRun +from conan.tools.files import copy, get, replace_in_file, rmdir, rm +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.29.1" +required_conan_version = ">=1.53.0" class GccConan(ConanFile): name = "gcc" - description = "The GNU Compiler Collection includes front ends for C, " \ - "C++, Objective-C, Fortran, Ada, Go, and D, as well as " \ - "libraries for these languages (libstdc++,...). " + description = ( + "The GNU Compiler Collection includes front ends for C, " + "C++, Objective-C, Fortran, Ada, Go, and D, as well as " + "libraries for these languages (libstdc++,...). " + ) topics = ("gcc", "gnu", "compiler", "c", "c++") homepage = "https://gcc.gnu.org" url = "https://github.com/conan-io/conan-center-index" license = "GPL-3.0-only" settings = "os", "compiler", "arch", "build_type" - _autotools = None - def build_requirements(self): - self.build_requires("flex/2.6.4") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - pkgversion = 'conan GCC %s' % self.version - bugurl = self.url + '/issues' - libdir = "%s/lib/gcc/%s" % (self.package_folder, self.version) - args = [ - "--enable-languages=c,c++", - "--disable-nls", - "--disable-multilib", - "--disable-bootstrap", - "--with-system-zlib", - "--with-gmp=%s" % self.deps_cpp_info['gmp'].rootpath, - '--with-mpc=%s' % self.deps_cpp_info["mpc"].rootpath, - "--with-mpfr=%s" % self.deps_cpp_info["mpfr"].rootpath, - "--without-isl", - "--libdir=%s" % libdir, - '--with-pkgversion=%s' % pkgversion, - "--program-suffix=-%s" % self.version, - "--with-bugurl=%s" % bugurl - ] - if self.settings.os == "Macos": - xcrun = tools.XCRun(self.settings) - args.extend([ - '--with-native-system-header-dir=/usr/include', - "--with-sysroot={}".format(xcrun.sdk_path) - ]) - self._autotools.libs = [] # otherwise causes config.log to fail finding -lmpc + def configure(self): if self.settings.compiler in ["clang", "apple-clang"]: - # xgcc: error: unrecognized command-line option -stdlib=libc++ - if self.settings.compiler.libcxx == "libc++": - self._autotools.cxx_flags.remove("-stdlib=libc++") - elif self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"]: - self._autotools.cxx_flags.remove("-stdlib=libstdc++") - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools - - @property - def _source_subfolder(self): - return "source_subfolder" + # Can't remove this from cxxflags with autotools - so get rid of it + del self.settings.compiler.libcxx + + def build_requirements(self): + if self.settings.os == "Linux": + # binutils recipe is broken for Macos, and Windows uses tools + # distributed with msys/mingw + self.tool_requires("binutils/2.38") + self.tool_requires("flex/2.6.4") def requirements(self): self.requires("mpc/1.2.0") self.requires("mpfr/4.1.0") - self.requires("gmp/6.2.0") - self.requires("zlib/1.2.11") + self.requires("gmp/6.2.1") + self.requires("zlib/1.2.13") + self.requires("isl/0.24") - def configure(self): - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("Windows builds aren't supported (yet), sorry") - if tools.cross_building(self.settings): - raise ConanInvalidConfiguration("no cross-building support (yet), sorry") + def package_id(self): + del self.info.settings.compiler - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "gcc-%s" % self.version - os.rename(extracted_dir, self._source_subfolder) + def validate_build(self): + if is_msvc(self): + raise ConanInvalidConfiguration("GCC can't be built with MSVC") - @property - def _make_args(self): + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration( + "Windows builds aren't currently supported. Contributions to support this are welcome." + ) if self.settings.os == "Macos": - return ["BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"] - return [] + # FIXME: This recipe should largely support Macos, however the following + # errors are present when building using the c3i CI: + # clang: error: unsupported option '-print-multi-os-directory' + # clang: error: no input files + raise ConanInvalidConfiguration( + "Macos builds aren't currently supported. Contributions to support this are welcome." + ) + if cross_building(self): + raise ConanInvalidConfiguration( + "Cross builds are not current supported. Contributions to support this are welcome" + ) + + def layout(self): + basic_layout(self, src_folder="src") + + def generate(self): + # Ensure binutils and flex are on the path. + # TODO: Remove when conan 2.0 is released as this will be default behaviour + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-languages=c,c++,fortran") + tc.configure_args.append("--disable-nls") + tc.configure_args.append("--disable-multilib") + tc.configure_args.append("--disable-bootstrap") + # TODO: Remove --prefix and --libexecdir args when c3i supports conan 1.55.0. + # This change should only happen in conjunction with a move to + # autotools.install("install-strip") + tc.configure_args.append(f"--prefix={self.package_folder}") + tc.configure_args.append(f"--libexecdir={os.path.join(self.package_folder, 'bin', 'libexec')}") + tc.configure_args.append(f"--with-zlib={self.dependencies['zlib'].package_folder}") + tc.configure_args.append(f"--with-isl={self.dependencies['isl'].package_folder}") + tc.configure_args.append(f"--with-gmp={self.dependencies['gmp'].package_folder}") + tc.configure_args.append(f"--with-mpc={self.dependencies['mpc'].package_folder}") + tc.configure_args.append(f"--with-mpfr={self.dependencies['mpfr'].package_folder}") + tc.configure_args.append(f"--with-pkgversion=conan GCC {self.version}") + tc.configure_args.append(f"--program-suffix=-{self.version}") + tc.configure_args.append(f"--with-bugurl={self.url}/issues") + + if self.settings.os == "Macos": + xcrun = XCRun(self) + tc.configure_args.append(f"--with-sysroot={xcrun.sdk_path}") + # Set native system header dir to ${{sysroot}}/usr/include to + # isolate installation from the system as much as possible + tc.configure_args.append("--with-native-system-header-dir=/usr/include") + tc.make_args.append("BOOT_LDFLAGS=-Wl,-headerpad_max_install_names") + tc.generate() + + # Don't use AutotoolsDeps here - deps are passed directly in configure_args. + # Using AutotoolsDeps causes the compiler tests to fail by erroneously adding + # additional $LIBS to the test compilation + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): # If building on x86_64, change the default directory name for 64-bit libraries to "lib": - libdir = "%s/lib/gcc/%s" % (self.package_folder, self.version) - tools.replace_in_file(os.path.join(self.source_folder, - self._source_subfolder, "gcc", "config", "i386", "t-linux64"), - "m64=../lib64", "m64=../lib", strict=False) + replace_in_file( + self, + os.path.join(self.source_folder, "gcc", "config", "i386", "t-linux64"), + "m64=../lib64", + "m64=../lib", + strict=False, + ) + # Ensure correct install names when linking against libgcc_s; # see discussion in https://github.com/Homebrew/legacy-homebrew/pull/34303 - tools.replace_in_file(os.path.join(self.source_folder, - self._source_subfolder, "libgcc", "config", "t-slibgcc-darwin"), - "@shlib_slibdir@", libdir, strict=False) - autotools = self._configure_autotools() - autotools.make(args=self._make_args) - - def package_id(self): - del self.info.settings.compiler + replace_in_file( + self, + os.path.join(self.source_folder, "libgcc", "config", "t-slibgcc-darwin"), + "@shlib_slibdir@", + os.path.join(self.package_folder, "lib"), + strict=False, + ) + + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - autotools = self._configure_autotools() - if self.settings.build_type == "Debug": - autotools.install(args=self._make_args) - else: - autotools.make(args=["install-strip"] + self._make_args) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(self.package_folder, "*.la") - self.copy(pattern="COPYING*", dst="licenses", src=self._source_subfolder) + autotools = Autotools(self) + # TODO: Use more modern autotools.install(target="install-strip") when c3i supports + # conan client version of 1.55.0. Make sure that the minimum conan version is also bumped + # when this is changed. + autotools.make(target="install-strip") + + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", self.package_folder, recursive=True) + copy( + self, + pattern="COPYING*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + keep_path=False, + ) def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("rt") + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("dl") + bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with : " + bindir) - self.env_info.PATH.append(bindir) - cc = os.path.join(bindir, "gcc-%s" % self.version) - self.output.info("Creating CC env var with : " + cc) - self.env_info.CC = cc + cc = os.path.join(bindir, f"gcc-{self.version}") + self.output.info("Creating CC env var with: " + cc) + self.buildenv_info.define("CC", cc) - cxx = os.path.join(bindir, "g++-%s" % self.version) - self.output.info("Creating CXX env var with : " + cxx) + cxx = os.path.join(bindir, f"g++-{self.version}") + self.output.info("Creating CXX env var with: " + cxx) + self.buildenv_info.define("CXX", cxx) + + fc = os.path.join(bindir, f"gfortran-{self.version}") + self.output.info("Creating FC env var with: " + fc) + self.buildenv_info.define("FC", fc) + + ar = os.path.join(bindir, f"gcc-ar-{self.version}") + self.output.info("Creating AR env var with: " + ar) + self.buildenv_info.define("AR", ar) + + nm = os.path.join(bindir, f"gcc-nm-{self.version}") + self.output.info("Creating NM env var with: " + nm) + self.buildenv_info.define("NM", nm) + + ranlib = os.path.join(bindir, f"gcc-ranlib-{self.version}") + self.output.info("Creating RANLIB env var with: " + ranlib) + self.buildenv_info.define("RANLIB", ranlib) + + # TODO: Remove after conan 2.0 is released + self.env_info.CC = cc self.env_info.CXX = cxx + self.env_info.FC = fc + self.env_info.AR = ar + self.env_info.NM = nm + self.env_info.RANLIB = ranlib diff --git a/recipes/gcc/all/test_package/conanfile.py b/recipes/gcc/all/test_package/conanfile.py index a9e585e6ddfd44..439f1c3ddfe867 100644 --- a/recipes/gcc/all/test_package/conanfile.py +++ b/recipes/gcc/all/test_package/conanfile.py @@ -1,34 +1,84 @@ -from conans import ConanFile, tools import os +import shutil +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + + @property + def file_io(self): + return { + "c": { + "compiler": "$CC", + "src": os.path.join(self.source_folder, "hello.c"), + "bin": os.path.join(self.build_folder, "hello_c"), + }, + "cpp": { + "compiler": "$CXX", + "src": os.path.join(self.source_folder, "hello.cpp"), + "bin": os.path.join(self.build_folder, "hello_cpp"), + }, + "fortran": { + "compiler": "$FC", + "src": os.path.join(self.source_folder, "hello.f90"), + "bin": os.path.join(self.build_folder, "hello_f90"), + }, + } + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + runenv = VirtualRunEnv(self) + runenv.generate() + + def build(self): + self.run("echo PATH: $PATH") + for language, files in self.file_io.items(): + self.output.info(f"Testing build using {language} compiler") + # Confirm compiler is propagated to env + envvar = files["compiler"].split("$")[1] + self.run(f"echo {envvar}: {files['compiler']}", env="conanbuild") + self.run(f"{files['compiler']} --version", env="conanbuild") + self.run(f"{files['compiler']} -dumpversion", env="conanbuild") + + # Confirm files can be compiled + self.run( + f"{files['compiler']} {files['src']} -o {files['bin']}", + env="conanbuild", + ) + self.output.info(f"Successfully built {files['bin']}") def test(self): def chmod_plus_x(name): - if os.name == 'posix': + if os.name == "posix": os.chmod(name, os.stat(name).st_mode | 0o111) - 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) - self.run("%s --version" % cxx, run_environment=True) - self.run("%s -dumpversion" % cc, run_environment=True) - self.run("%s -dumpversion" % cxx, run_environment=True) - self.run("%s %s -o hello_c" % (cc, hello_c), run_environment=True) - self.run("%s %s -o hello_cpp" % (cxx, hello_cpp), run_environment=True) - if not tools.cross_building(self.settings): - chmod_plus_x("hello_c") - chmod_plus_x("hello_cpp") - self.run("./hello_c", run_environment=True) - self.run("./hello_cpp", run_environment=True) - if tools.which("readelf"): - self.run("readelf -l hello_c", run_environment=True) - self.run("readelf -l hello_cpp", run_environment=True) - if tools.which("otool"): - self.run("otool -L hello_c", run_environment=True) - self.run("otool -L hello_cpp", run_environment=True) + for language, files in self.file_io.items(): + self.output.info(f"Testing application built using {language} compiler") + if not cross_building(self): + chmod_plus_x(f"{files['bin']}") + + if self.settings.os == "Linux": + if shutil.which("readelf"): + self.run(f"readelf -l {files['bin']}", env="conanrun") + else: + self.output.info( + "readelf is not on the PATH. Skipping readelf test." + ) + + if self.settings.os == "Macos": + if shutil.which("otool"): + self.run(f"otool -L {files['bin']}", env="conanrun") + else: + self.output.info( + "otool is not on the PATH. Skipping otool test." + ) + + self.run(f"{files['bin']}", env="conanrun") diff --git a/recipes/gcc/all/test_package/hello.c b/recipes/gcc/all/test_package/hello.c index 52029834a425bb..63fdcbf2713ba1 100644 --- a/recipes/gcc/all/test_package/hello.c +++ b/recipes/gcc/all/test_package/hello.c @@ -2,7 +2,7 @@ int main() { - puts("Hello, World!\n"); + puts(" gcc: Hello, World!"); return 0; } diff --git a/recipes/gcc/all/test_package/hello.cpp b/recipes/gcc/all/test_package/hello.cpp index e59b7b15826e33..6cf57370b32816 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 << "Hello, World!\n"; + std::cout << " g++: Hello, World!\n"; return 0; } diff --git a/recipes/gcc/all/test_package/hello.f90 b/recipes/gcc/all/test_package/hello.f90 new file mode 100644 index 00000000000000..ff78fe23454f70 --- /dev/null +++ b/recipes/gcc/all/test_package/hello.f90 @@ -0,0 +1,4 @@ +program hello + implicit none + write(*,*) 'gfortran: Hello, World!' +end program hello diff --git a/recipes/gcc/all/test_v1_package/conanfile.py b/recipes/gcc/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..a9e585e6ddfd44 --- /dev/null +++ b/recipes/gcc/all/test_v1_package/conanfile.py @@ -0,0 +1,34 @@ +from conans import ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def test(self): + def chmod_plus_x(name): + if os.name == 'posix': + os.chmod(name, os.stat(name).st_mode | 0o111) + + 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) + self.run("%s --version" % cxx, run_environment=True) + self.run("%s -dumpversion" % cc, run_environment=True) + self.run("%s -dumpversion" % cxx, run_environment=True) + self.run("%s %s -o hello_c" % (cc, hello_c), run_environment=True) + self.run("%s %s -o hello_cpp" % (cxx, hello_cpp), run_environment=True) + if not tools.cross_building(self.settings): + chmod_plus_x("hello_c") + chmod_plus_x("hello_cpp") + self.run("./hello_c", run_environment=True) + self.run("./hello_cpp", run_environment=True) + if tools.which("readelf"): + self.run("readelf -l hello_c", run_environment=True) + self.run("readelf -l hello_cpp", run_environment=True) + if tools.which("otool"): + self.run("otool -L hello_c", run_environment=True) + self.run("otool -L hello_cpp", run_environment=True) diff --git a/recipes/gcc/all/test_v1_package/hello.c b/recipes/gcc/all/test_v1_package/hello.c new file mode 100644 index 00000000000000..52029834a425bb --- /dev/null +++ b/recipes/gcc/all/test_v1_package/hello.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + puts("Hello, World!\n"); + return 0; +} + diff --git a/recipes/gcc/all/test_v1_package/hello.cpp b/recipes/gcc/all/test_v1_package/hello.cpp new file mode 100644 index 00000000000000..e59b7b15826e33 --- /dev/null +++ b/recipes/gcc/all/test_v1_package/hello.cpp @@ -0,0 +1,8 @@ +#include + +int main() +{ + std::cout << "Hello, World!\n"; + return 0; +} + diff --git a/recipes/gcc/config.yml b/recipes/gcc/config.yml index 204a7032b0bc44..20d860f029e5e1 100644 --- a/recipes/gcc/config.yml +++ b/recipes/gcc/config.yml @@ -1,5 +1,7 @@ versions: - "10.2.0": - folder: all "12.2.0": folder: all + "11.3.0": + folder: all + "10.2.0": + folder: all diff --git a/recipes/geotrans/all/conandata.yml b/recipes/geotrans/all/conandata.yml index d74641c250a308..2b4068a9ac96ec 100644 --- a/recipes/geotrans/all/conandata.yml +++ b/recipes/geotrans/all/conandata.yml @@ -1,7 +1,12 @@ sources: + "3.9": + url: "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/geotrans/geotrans-3.9.tgz" + sha256: "06712b1c52e0a321bad1b5e6b38babbdbfd89f709669a238644fd878e8ccb4f2" "3.8": url: "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/geotrans/geotrans-3.8.tgz" sha256: "baa72d3b1ae12f237a8ad30f2deb3fed2b80feb759528ea0a72b4b42cb77c565" patches: + "3.9": + - patch_file: "patches/3.x-fix-for-cxx20.patch" "3.8": - - patch_file: "patches/3.8-fix-for-cxx20.patch" + - patch_file: "patches/3.x-fix-for-cxx20.patch" diff --git a/recipes/geotrans/all/conanfile.py b/recipes/geotrans/all/conanfile.py index 45f53bc792fe56..1345217d20119e 100644 --- a/recipes/geotrans/all/conanfile.py +++ b/recipes/geotrans/all/conanfile.py @@ -57,7 +57,7 @@ def validate(self): def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + destination=self.source_folder, strip_root=True, filename=f"geotrans-{self.version}.tgz") def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/geotrans/all/patches/3.8-fix-for-cxx20.patch b/recipes/geotrans/all/patches/3.x-fix-for-cxx20.patch similarity index 100% rename from recipes/geotrans/all/patches/3.8-fix-for-cxx20.patch rename to recipes/geotrans/all/patches/3.x-fix-for-cxx20.patch diff --git a/recipes/geotrans/config.yml b/recipes/geotrans/config.yml index a874c72606420c..bc00071b32befd 100644 --- a/recipes/geotrans/config.yml +++ b/recipes/geotrans/config.yml @@ -1,3 +1,5 @@ versions: + "3.9": + folder: all "3.8": folder: all diff --git a/recipes/glib/all/conandata.yml b/recipes/glib/all/conandata.yml index 997e550aba596b..095459d3a0d9d2 100644 --- a/recipes/glib/all/conandata.yml +++ b/recipes/glib/all/conandata.yml @@ -1,39 +1,25 @@ sources: + "2.75.2": + url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.2.tar.xz" + sha256: "360d6fb75202c0eb0d07f0ab812b19b526f1c05ccc0a8ed7e5d2c988616d343a" + "2.75.1": + url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.1.tar.xz" + sha256: "96fd22355a542cca96c31082f2d09b72cb5a3454b6ea60c1be17c987a18a6b93" "2.75.0": url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.0.tar.xz" sha256: "6dde8e55cc4a2c83d96797120b08bcffb5f645b2e212164ae22d63c40e0e6360" "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.72.4": url: "https://download.gnome.org/sources/glib/2.72/glib-2.72.4.tar.xz" sha256: "8848aba518ba2f4217d144307a1d6cb9afcc92b54e5c13ac1f8c4d4608e96f0e" - "2.71.3": - 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://download.gnome.org/sources/glib/2.69/glib-2.69.3.tar.xz" - sha256: "47af2c6e06becee44d447ae7d1212dbab255b002b5141d9b62a4357c0ecc058f" - "2.68.3": - 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" - patch_type: backport - patch_description: fix for clang compilation - patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2898 "2.73.3": - patch_file: "patches/0001-2.73.3-clang-static-assert.patch" - patch_type: backport + patch_type: bugfix patch_description: fix for clang compilation patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2898 diff --git a/recipes/glib/all/conanfile.py b/recipes/glib/all/conanfile.py index e1f49826f840b6..54e3429735b138 100644 --- a/recipes/glib/all/conanfile.py +++ b/recipes/glib/all/conanfile.py @@ -48,8 +48,6 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if Version(self.version) < "2.71.1": - self.options.shared = True if self.settings.os != "Linux": del self.options.with_mount del self.options.with_selinux @@ -87,15 +85,8 @@ def requirements(self): self.requires("libiconv/1.17") def validate(self): - if Version(self.version) >= "2.69.0" and not self.info.options.with_pcre: + if not self.info.options.with_pcre: raise ConanInvalidConfiguration("option glib:with_pcre must be True for glib >= 2.69.0") - if self.info.settings.os == "Windows" and not self.info.options.shared and Version(self.version) < "2.71.1": - raise ConanInvalidConfiguration( - "glib < 2.71.1 can not be built as static library on Windows. " - "see https://gitlab.gnome.org/GNOME/glib/-/issues/692" - ) - if Version(self.version) < "2.67.0" and not is_msvc(self) and not self.info.options.with_elf: - raise ConanInvalidConfiguration("libelf dependency can't be disabled in glib < 2.67.0") def build_requirements(self): self.tool_requires("meson/0.64.1") @@ -113,28 +104,18 @@ def generate(self): tc.generate() tc = MesonToolchain(self) - if is_apple_os(self): + if is_apple_os(self) and Version(self.version) < "2.75.1": 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": - tc.project_options["internal_pcre"] = not self.options.with_pcre if self.settings.os == "FreeBSD": tc.project_options["xattr"] = "false" - if Version(self.version) >= "2.67.2": - tc.project_options["tests"] = "false" - if Version(self.version) >= "2.67.0": - tc.project_options["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" + tc.project_options["tests"] = "false" + tc.project_options["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" tc.generate() def _patch_sources(self): apply_conandata_patches(self) - if Version(self.version) < "2.67.2": - replace_in_file(self, - os.path.join(self.source_folder, "meson.build"), - "build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())", - "build_tests = false", - ) replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('fuzzing')", @@ -152,9 +133,9 @@ def _patch_sources(self): # allow to find gettext replace_in_file(self, os.path.join(self.source_folder, "meson.build"), - "libintl = cc.find_library('intl', required : false)" if Version(self.version) < "2.73.1" \ - else "libintl = dependency('intl', required: false)", - "libintl = dependency('libgettext', method : 'pkg-config', required : false)", + "libintl = cc.find_library('intl', required : false" if Version(self.version) < "2.73.1" \ + else "libintl = dependency('intl', required: false", + "libintl = dependency('libgettext', method : 'pkg-config', required : false", ) replace_in_file(self, diff --git a/recipes/glib/all/patches/0001-2.74.0-clang-static-assert.patch b/recipes/glib/all/patches/0001-2.74.0-clang-static-assert.patch deleted file mode 100644 index c9481d079569d1..00000000000000 --- a/recipes/glib/all/patches/0001-2.74.0-clang-static-assert.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/gio/gio-launch-desktop.c b/gio/gio-launch-desktop.c -index 26b9ae1a1..47717b987 100644 ---- a/gio/gio-launch-desktop.c -+++ b/gio/gio-launch-desktop.c -@@ -121,8 +121,8 @@ journal_stream_fd (const char *identifier, - /* Arbitrary large size for the sending buffer, from systemd */ - int large_buffer_size = 8 * 1024 * 1024; - -- G_STATIC_ASSERT (LOG_EMERG == 0 && "Linux ABI defines LOG_EMERG"); -- G_STATIC_ASSERT (LOG_DEBUG == 7 && "Linux ABI defines LOG_DEBUG"); -+ G_STATIC_ASSERT (LOG_EMERG == 0 && sizeof "Linux ABI defines LOG_EMERG"); -+ G_STATIC_ASSERT (LOG_DEBUG == 7 && sizeof "Linux ABI defines LOG_DEBUG"); - - fd = socket (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); - diff --git a/recipes/glib/config.yml b/recipes/glib/config.yml index a3f68d3f20d1ae..997ec90da28090 100644 --- a/recipes/glib/config.yml +++ b/recipes/glib/config.yml @@ -1,19 +1,13 @@ versions: + "2.75.2": + folder: all + "2.75.1": + folder: all "2.75.0": folder: all "2.74.1": folder: all - "2.74.0": - folder: all "2.73.3": folder: all "2.72.4": folder: all - "2.71.3": - folder: all - "2.70.5": - folder: all - "2.69.3": - folder: all - "2.68.3": - folder: all diff --git a/recipes/glslang/all/conandata.yml b/recipes/glslang/all/conandata.yml index 5f989bd0af008c..f6333a1a14d01e 100644 --- a/recipes/glslang/all/conandata.yml +++ b/recipes/glslang/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "fb6f323a36efcd98766bb72f598008f73c4c92bce69c79fc98ad2b3cdca0c263" "1.3.231.1": url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "df3857f01c1aa9ee1927d2feaaa431406d243958e07791e9aed4cb5ab22a5f2b" @@ -27,6 +30,8 @@ sources: url: "https://github.com/KhronosGroup/glslang/archive/8.13.3559.tar.gz" sha256: "c58fdcf7e00943ba10f9ae565b2725ec9d5be7dab7c8e82cac72fcaa83c652ca" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-no-force-glslang-pic.patch" "1.3.231.1": - patch_file: "patches/0001-no-force-glslang-pic.patch" "1.3.224.0": diff --git a/recipes/glslang/all/patches/1.3.236.0-0001-no-force-glslang-pic.patch b/recipes/glslang/all/patches/1.3.236.0-0001-no-force-glslang-pic.patch new file mode 100644 index 00000000000000..10a3ace245afd6 --- /dev/null +++ b/recipes/glslang/all/patches/1.3.236.0-0001-no-force-glslang-pic.patch @@ -0,0 +1,10 @@ +--- a/glslang/CMakeLists.txt ++++ b/glslang/CMakeLists.txt +@@ -169,7 +169,6 @@ set(GLSLANG_HEADERS + add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${GLSLANG_SOURCES} ${GLSLANG_HEADERS}) + set_target_properties(glslang PROPERTIES + FOLDER glslang +- POSITION_INDEPENDENT_CODE ON + VERSION "${GLSLANG_VERSION}" + SOVERSION "${GLSLANG_VERSION_MAJOR}") + target_link_libraries(glslang PRIVATE OGLCompiler OSDependent MachineIndependent) diff --git a/recipes/glslang/config.yml b/recipes/glslang/config.yml index eb0c5a565bc362..413c4c359d87ef 100644 --- a/recipes/glslang/config.yml +++ b/recipes/glslang/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.224.0": diff --git a/recipes/glu/all/conanfile.py b/recipes/glu/all/conanfile.py index 42fc9acb237e88..4aa309d2770f57 100644 --- a/recipes/glu/all/conanfile.py +++ b/recipes/glu/all/conanfile.py @@ -1,9 +1,8 @@ from conan import ConanFile -from conan.errors import ConanException +from conan.tools.gnu import PkgConfig from conan.tools.system import package_manager -from conans import tools -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class SysConfigGLUConan(ConanFile): @@ -15,7 +14,15 @@ class SysConfigGLUConan(ConanFile): homepage = "https://cgit.freedesktop.org/mesa/glu/" license = "SGI-B-2.0" settings = "os", "arch", "compiler", "build_type" - requires = "opengl/system" + + def layout(self): + pass + + def requirements(self): + self.requires("opengl/system") + + def package_id(self): + self.info.clear() def system_requirements(self): dnf = package_manager.Dnf(self) @@ -36,34 +43,13 @@ def system_requirements(self): pkg = package_manager.Pkg(self) pkg.install(["libGLU"], update=True, check=True) - def _fill_cppinfo_from_pkgconfig(self, name): - pkg_config = tools.PkgConfig(name) - if not pkg_config.provides: - raise ConanException("GLU development files aren't available, giving 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] - include_dirs = [include[2:] for include in pkg_config.cflags_only_I] - cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")] - defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")] - - self.cpp_info.system_libs.extend(libs) - self.cpp_info.libdirs.extend(lib_dirs) - self.cpp_info.sharedlinkflags.extend(ldflags) - self.cpp_info.exelinkflags.extend(ldflags) - self.cpp_info.defines.extend(defines) - self.cpp_info.includedirs.extend(include_dirs) - self.cpp_info.cflags.extend(cflags) - self.cpp_info.cxxflags.extend(cflags) - def package_info(self): + self.cpp_info.bindirs = [] self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] if self.settings.os == "Windows": self.cpp_info.system_libs = ["Glu32"] elif self.settings.os in ["Linux", "FreeBSD"]: - self._fill_cppinfo_from_pkgconfig("glu") - - def package_id(self): - self.info.header_only() + pkg_config = PkgConfig(self, 'glu') + pkg_config.fill_cpp_info(self.cpp_info, is_system=self.settings.os != "FreeBSD") diff --git a/recipes/glu/all/test_package/CMakeLists.txt b/recipes/glu/all/test_package/CMakeLists.txt index 34af13462f44f8..56f2fb9c24114c 100644 --- a/recipes/glu/all/test_package/CMakeLists.txt +++ b/recipes/glu/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(glu REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE glu::glu) diff --git a/recipes/glu/all/test_package/conanfile.py b/recipes/glu/all/test_package/conanfile.py index fdb9f346a1da9d..ef5d7042163ecc 100644 --- a/recipes/glu/all/test_package/conanfile.py +++ b/recipes/glu/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" + 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/glu/all/test_v1_package/CMakeLists.txt b/recipes/glu/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/glu/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/glu/all/test_v1_package/conanfile.py b/recipes/glu/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..a500b98343c743 --- /dev/null +++ b/recipes/glu/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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/gmp/all/conandata.yml b/recipes/gmp/all/conandata.yml index d97aab0d277f2e..9266fcde97cc7d 100644 --- a/recipes/gmp/all/conandata.yml +++ b/recipes/gmp/all/conandata.yml @@ -11,18 +11,11 @@ sources: patches: "6.2.1": - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" - base_path: "" - patch_file: "patches/6.2.x-0001-fix-MSVC-next-prime-error.patch" - base_path: "source_subfolder" "6.2.0": - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" - base_path: "" - patch_file: "patches/6.2.x-0001-fix-MSVC-next-prime-error.patch" - base_path: "source_subfolder" "6.1.2": - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" - base_path: "" - patch_file: "patches/6.1.x-0001-fix-MSVC-next-prime-error.patch" - base_path: "source_subfolder" - patch_file: "patches/6.1.x-0002-fix-MSVC-debug.patch" - base_path: "source_subfolder" diff --git a/recipes/gmp/all/conanfile.py b/recipes/gmp/all/conanfile.py index 5ccdd6563bbde5..6d9215c94d74d3 100644 --- a/recipes/gmp/all/conanfile.py +++ b/recipes/gmp/all/conanfile.py @@ -1,11 +1,16 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, 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, is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +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 import stat -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.54.0" class GmpConan(ConanFile): @@ -37,10 +42,6 @@ class GmpConan(ConanFile): "enable_cxx": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -49,13 +50,8 @@ def _settings_build(self): def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - 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": @@ -65,106 +61,105 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.get_safe("enable_fat"): del self.options.disable_assembly if not self.options.enable_cxx: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def validate(self): - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("Cannot build a shared library using Visual Studio: some error occurs at link time") + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.options.run_checks # run_checks doesn't affect package's ID + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} cannot be built as a shared library using Visual Studio: some error occurs at link time", + ) + def build_requirements(self): - self.build_requires("m4/1.4.19") - 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("yasm/1.3.0") - self.build_requires("automake/1.16.4") + self.tool_requires("m4/1.4.19") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("yasm/1.3.0") + 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True, verify=False) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Relocatable shared lib on macOS & fix permission issue - if tools.is_apple_os(self.settings.os): - configure_file = os.path.join(self._source_subfolder, "configure") - tools.replace_in_file(configure_file, "-install_name \\$rpath/", "-install_name @rpath/") - configure_stats = os.stat(configure_file) - os.chmod(configure_file, configure_stats.st_mode | stat.S_IEXEC) + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - configure_args = [ + tc.configure_args.extend([ "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))), "--enable-assembly={}".format(yes_no(not self.options.get_safe("disable_assembly", False))), "--enable-fat={}".format(yes_no(self.options.get_safe("enable_fat", False))), "--enable-cxx={}".format(yes_no(self.options.enable_cxx)), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--srcdir={}".format(os.path.join(self.source_folder, self._source_subfolder).replace("\\", "/")), - ] - if self._is_msvc: - configure_args.extend([ + "--srcdir={}".format(self.source_folder.replace("\\", "/")), + ]) + if is_msvc(self): + tc.configure_args.extend([ "ac_cv_c_restrict=restrict", "gmp_cv_asm_label_suffix=:", "lt_cv_sys_global_symbol_pipe=cat", # added to get further in shared MSVC build, but it gets stuck later ]) - if not (self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 12): - autotools.flags.append("-FS") - autotools.cxx_flags.append("-EHsc") - autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return autotools - - @contextlib.contextmanager - def _build_context(self): - if self._is_msvc: - with tools.vcvars(self): - yasm_machine = { - "x86": "x86", - "x86_64": "amd64", - }[str(self.settings.arch)] - env = { - "CC": "cl -nologo", - "CCAS": "{} -a x86 -m {} -p gas -r raw -f win32 -g null -X gnu".format(os.path.join(self.build_folder, "yasm_wrapper.sh").replace("\\", "/"), yasm_machine), - "CXX": "cl -nologo", - "AR": "{} lib".format(self._user_info_build["automake"].ar_lib.replace("\\", "/")), - "LD": "link -nologo", - "NM": "python {}".format(tools.unix_path(os.path.join(self.build_folder, "dumpbin_nm.py"))), - } - with tools.environment_append(env): - yield - else: - yield + tc.extra_cxxflags.append("-EHsc") + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + env = tc.environment() + if is_msvc(self): + yasm_wrapper = unix_path(self, os.path.join(self.source_folder, "yasm_wrapper.sh")) + yasm_machine = { + "x86": "x86", + "x86_64": "amd64", + }[str(self.settings.arch)] + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + dumpbin_nm = unix_path(self, os.path.join(self.source_folder, "dumpbin_nm.py")) + env.define("CC", "cl -nologo") + env.define("CCAS", f"{yasm_wrapper} -a x86 -m {yasm_machine} -p gas -r raw -f win32 -g null -X gnu") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", f"python {dumpbin_nm}") + tc.generate(env) + + def _patch_sources(self): + apply_conandata_patches(self) + # Fix permission issue + if is_apple_os(self): + configure_file = os.path.join(self.source_folder, "configure") + configure_stats = os.stat(configure_file) + os.chmod(configure_file, configure_stats.st_mode | stat.S_IEXEC) def build(self): self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() - # INFO: According to the gmp readme file, make check should not be omitted, but it causes timeouts on the CI server. - if self.options.run_checks: - autotools.make(args=["check"]) + autotools = Autotools(self) + autotools.configure() + autotools.make() + # INFO: According to the gmp readme file, make check should not be omitted, but it causes timeouts on the CI server. + if self.options.run_checks: + autotools.make(args=["check"]) def package(self): - self.copy("COPYINGv2", dst="licenses", src=self._source_subfolder) - self.copy("COPYING.LESSERv3", dst="licenses", src=self._source_subfolder) - 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") + copy(self, "COPYINGv2", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING.LESSERv3", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): # Workaround to always provide a pkgconfig file depending on all components diff --git a/recipes/gmp/all/test_package/CMakeLists.txt b/recipes/gmp/all/test_package/CMakeLists.txt index 9f96d523192a5d..382515baaeb92e 100644 --- a/recipes/gmp/all/test_package/CMakeLists.txt +++ b/recipes/gmp/all/test_package/CMakeLists.txt @@ -1,18 +1,18 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(gmp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE gmp::libgmp) -if (TEST_PIC) +if(TEST_PIC) add_library(${PROJECT_NAME}_shared SHARED test_package.c) - target_link_libraries(${PROJECT_NAME}_shared ${CONAN_LIBS}) + target_link_libraries(${PROJECT_NAME}_shared PRIVATE gmp::libgmp) endif() -if (ENABLE_CXX) +if(ENABLE_CXX) + enable_language(CXX) add_executable(${PROJECT_NAME}_cpp test_package.cpp) - target_link_libraries(${PROJECT_NAME}_cpp ${CONAN_LIBS}) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE gmp::gmpxx) endif() diff --git a/recipes/gmp/all/test_package/conanfile.py b/recipes/gmp/all/test_package/conanfile.py index 605e1da44137b0..472d139ec19ee8 100644 --- a/recipes/gmp/all/test_package/conanfile.py +++ b/recipes/gmp/all/test_package/conanfile.py @@ -1,22 +1,35 @@ -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" + 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["ENABLE_CXX"] = self.dependencies["gmp"].options.enable_cxx + tc.variables["TEST_PIC"] = "fPIC" in self.dependencies["gmp"].options and self.dependencies["gmp"].options.fPIC + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["ENABLE_CXX"] = self.options["gmp"].enable_cxx - cmake.definitions["TEST_PIC"] = "fPIC" in self.options["gmp"] and self.options["gmp"].fPIC 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["gmp"].enable_cxx: - 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/gmp/all/test_v1_package/CMakeLists.txt b/recipes/gmp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..81f52f58013af8 --- /dev/null +++ b/recipes/gmp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +if(ENABLE_CXX) + enable_language(CXX) +endif() + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(gmp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE gmp::GMP) + +if(TEST_PIC) + add_library(${PROJECT_NAME}_shared SHARED ../test_package/test_package.c) + target_link_libraries(${PROJECT_NAME}_shared PRIVATE gmp::GMP) +endif() + +if(ENABLE_CXX) + add_executable(${PROJECT_NAME}_cpp ../test_package/test_package.cpp) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE gmp::GMPXX) +endif() diff --git a/recipes/gmp/all/test_v1_package/conanfile.py b/recipes/gmp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..716c611a38e8ab --- /dev/null +++ b/recipes/gmp/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +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["ENABLE_CXX"] = self.options["gmp"].enable_cxx + cmake.definitions["TEST_PIC"] = "fPIC" in self.options["gmp"] and self.options["gmp"].fPIC + 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["gmp"].enable_cxx: + bin_path = os.path.join("bin", "test_package_cpp") + self.run(bin_path, run_environment=True) diff --git a/recipes/gnu-config/all/test_package/conanfile.py b/recipes/gnu-config/all/test_package/conanfile.py index d50d33bfc8962d..93cb4f77f7eab9 100644 --- a/recipes/gnu-config/all/test_package/conanfile.py +++ b/recipes/gnu-config/all/test_package/conanfile.py @@ -1,6 +1,4 @@ from conan import ConanFile -from conan.errors import ConanException -from conans import tools as tools_legacy class TestPackageConan(ConanFile): @@ -20,8 +18,4 @@ def build_requirements(self): def test(self): self.run("config.guess") - try: - 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...") + self.run("config.sub --version") diff --git a/recipes/hazelcast-cpp-client/all/conandata.yml b/recipes/hazelcast-cpp-client/all/conandata.yml index 90b1afe2d9103a..ef6a536c1dc634 100644 --- a/recipes/hazelcast-cpp-client/all/conandata.yml +++ b/recipes/hazelcast-cpp-client/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.1.0": + url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.1.0.tar.gz" + sha256: "de22ddf2c99079ed2385baa554a997b15ae17b039d6d108f68e25e1b3bbf76b6" "5.0.0": url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.0.0.tar.gz" sha256: "0df7948bc6f4d219c60f51179355599938cab5b713335c2ea48d1d38be1b69dc" @@ -15,5 +18,11 @@ sources: url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.0.1.zip" sha256: "4b3c6a876ebca2a4dcf23a556d3c3d4da2284e4ce1d2bbdf335df7f86b03fd28" patches: + "5.1.0": + - patch_file: "patches/gcc_11_1_0.patch" + patch_description: "Fix for GCC-111" + patch_type: "portability" "4.1.0": - patch_file: "patches/gcc_4.9_5_fix.patch" + patch_description: "Fix for GCC-495" + patch_type: "portability" diff --git a/recipes/hazelcast-cpp-client/all/patches/gcc_11_1_0.patch b/recipes/hazelcast-cpp-client/all/patches/gcc_11_1_0.patch new file mode 100644 index 00000000000000..c286f1883f21f0 --- /dev/null +++ b/recipes/hazelcast-cpp-client/all/patches/gcc_11_1_0.patch @@ -0,0 +1,40 @@ +diff --git a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h +index 462ea85b0..f2686506a 100644 +--- a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h ++++ b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h +@@ -190,6 +190,9 @@ struct HAZELCAST_API is_trivial_entry_vector< + */ + class HAZELCAST_API ClientMessage + { ++ template ++ struct default_nullable_decoder; ++ + public: + static constexpr size_t EXPECTED_DATA_BLOCK_SIZE = 1024; + +@@ -974,10 +977,8 @@ public: + } + + template +- boost::optional get_nullable(std::function decoder = +- [](ClientMessage& msg) { +- return msg.get(); +- }) ++ boost::optional get_nullable( ++ std::function decoder = default_nullable_decoder{}) + { + if (next_frame_is_null_frame()) { + // skip next frame with null flag +@@ -1357,6 +1358,12 @@ private: + static const frame_header_type BEGIN_FRAME; + static const frame_header_type END_FRAME; + ++ template ++ struct default_nullable_decoder ++ { ++ T operator()(ClientMessage& msg) const { return msg.get(); } ++ }; ++ + template + void set_primitive_vector(const std::vector& values, + bool is_final = false) diff --git a/recipes/hazelcast-cpp-client/config.yml b/recipes/hazelcast-cpp-client/config.yml index 50e0bcc183e614..6c55bb901999c6 100644 --- a/recipes/hazelcast-cpp-client/config.yml +++ b/recipes/hazelcast-cpp-client/config.yml @@ -1,4 +1,6 @@ versions: + "5.1.0": + folder: all "5.0.0": folder: all "4.2.0": diff --git a/recipes/hdf5/all/conandata.yml b/recipes/hdf5/all/conandata.yml index 4414eb5420df79..dc660f8ec159bb 100644 --- a/recipes/hdf5/all/conandata.yml +++ b/recipes/hdf5/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.14.0": + url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_14_0.tar.gz" + sha256: "0f2ec13c1bf6e9f506fd03681c83a476d722e7479cad9ce6f8585a26c317d0ad" "1.13.1": url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_13_1.tar.gz" sha256: "92552458f35c7e58128ce1bfc2831abf901cc142ea0fdd2b056311e4452db7bf" @@ -19,6 +22,10 @@ sources: url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_8_21.tar.gz" sha256: "753520e34a576a64809b8e02d9c015d6126f7974f678c7417a60492d835a88f4" patches: + "1.14.0": + - patch_file: "patches/conanize-link-szip-1.14.0+.patch" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.13.1": - patch_file: "patches/conanize-link-szip-1.12.2+.patch" patch_type: "conan" diff --git a/recipes/hdf5/all/conanfile.py b/recipes/hdf5/all/conanfile.py index 7fd80ff13f9591..e99788436fb27d 100644 --- a/recipes/hdf5/all/conanfile.py +++ b/recipes/hdf5/all/conanfile.py @@ -1,12 +1,12 @@ import os +import textwrap + from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, copy, replace_in_file, rm, rmdir, apply_conandata_patches, export_conandata_patches, save +from conan.tools.build import can_run, 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, replace_in_file, rm, rmdir, save from conan.tools.scm import Version -from conan.tools.build import can_run - -import textwrap required_conan_version = ">=1.53.0" @@ -42,6 +42,11 @@ class Hdf5Conan(ConanFile): "szip_encoding": False, "parallel": False, } + @property + def _min_cpp_standard(self): + if Version(self.version) < "1.14.0": + return 98 + return 11 def export_sources(self): export_conandata_patches(self) @@ -63,12 +68,15 @@ def validate(self): self.info.options.szip_encoding and \ not self.dependencies["szip"].options.enable_encoding: raise ConanInvalidConfiguration("encoding must be enabled in szip dependency (szip:enable_encoding=True)") + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cpp_standard) def configure(self): if self.options.shared: self.options.rm_safe("fPIC") - self.settings.rm_safe("compiler.libcxx") - self.settings.rm_safe("compiler.cppstd") + if not self.options.enable_cxx: + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if self.options.enable_cxx or self.options.hl or (self.settings.os == "Windows" and not self.options.shared): del self.options.threadsafe if not bool(self.options.szip_support): @@ -87,6 +95,29 @@ def requirements(self): if self.options.parallel: self.requires("openmpi/4.1.0") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def _inject_stdlib_flag(self, tc): + if self.settings.os == "Linux" and self.settings.compiler == "clang": + cpp_stdlib = f" -stdlib={self.settings.compiler.libcxx}".rstrip("1") # strip 11 from stdlibc++11 + tc.variables["CMAKE_CXX_FLAGS"] = tc.variables.get("CMAKE_CXX_FLAGS", "") + cpp_stdlib + + return tc + + + def build_requirements(self): + if Version(self.version) >= "1.14.0" and not self._cmake_new_enough("3.18"): + self.tool_requires("cmake/3.25.0") + def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -95,6 +126,10 @@ def generate(self): cmakedeps.generate() tc = CMakeToolchain(self) + if self.settings.get_safe("compiler.cppstd"): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cpp_standard + if self.settings.get_safe("compiler.libcxx"): + tc = self._inject_stdlib_flag(tc) if self.options.szip_support == "with_libaec": tc.variables["USE_LIBAEC"] = True tc.variables["HDF5_EXTERNALLY_CONFIGURED"] = True diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.14.0+.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.14.0+.patch new file mode 100644 index 00000000000000..b7c286ec1ccf26 --- /dev/null +++ b/recipes/hdf5/all/patches/conanize-link-szip-1.14.0+.patch @@ -0,0 +1,45 @@ +diff -u a/CMakeFilters.cmake b/CMakeFilters.cmake +--- a/CMakeFilters.cmake 2023-01-04 22:29:45.875695757 +0100 ++++ b/CMakeFilters.cmake 2023-01-04 22:37:15.356762199 +0100 +@@ -59,9 +59,9 @@ + find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT ZLIB_FOUND) + find_package (ZLIB) # Legacy find +- if (ZLIB_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) +- endif () ++ endif() ++ if (ZLIB_FOUND) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) + endif () + endif () + if (ZLIB_FOUND) +@@ -105,20 +105,20 @@ + if (NOT SZIP_USE_EXTERNAL) + set(SZIP_FOUND FALSE) + if (USE_LIBAEC) +- set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC}) +- find_package (libaec 1.0.5 CONFIG) +- if (SZIP_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) +- endif () ++ find_package (libaec CONFIG REQUIRED) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) ++ set (SZIP_FOUND TRUE) + endif () + + if (NOT SZIP_FOUND) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) + find_package (SZIP) # Legacy find +- if (SZIP_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) +- endif () ++ endif() ++ if (TARGET szip-shared) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-shared) ++ else () ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-static) + endif () + endif () + endif () diff --git a/recipes/hdf5/all/test_package/conanfile.py b/recipes/hdf5/all/test_package/conanfile.py index 062e3a1d36ef6c..e3d318178049c6 100644 --- a/recipes/hdf5/all/test_package/conanfile.py +++ b/recipes/hdf5/all/test_package/conanfile.py @@ -1,7 +1,8 @@ +import os + from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout -import os +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout class TestPackageConan(ConanFile): @@ -21,6 +22,8 @@ def generate(self): "HDF5_CXX": self.options["hdf5"].enable_cxx, "HDF5_HL": self.options["hdf5"].hl, }) + if self.options["hdf5"].enable_cxx: + tc.variables.update({"CMAKE_CXX_STANDARD": 11}) tc.generate() def build(self): diff --git a/recipes/hdf5/all/test_v1_package/conanfile.py b/recipes/hdf5/all/test_v1_package/conanfile.py index 4d4698a0afd369..4c36411c061629 100644 --- a/recipes/hdf5/all/test_v1_package/conanfile.py +++ b/recipes/hdf5/all/test_v1_package/conanfile.py @@ -1,6 +1,7 @@ -from conans import ConanFile, CMake, tools import os +from conans import CMake, ConanFile, tools + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" @@ -12,6 +13,8 @@ def build(self): "HDF5_CXX": self.options["hdf5"].enable_cxx, "HDF5_HL": self.options["hdf5"].hl, }) + if self.options["hdf5"].enable_cxx: + cmake.definitions.update({"CMAKE_CXX_STANDARD": 11}) cmake.configure() cmake.build() diff --git a/recipes/hdf5/config.yml b/recipes/hdf5/config.yml index 05116bbcf4173b..6c8040e06da054 100644 --- a/recipes/hdf5/config.yml +++ b/recipes/hdf5/config.yml @@ -1,4 +1,6 @@ versions: + "1.14.0": + folder: all "1.13.1": folder: all "1.12.2": diff --git a/recipes/hidapi/all/conanfile.py b/recipes/hidapi/all/conanfile.py index eaf53fb9ab72b9..0d46e3c910cf03 100644 --- a/recipes/hidapi/all/conanfile.py +++ b/recipes/hidapi/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools -from conans.errors import ConanInvalidConfiguration -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 VirtualBuildEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.54.0" class HidapiConan(ConanFile): @@ -25,87 +30,108 @@ class HidapiConan(ConanFile): "shared": False, } - generators = "pkg_config" - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self._is_msvc: + if is_msvc(self): self.options.shared = True def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.settings.os in ["Linux", "FreeBSD"]: - self.requires("libusb/1.0.24") + self.requires("libusb/1.0.26") def validate(self): - if self._is_msvc and not self.options.shared: + if is_msvc(self) and not self.options.shared: raise ConanInvalidConfiguration("Static libraries for Visual Studio are currently not available") def build_requirements(self): - if not self._is_msvc: - self.build_requires("libtool/2.4.6") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if self.settings.os in ["Linux", "FreeBSD"] and 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", check_type=str): + self.tool_requires("msys2/cci.latest") 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], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "configure.ac"), - "AC_CONFIG_MACRO_DIR", "dnl AC_CONFIG_MACRO_DIR") - - @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)), - ] - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + replace_in_file(self, os.path.join(self.source_folder, "configure.ac"), + "AC_CONFIG_MACRO_DIR", "dnl AC_CONFIG_MACRO_DIR") def build(self): self._patch_sources() - if self._is_msvc: - self._build_msvc() + if is_msvc(self): + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + replace_in_file( + self, os.path.join(self.source_folder, "windows", "hidapi.vcxproj"), + "true", + "", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, os.path.join(self.source_folder, "windows", "hidapi.vcxproj"), + "", + f"", + ) + + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self.source_folder, "windows", "hidapi.sln"), targets=["hidapi"]) else: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() - def _build_msvc(self): - msbuild = MSBuild(self) - msbuild.build(os.path.join(self._source_subfolder, "windows", "hidapi.sln"), - platforms={"x86": "Win32"}) - def package(self): - self.copy("LICENSE*", src=self._source_subfolder, dst="licenses") - if self.settings.os == "Windows": - self.copy(os.path.join("hidapi", "*.h"), dst="include", src=self._source_subfolder) - self.copy("*hidapi.lib", dst="lib", keep_path=False) - self.copy("*.dll", dst="bin", keep_path=False) + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, os.path.join("hidapi", "*.h"), src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + output_folder = os.path.join(self.source_folder, "windows") + copy(self, "*hidapi.lib", src=output_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) 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") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: @@ -120,4 +146,4 @@ def package_info(self): else: self.cpp_info.libs = ["hidapi"] if self.settings.os == "Macos": - self.cpp_info.frameworks.extend(["IOKit", "CoreFoundation", "Appkit"]) + self.cpp_info.frameworks.extend(["IOKit", "CoreFoundation", "AppKit"]) diff --git a/recipes/hidapi/all/test_package/CMakeLists.txt b/recipes/hidapi/all/test_package/CMakeLists.txt index be3a6a4e6aaa6a..51fe04d5b6cce2 100644 --- a/recipes/hidapi/all/test_package/CMakeLists.txt +++ b/recipes/hidapi/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(hidapi CONFIG REQUIRED) +find_package(hidapi REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} hidapi::hidapi) +target_link_libraries(${PROJECT_NAME} PRIVATE hidapi::hidapi) diff --git a/recipes/hidapi/all/test_package/conanfile.py b/recipes/hidapi/all/test_package/conanfile.py index 8d1ff488f0374f..98ab55852ad565 100644 --- a/recipes/hidapi/all/test_package/conanfile.py +++ b/recipes/hidapi/all/test_package/conanfile.py @@ -1,19 +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 HidapiTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + 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,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/hidapi/all/test_v1_package/CMakeLists.txt b/recipes/hidapi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/hidapi/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/hidapi/all/test_v1_package/conanfile.py b/recipes/hidapi/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/hidapi/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/highfive/all/conanfile.py b/recipes/highfive/all/conanfile.py index 11ed9374f0a0ac..c7a09023dd38c6 100644 --- a/recipes/highfive/all/conanfile.py +++ b/recipes/highfive/all/conanfile.py @@ -34,9 +34,9 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hdf5/1.13.1") + self.requires("hdf5/1.14.0") if self.options.with_boost: - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") if self.options.with_eigen: self.requires("eigen/3.4.0") if self.options.with_xtensor: diff --git a/recipes/homog2d/all/conandata.yml b/recipes/homog2d/all/conandata.yml index 9703143edc4f09..c744269df86d0e 100644 --- a/recipes/homog2d/all/conandata.yml +++ b/recipes/homog2d/all/conandata.yml @@ -11,3 +11,7 @@ patches: - patch_file: "patches/0002-pretty_function-for-msvc.patch" patch_description: "use __FUNCSIG__ instead of __PRETTY_FUNCTION__ on MSVC" patch_type: "portability" + - patch_file: "patches/0003-support-msvc.patch" + patch_description: "fix msvc compilation error" + patch_type: "portability" + patch_source: "https://github.com/skramm/homog2d/issues/2" diff --git a/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch b/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch index ea9cad9d77946e..5b68d2eeb13eca 100644 --- a/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch +++ b/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch @@ -1,5 +1,5 @@ diff --git a/homog2d.hpp b/homog2d.hpp -index f30d150..68bc280 100644 +index f30d150..d82d7e5 100644 --- a/homog2d.hpp +++ b/homog2d.hpp @@ -115,12 +115,18 @@ See https://github.com/skramm/homog2d @@ -31,15 +31,3 @@ index f30d150..68bc280 100644 << "\n -Error count=" << ++errorCount(); \ throw std::runtime_error( oss.str() ); \ } -@@ -2914,11 +2920,6 @@ private: - h2d::operator * ( const h2d::Point2d_&, const h2d::Point2d_& ) - -> h2d::Line2d_; - -- template -- friend auto -- h2d::operator * ( const h2d::Homogr_&, const h2d::Line2d_& ) -- -> h2d::Line2d_; -- - template - friend base::LPBase - detail::crossProduct( const base::LPBase&, const base::LPBase& ); diff --git a/recipes/homog2d/all/patches/0003-support-msvc.patch b/recipes/homog2d/all/patches/0003-support-msvc.patch new file mode 100644 index 00000000000000..5897903f1959fb --- /dev/null +++ b/recipes/homog2d/all/patches/0003-support-msvc.patch @@ -0,0 +1,22 @@ +diff --git a/homog2d.hpp b/homog2d.hpp +index 77f6841..ab8646b 100644 +--- a/homog2d.hpp ++++ b/homog2d.hpp +@@ -729,12 +729,11 @@ auto + operator << ( std::ostream&, const h2d::base::LPBase& ) + -> std::ostream&; + } +-/* +-template +-auto +-operator << ( std::ostream&, const h2d::Point2d_& ) +--> std::ostream&; +-*/ ++ ++// forward declaration, related to https://github.com/skramm/homog2d/issues/2 ++template ++Line2d_ ++operator * ( const Homogr_&, const Line2d_& ); + + namespace detail { + diff --git a/recipes/http_parser/all/conanfile.py b/recipes/http_parser/all/conanfile.py index e764d7f53939c3..70717a99f03795 100644 --- a/recipes/http_parser/all/conanfile.py +++ b/recipes/http_parser/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class HttpParserConan(ConanFile): @@ -24,30 +24,24 @@ class HttpParserConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/http_parser/all/test_v1_package/conanfile.py b/recipes/http_parser/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/http_parser/all/test_v1_package/conanfile.py +++ b/recipes/http_parser/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/hyperscan/all/CMakeLists.txt b/recipes/hyperscan/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c355..00000000000000 --- a/recipes/hyperscan/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/hyperscan/all/conandata.yml b/recipes/hyperscan/all/conandata.yml index a03650d07b3ae0..b46d4ac06c6166 100644 --- a/recipes/hyperscan/all/conandata.yml +++ b/recipes/hyperscan/all/conandata.yml @@ -4,5 +4,9 @@ sources: sha256: "e51aba39af47e3901062852e5004d127fa7763b5dbbc16bcca4265243ffa106f" patches: "5.4.0": - - patch_file: "patches/fix-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "modify cmake files to build with conan" + patch_type: "conan" + - patch_file: "patches/0002-use-ue2-make_unique.patch" + patch_description: "add ue2:: prefix to make_unique for name collision" + patch_type: "portability" diff --git a/recipes/hyperscan/all/conanfile.py b/recipes/hyperscan/all/conanfile.py index f3eb36131b29f9..4e6a4a4f423c33 100644 --- a/recipes/hyperscan/all/conanfile.py +++ b/recipes/hyperscan/all/conanfile.py @@ -1,23 +1,20 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, 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.43.0" +required_conan_version = ">=1.53.0" class HyperscanConan(ConanFile): name = "hyperscan" + description = "High-performance regular expression matching library" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.hyperscan.io" - description = "High-performance regular expression matching library" topics = ("regex", "regular expressions") - settings = "os", "compiler", "build_type", "arch" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" - - _cmake = None - + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -26,9 +23,8 @@ class HyperscanConan(ConanFile): "build_avx512": [True, False], "fat_runtime": [True, False], "build_chimera": [True, False], - "dump_support": [True, False, "auto"] + "dump_support": [True, False, "auto"], } - default_options = { "shared": False, "fPIC": True, @@ -37,74 +33,79 @@ class HyperscanConan(ConanFile): "build_avx512": False, "fat_runtime": False, "build_chimera": False, - "dump_support": "auto" + "dump_support": "auto", } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("hyperscan-{0}".format(self.version), self._source_subfolder) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - def build_requirements(self): - self.build_requires("ragel/6.10"); + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.79.0"); + self.requires("boost/1.80.0"); if self.options.build_chimera: self.requires("pcre/8.45") def validate(self): - tools.check_min_cppstd(self, "11") + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + if self.options.shared and self.options.build_chimera: + raise ConanInvalidConfiguration("Chimera build requires static building") if self.settings.arch not in ["x86", "x86_64"]: raise ConanInvalidConfiguration("Hyperscan only support x86 architecture") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def build_requirements(self): + self.build_requires("ragel/6.10"); - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self); + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) if self.options.optimise != "auto": - self._cmake.definitions["OPTIMISE"] = self.options.optimise + tc.variables["OPTIMISE"] = self.options.optimise if self.options.debug_output != "auto": - self._cmake.definitions["DEBUG_OUTPUT"] = self.options.debug_output - self._cmake.definitions["BUILD_AVX512"] = self.options.build_avx512 - self._cmake.definitions["FAT_RUNTIME"] = self.options.fat_runtime - self._cmake.definitions["BUILD_CHIMERA"] = self.options.build_chimera + tc.variables["DEBUG_OUTPUT"] = self.options.debug_output + tc.variables["BUILD_AVX512"] = self.options.build_avx512 + tc.variables["FAT_RUNTIME"] = self.options.fat_runtime + tc.variables["BUILD_CHIMERA"] = self.options.build_chimera if self.options.dump_support != "auto": - self._cmake.definitions["DUMP_SUPPORT"] = self.options.dump_support - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def configure(self): - if self.options.shared: - del self.options.fPIC + tc.variables["DUMP_SUPPORT"] = self.options.dump_support + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() - if self.options.shared and self.options.build_chimera: - raise ConanInvalidConfiguration("Chimera build requires static building") + 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() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - 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, "share")) def package_info(self): self.cpp_info.names["cmake_find_package"] = "hyperscan" @@ -133,8 +134,6 @@ def package_info(self): self.cpp_info.components["chimera"].set_property("cmake_target_name", "hyperscan::chimera") self.cpp_info.components["chimera"].set_property("pkg_config_name", "libchimera") - - if not self.options.shared: if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["hs"].system_libs = ["m"] @@ -142,4 +141,3 @@ def package_info(self): if self.options.build_chimera: self.cpp_info.components["chimera"].system_libs = ["m"] - diff --git a/recipes/hyperscan/all/patches/fix-cmake.patch b/recipes/hyperscan/all/patches/0001-fix-cmake.patch similarity index 86% rename from recipes/hyperscan/all/patches/fix-cmake.patch rename to recipes/hyperscan/all/patches/0001-fix-cmake.patch index 0905e34e5bc471..872966c197543c 100644 --- a/recipes/hyperscan/all/patches/fix-cmake.patch +++ b/recipes/hyperscan/all/patches/0001-fix-cmake.patch @@ -1,7 +1,7 @@ -diff --git CMakeLists.txt CMakeLists.txt -index 8bc6077..579a7b4 100644 ---- CMakeLists.txt -+++ CMakeLists.txt +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8bc6077..0fbed25 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -6,7 +6,7 @@ set (HS_MINOR_VERSION 4) set (HS_PATCH_VERSION 0) set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION}) @@ -58,6 +58,15 @@ index 8bc6077..579a7b4 100644 # testing a builtin takes a little more work CHECK_C_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CC_BUILTIN_ASSUME_ALIGNED) +@@ -463,7 +463,7 @@ else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + endif() + +-add_subdirectory(util) ++# add_subdirectory(util) + add_subdirectory(doc/dev-reference) + + if (NOT WIN32) @@ -472,7 +472,7 @@ if (NOT WIN32) set(PCRE_REQUIRED_MAJOR_VERSION 8) set(PCRE_REQUIRED_MINOR_VERSION 41) @@ -67,15 +76,18 @@ index 8bc6077..579a7b4 100644 if (NOT CORRECT_PCRE_VERSION) message(STATUS "PCRE ${PCRE_REQUIRED_VERSION} or above not found") endif() -@@ -483,16 +483,16 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) +@@ -482,17 +482,19 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) + set(BUILD_CHIMERA TRUE) endif() ++if(0) add_subdirectory(unit) -if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt) +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt) add_subdirectory(tools) endif() -if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) ++endif() +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) add_subdirectory(chimera) endif() @@ -87,7 +99,7 @@ index 8bc6077..579a7b4 100644 configure_file(src/hs_version.h.in ${PROJECT_BINARY_DIR}/hs_version.h) if (NOT WIN32) -@@ -505,7 +505,7 @@ if (NOT WIN32) +@@ -505,7 +507,7 @@ if (NOT WIN32) endforeach() configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars @@ -96,7 +108,7 @@ index 8bc6077..579a7b4 100644 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() -@@ -524,7 +524,7 @@ if (WIN32) +@@ -524,7 +526,7 @@ if (WIN32) set(PCRE_REQUIRED_MAJOR_VERSION 8) set(PCRE_REQUIRED_MINOR_VERSION 41) set(PCRE_REQUIRED_VERSION ${PCRE_REQUIRED_MAJOR_VERSION}.${PCRE_REQUIRED_MINOR_VERSION}) @@ -105,20 +117,23 @@ index 8bc6077..579a7b4 100644 if (NOT CORRECT_PCRE_VERSION) message(STATUS "PCRE ${PCRE_REQUIRED_VERSION} or above not found") endif() -@@ -535,10 +535,10 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) +@@ -534,11 +536,13 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) + set(BUILD_CHIMERA TRUE) endif() ++if(0) add_subdirectory(unit) -if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt) +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt) add_subdirectory(tools) endif() -if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) ++endif() +if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) add_subdirectory(chimera) endif() endif() -@@ -548,14 +548,14 @@ set(RAGEL_C_FLAGS "-Wno-unused") +@@ -548,14 +552,14 @@ set(RAGEL_C_FLAGS "-Wno-unused") endif() set_source_files_properties( @@ -135,7 +150,7 @@ index 8bc6077..579a7b4 100644 PROPERTIES COMPILE_FLAGS "${RAGEL_C_FLAGS}") -@@ -1216,28 +1216,28 @@ else (FAT_RUNTIME) +@@ -1216,28 +1220,28 @@ else (FAT_RUNTIME) list(APPEND RUNTIME_LIBS $) set_target_properties(hs_exec_core2 PROPERTIES COMPILE_FLAGS "-march=core2" @@ -168,7 +183,7 @@ index 8bc6077..579a7b4 100644 ) endif (BUILD_AVX512) if (BUILD_AVX512VBMI) -@@ -1245,7 +1245,7 @@ else (FAT_RUNTIME) +@@ -1245,7 +1249,7 @@ else (FAT_RUNTIME) list(APPEND RUNTIME_LIBS $) set_target_properties(hs_exec_avx512vbmi PROPERTIES COMPILE_FLAGS "${ICELAKE_FLAG}" @@ -177,7 +192,7 @@ index 8bc6077..579a7b4 100644 ) endif (BUILD_AVX512VBMI) -@@ -1280,21 +1280,21 @@ else (FAT_RUNTIME) +@@ -1280,21 +1284,21 @@ else (FAT_RUNTIME) set_target_properties(hs_exec_shared_core2 PROPERTIES COMPILE_FLAGS "-march=core2" POSITION_INDEPENDENT_CODE TRUE @@ -202,7 +217,7 @@ index 8bc6077..579a7b4 100644 ) if (BUILD_AVX512) -@@ -1303,7 +1303,7 @@ else (FAT_RUNTIME) +@@ -1303,7 +1307,7 @@ else (FAT_RUNTIME) set_target_properties(hs_exec_shared_avx512 PROPERTIES COMPILE_FLAGS "${SKYLAKE_FLAG}" POSITION_INDEPENDENT_CODE TRUE @@ -211,7 +226,7 @@ index 8bc6077..579a7b4 100644 ) endif (BUILD_AVX512) if (BUILD_AVX512VBMI) -@@ -1312,7 +1312,7 @@ else (FAT_RUNTIME) +@@ -1312,7 +1316,7 @@ else (FAT_RUNTIME) set_target_properties(hs_exec_shared_avx512vbmi PROPERTIES COMPILE_FLAGS "${ICELAKE_FLAG}" POSITION_INDEPENDENT_CODE TRUE @@ -220,10 +235,10 @@ index 8bc6077..579a7b4 100644 ) endif (BUILD_AVX512VBMI) add_library(hs_exec_common_shared OBJECT -diff --git chimera/CMakeLists.txt chimera/CMakeLists.txt +diff --git a/chimera/CMakeLists.txt b/chimera/CMakeLists.txt index 1cd66a3..ebb3b49 100644 ---- chimera/CMakeLists.txt -+++ chimera/CMakeLists.txt +--- a/chimera/CMakeLists.txt ++++ b/chimera/CMakeLists.txt @@ -44,6 +44,6 @@ if (NOT WIN32) set(PRIVATE_LIBS "${PRIVATE_LIBS} -L${LIBDIR} -lpcre") @@ -232,10 +247,10 @@ index 1cd66a3..ebb3b49 100644 + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libch.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() -diff --git chimera/ch_database.h chimera/ch_database.h +diff --git a/chimera/ch_database.h b/chimera/ch_database.h index 28bde86..d757c82 100644 ---- chimera/ch_database.h -+++ chimera/ch_database.h +--- a/chimera/ch_database.h ++++ b/chimera/ch_database.h @@ -38,7 +38,7 @@ extern "C" { #endif @@ -245,10 +260,10 @@ index 28bde86..d757c82 100644 #include #include "ch_compile.h" // for CH_MODE_ flags -diff --git cmake/pcre.cmake cmake/pcre.cmake -index e0acda5..c68601f 100644 ---- cmake/pcre.cmake -+++ cmake/pcre.cmake +diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake +index e0acda5..c3cbbc7 100644 +--- a/cmake/pcre.cmake ++++ b/cmake/pcre.cmake @@ -1,4 +1,5 @@ # first look in pcre-$version or pcre subdirs + @@ -264,21 +279,21 @@ index e0acda5..c68601f 100644 - pkg_check_modules(PCRE libpcre>=${PCRE_REQUIRED_VERSION}) - if (PCRE_FOUND) + # conan should save us -+ find_package(PCRE) -+ if(PCRE_FOUND AND (PCRE_VERSION VERSION_GREATER_EQUAL PCRE_REQUIRED_VERSION)) ++ find_package(pcre) ++ if(pcre_FOUND AND (pcre_VERSION VERSION_GREATER_EQUAL PCRE_REQUIRED_VERSION)) set(CORRECT_PCRE_VERSION TRUE) - message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above") - else () - message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above not found") - return () - endif () -+ set(PCRE_LDFLAGS "PCRE::libpcre") ++ set(PCRE_LDFLAGS "pcre::pcre") + endif() endif (PCRE_BUILD_SOURCE) -diff --git tools/CMakeLists.txt tools/CMakeLists.txt +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 6ca3fd8..378afd0 100644 ---- tools/CMakeLists.txt -+++ tools/CMakeLists.txt +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt @@ -1,3 +1,7 @@ + +# Tools are not installed @@ -287,20 +302,20 @@ index 6ca3fd8..378afd0 100644 find_package(Threads) # remove some warnings -diff --git tools/hsbench/CMakeLists.txt tools/hsbench/CMakeLists.txt +diff --git a/tools/hsbench/CMakeLists.txt b/tools/hsbench/CMakeLists.txt index bbceda4..18545d0 100644 ---- tools/hsbench/CMakeLists.txt -+++ tools/hsbench/CMakeLists.txt +--- a/tools/hsbench/CMakeLists.txt ++++ b/tools/hsbench/CMakeLists.txt @@ -1,4 +1,4 @@ -include (${CMAKE_MODULE_PATH}/sqlite3.cmake) +include (sqlite3) if (NOT SQLITE3_FOUND) message(STATUS "sqlite3 not found, not building hsbench") return() -diff --git tools/hscollider/CMakeLists.txt tools/hscollider/CMakeLists.txt +diff --git a/tools/hscollider/CMakeLists.txt b/tools/hscollider/CMakeLists.txt index a4d71b2..f733479 100644 ---- tools/hscollider/CMakeLists.txt -+++ tools/hscollider/CMakeLists.txt +--- a/tools/hscollider/CMakeLists.txt ++++ b/tools/hscollider/CMakeLists.txt @@ -5,7 +5,7 @@ endif() include_directories(${PCRE_INCLUDE_DIRS}) diff --git a/recipes/hyperscan/all/patches/0002-use-ue2-make_unique.patch b/recipes/hyperscan/all/patches/0002-use-ue2-make_unique.patch new file mode 100644 index 00000000000000..9d4f5ee2944909 --- /dev/null +++ b/recipes/hyperscan/all/patches/0002-use-ue2-make_unique.patch @@ -0,0 +1,875 @@ +diff --git a/src/nfa/castlecompile.cpp b/src/nfa/castlecompile.cpp +index 5884ebb..1af6cd2 100644 +--- a/src/nfa/castlecompile.cpp ++++ b/src/nfa/castlecompile.cpp +@@ -281,7 +281,7 @@ vector> checkExclusion(u32 &streamStateSize, + size_t total = 0; + while (lower < trigSize) { + vector vertices; +- unique_ptr cg = make_unique(); ++ unique_ptr cg = ue2::make_unique(); + + vector> min_reset_dist; + size_t upper = min(lower + CLIQUE_GRAPH_MAX_SIZE, trigSize); +diff --git a/src/nfagraph/ng_equivalence.cpp b/src/nfagraph/ng_equivalence.cpp +index a42a0ac..9b1f072 100644 +--- a/src/nfagraph/ng_equivalence.cpp ++++ b/src/nfagraph/ng_equivalence.cpp +@@ -269,7 +269,7 @@ vector> getVertexInfos(const NGHolder &g) { + vertex_map.resize(num_verts); + + for (auto v : vertices_range(g)) { +- infos.push_back(make_unique(v, g)); ++ infos.push_back(ue2::make_unique(v, g)); + vertex_map[g[v].index] = infos.back().get(); + } + +@@ -516,7 +516,7 @@ void mergeClass(vector> &infos, NGHolder &g, + g[new_v].reports.clear(); /* populated as we pull in succs */ + + // store this vertex in our global vertex list +- infos.push_back(make_unique(new_v, g)); ++ infos.push_back(ue2::make_unique(new_v, g)); + VertexInfo *new_vertex_info = infos.back().get(); + + NFAVertex new_v_eod = NGHolder::null_vertex(); +@@ -525,7 +525,7 @@ void mergeClass(vector> &infos, NGHolder &g, + if (require_separate_eod_vertex(cur_class_vertices, g)) { + new_v_eod = clone_vertex(g, old_v); + g[new_v_eod].reports.clear(); +- infos.push_back(make_unique(new_v_eod, g)); ++ infos.push_back(ue2::make_unique(new_v_eod, g)); + new_vertex_info_eod = infos.back().get(); + } + +diff --git a/src/nfagraph/ng_violet.cpp b/src/nfagraph/ng_violet.cpp +index 78d7308..2807f2b 100644 +--- a/src/nfagraph/ng_violet.cpp ++++ b/src/nfagraph/ng_violet.cpp +@@ -375,7 +375,7 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored, + + DEBUG_PRINTF("candidate is a candidate\n"); + scores[v] = score; +- lit_info[v] = make_unique(v, s, anchored); ++ lit_info[v] = ue2::make_unique(v, s, anchored); + } + + /* try to filter out cases where appending some characters produces worse +@@ -531,7 +531,7 @@ void getRegionRoseLiterals(const NGHolder &g, bool seeking_anchored, + } + + DEBUG_PRINTF("candidate is a candidate\n"); +- lits->push_back(make_unique(vv, s, anchored)); ++ lits->push_back(ue2::make_unique(vv, s, anchored)); + } + } + +@@ -1835,7 +1835,7 @@ static + unique_ptr make_chain(u32 count) { + assert(count); + +- auto rv = make_unique(NFA_INFIX); ++ auto rv = ue2::make_unique(NFA_INFIX); + + NGHolder &h = *rv; + +diff --git a/src/rose/rose_build_add.cpp b/src/rose/rose_build_add.cpp +index aa043fa..f680dbb 100644 +--- a/src/rose/rose_build_add.cpp ++++ b/src/rose/rose_build_add.cpp +@@ -1802,7 +1802,7 @@ bool RoseBuildImpl::addOutfix(const NGHolder &h, const raw_som_dfa &haig) { + + bool RoseBuildImpl::addOutfix(const raw_puff &rp) { + if (!mpv_outfix) { +- mpv_outfix = make_unique(MpvProto()); ++ mpv_outfix = ue2::make_unique(MpvProto()); + } + + auto *mpv = mpv_outfix->mpv(); +@@ -1827,7 +1827,7 @@ bool RoseBuildImpl::addOutfix(const raw_puff &rp) { + bool RoseBuildImpl::addChainTail(const raw_puff &rp, u32 *queue_out, + u32 *event_out) { + if (!mpv_outfix) { +- mpv_outfix = make_unique(MpvProto()); ++ mpv_outfix = ue2::make_unique(MpvProto()); + } + + auto *mpv = mpv_outfix->mpv(); +diff --git a/src/rose/rose_build_anchored.cpp b/src/rose/rose_build_anchored.cpp +index 8ea07c9..1f918bb 100644 +--- a/src/rose/rose_build_anchored.cpp ++++ b/src/rose/rose_build_anchored.cpp +@@ -249,7 +249,7 @@ unique_ptr populate_holder(const simple_anchored_info &sai, + const flat_set &exit_ids) { + DEBUG_PRINTF("populating holder for ^.{%u,%u}%s\n", sai.min_bound, + sai.max_bound, dumpString(sai.literal).c_str()); +- auto h_ptr = make_unique(); ++ auto h_ptr = ue2::make_unique(); + NGHolder &h = *h_ptr; + auto ends = addDotsToGraph(h, h.start, sai.min_bound, sai.max_bound, + CharReach::dot()); +diff --git a/src/rose/rose_build_exclusive.cpp b/src/rose/rose_build_exclusive.cpp +index 6a5a710..966c908 100644 +--- a/src/rose/rose_build_exclusive.cpp ++++ b/src/rose/rose_build_exclusive.cpp +@@ -280,7 +280,7 @@ void findCliques(const map> &exclusiveGroups, + } + // Construct the exclusivity graph + map vertex_map; +- unique_ptr cg = make_unique(); ++ unique_ptr cg = ue2::make_unique(); + + // Add vertices representing infixes/suffixes + for (const auto &e : exclusiveGroups) { +diff --git a/src/rose/rose_build_program.cpp b/src/rose/rose_build_program.cpp +index 96c95db..81d605b 100644 +--- a/src/rose/rose_build_program.cpp ++++ b/src/rose/rose_build_program.cpp +@@ -95,7 +95,7 @@ OffsetMap makeOffsetMap(const RoseProgram &program, u32 *total_len) { + } + + RoseProgram::RoseProgram() { +- prog.push_back(make_unique()); ++ prog.push_back(ue2::make_unique()); + } + + RoseProgram::~RoseProgram() = default; +@@ -297,28 +297,28 @@ void addEnginesEodProgram(u32 eodNfaIterOffset, RoseProgram &program) { + } + + RoseProgram block; +- block.add_before_end(make_unique(eodNfaIterOffset)); ++ block.add_before_end(ue2::make_unique(eodNfaIterOffset)); + program.add_block(move(block)); + } + + void addSuffixesEodProgram(RoseProgram &program) { + RoseProgram block; +- block.add_before_end(make_unique()); ++ block.add_before_end(ue2::make_unique()); + program.add_block(move(block)); + } + + void addMatcherEodProgram(RoseProgram &program) { + RoseProgram block; +- block.add_before_end(make_unique()); ++ block.add_before_end(ue2::make_unique()); + program.add_block(move(block)); + } + + void addFlushCombinationProgram(RoseProgram &program) { +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + void addLastFlushCombinationProgram(RoseProgram &program) { +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + static +@@ -342,11 +342,11 @@ void makeRoleCheckLeftfix(const RoseBuildImpl &build, + + unique_ptr ri; + if (is_prefix) { +- ri = make_unique(lni.queue, build.g[v].left.lag, ++ ri = ue2::make_unique(lni.queue, build.g[v].left.lag, + build.g[v].left.leftfix_report, + end_inst); + } else { +- ri = make_unique(lni.queue, build.g[v].left.lag, ++ ri = ue2::make_unique(lni.queue, build.g[v].left.lag, + build.g[v].left.leftfix_report, + end_inst); + } +@@ -384,7 +384,7 @@ void makeAnchoredLiteralDelay(const RoseBuildImpl &build, + u32 anch_id = prog_build.anchored_programs.at(lit_id); + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(groups, anch_id, end_inst); ++ auto ri = ue2::make_unique(groups, anch_id, end_inst); + program.add_before_end(move(ri)); + } + +@@ -393,7 +393,7 @@ void makeDedupe(const ReportManager &rm, const Report &report, + RoseProgram &program) { + const auto *end_inst = program.end_instruction(); + auto ri = +- make_unique(report.quashSom, rm.getDkey(report), ++ ue2::make_unique(report.quashSom, rm.getDkey(report), + report.offsetAdjust, end_inst); + program.add_before_end(move(ri)); + } +@@ -402,7 +402,7 @@ static + void makeDedupeSom(const ReportManager &rm, const Report &report, + RoseProgram &program) { + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(report.quashSom, ++ auto ri = ue2::make_unique(report.quashSom, + rm.getDkey(report), + report.offsetAdjust, end_inst); + program.add_before_end(move(ri)); +@@ -428,7 +428,7 @@ void makeCatchup(const ReportManager &rm, bool needs_catchup, + return; + } + +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + static +@@ -511,12 +511,12 @@ void addLogicalSetRequired(const Report &report, ReportManager &rm, + return; + } + // set matching status of current lkey +- auto risl = make_unique(report.lkey, ++ auto risl = ue2::make_unique(report.lkey, + report.offsetAdjust); + program.add_before_end(move(risl)); + // set current lkey's corresponding ckeys active, pending to check + for (auto ckey : rm.getRelateCKeys(report.lkey)) { +- auto risc = make_unique(ckey); ++ auto risc = ue2::make_unique(ckey); + program.add_before_end(move(risc)); + } + } +@@ -532,7 +532,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + + // Handle min/max offset checks. + if (report.minOffset > 0 || report.maxOffset < MAX_OFFSET) { +- auto ri = make_unique(report.minOffset, ++ auto ri = ue2::make_unique(report.minOffset, + report.maxOffset, end_inst); + report_block.add_before_end(move(ri)); + } +@@ -540,7 +540,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + // If this report has an exhaustion key, we can check it in the program + // rather than waiting until we're in the callback adaptor. + if (report.ekey != INVALID_EKEY) { +- auto ri = make_unique(report.ekey, end_inst); ++ auto ri = ue2::make_unique(report.ekey, end_inst); + report_block.add_before_end(move(ri)); + } + +@@ -548,7 +548,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + // calculated. + if (isExternalSomReport(report) && + report.type != EXTERNAL_CALLBACK_SOM_PASS) { +- auto ri = make_unique(); ++ auto ri = ue2::make_unique(); + writeSomOperation(report, &ri->som); + report_block.add_before_end(move(ri)); + } +@@ -556,13 +556,13 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + // Min length constraint. + if (report.minLength > 0) { + assert(build.hasSom); +- auto ri = make_unique( ++ auto ri = ue2::make_unique( + report.offsetAdjust, report.minLength, end_inst); + report_block.add_before_end(move(ri)); + } + + if (report.quashSom) { +- report_block.add_before_end(make_unique()); ++ report_block.add_before_end(ue2::make_unique()); + } + + switch (report.type) { +@@ -578,7 +578,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + if (needs_dedupe) { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.quashSom, build.rm.getDkey(report), + report.onmatch, report.offsetAdjust, end_inst)); + } else { +@@ -587,7 +587,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } +@@ -597,28 +597,28 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + } + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + } else { // has_som + makeDedupeSom(build.rm, report, report_block); + if (report.ekey == INVALID_EKEY) { + if (!report.quiet) { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + } +@@ -639,17 +639,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + addFlushCombinationProgram(report_block); + } + if (has_som) { +- auto ri = make_unique(); ++ auto ri = ue2::make_unique(); + writeSomOperation(report, &ri->som); + report_block.add_before_end(move(ri)); + } else { +- auto ri = make_unique(); ++ auto ri = ue2::make_unique(); + writeSomOperation(report, &ri->som); + report_block.add_before_end(move(ri)); + } + break; + case INTERNAL_ROSE_CHAIN: { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.topSquashDistance)); + break; + } +@@ -663,17 +663,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + makeDedupeSom(build.rm, report, report_block); + if (report.ekey == INVALID_EKEY) { + if (!report.quiet) { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + addLogicalSetRequired(report, build.rm, report_block); +@@ -685,17 +685,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + makeDedupeSom(build.rm, report, report_block); + if (report.ekey == INVALID_EKEY) { + if (!report.quiet) { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + addLogicalSetRequired(report, build.rm, report_block); +@@ -722,11 +722,11 @@ void makeRoleReports(const RoseBuildImpl &build, + assert(contains(leftfix_info, v)); + const left_build_info &lni = leftfix_info.at(v); + program.add_before_end( +- make_unique(lni.queue, g[v].left.lag)); ++ ue2::make_unique(lni.queue, g[v].left.lag)); + report_som = true; + } else if (g[v].som_adjust) { + program.add_before_end( +- make_unique(g[v].som_adjust)); ++ ue2::make_unique(g[v].som_adjust)); + report_som = true; + } + +@@ -748,7 +748,7 @@ void makeRoleSetState(const unordered_map &roleStateIndices, + if (it == end(roleStateIndices)) { + return; + } +- program.add_before_end(make_unique(it->second)); ++ program.add_before_end(ue2::make_unique(it->second)); + } + + static +@@ -772,7 +772,7 @@ void makePushDelayedInstructions(const RoseLiteralMap &literals, + }); + + for (const auto &ri : delay_instructions) { +- program.add_before_end(make_unique(ri)); ++ program.add_before_end(ue2::make_unique(ri)); + } + } + +@@ -801,10 +801,10 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit, + const auto *end_inst = program.end_instruction(); + unique_ptr ri; + if (lit.s.any_nocase()) { +- ri = make_unique(lit.s.get_string(), ++ ri = ue2::make_unique(lit.s.get_string(), + end_inst); + } else { +- ri = make_unique(lit.s.get_string(), ++ ri = ue2::make_unique(lit.s.get_string(), + end_inst); + } + program.add_before_end(move(ri)); +@@ -820,10 +820,10 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit, + const auto *end_inst = program.end_instruction(); + unique_ptr ri; + if (lit.s.any_nocase()) { +- ri = make_unique(lit.s.get_string(), ++ ri = ue2::make_unique(lit.s.get_string(), + end_inst); + } else { +- ri = make_unique(lit.s.get_string(), end_inst); ++ ri = ue2::make_unique(lit.s.get_string(), end_inst); + } + program.add_before_end(move(ri)); + } +@@ -840,7 +840,7 @@ void makeRoleCheckNotHandled(ProgramBuild &prog_build, RoseVertex v, + } + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(handled_key, end_inst); ++ auto ri = ue2::make_unique(handled_key, end_inst); + program.add_before_end(move(ri)); + } + +@@ -889,7 +889,7 @@ void makeRoleCheckBounds(const RoseBuildImpl &build, RoseVertex v, + + const auto *end_inst = program.end_instruction(); + program.add_before_end( +- make_unique(min_bound, max_bound, end_inst)); ++ ue2::make_unique(min_bound, max_bound, end_inst)); + } + + static +@@ -924,7 +924,7 @@ void makeRoleGroups(const RoseGraph &g, ProgramBuild &prog_build, + return; + } + +- program.add_before_end(make_unique(groups)); ++ program.add_before_end(ue2::make_unique(groups)); + } + + static +@@ -968,7 +968,7 @@ bool makeRoleByte(const vector &look, RoseProgram &program) { + s32 checkbyte_offset = verify_s32(entry.offset); + DEBUG_PRINTF("CHECK BYTE offset=%d\n", checkbyte_offset); + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(andmask_u8, cmpmask_u8, flip, ++ auto ri = ue2::make_unique(andmask_u8, cmpmask_u8, flip, + checkbyte_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1000,7 +1000,7 @@ bool makeRoleMask(const vector &look, RoseProgram &program) { + DEBUG_PRINTF("CHECK MASK and_mask=%llx cmp_mask=%llx\n", + and_mask, cmp_mask); + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(and_mask, cmp_mask, neg_mask, ++ auto ri = ue2::make_unique(and_mask, cmp_mask, neg_mask, + base_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1055,7 +1055,7 @@ bool makeRoleMask32(const vector &look, + DEBUG_PRINTF("base_offset %d\n", base_offset); + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(and_mask, cmp_mask, neg_mask, ++ auto ri = ue2::make_unique(and_mask, cmp_mask, neg_mask, + base_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1098,7 +1098,7 @@ bool makeRoleMask64(const vector &look, + DEBUG_PRINTF("base_offset %d\n", base_offset); + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(and_mask, cmp_mask, neg_mask, ++ auto ri = ue2::make_unique(and_mask, cmp_mask, neg_mask, + base_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1235,7 +1235,7 @@ makeCheckShufti16x8(u32 offset_range, u8 bucket_idx, + copy(hi_mask.begin(), hi_mask.begin() + 16, nib_mask.begin() + 16); + copy(bucket_select_mask.begin(), bucket_select_mask.begin() + 16, + bucket_select_mask_16.begin()); +- return make_unique ++ return ue2::make_unique + (nib_mask, bucket_select_mask_16, + neg_mask & 0xffff, base_offset, end_inst); + } +@@ -1255,7 +1255,7 @@ makeCheckShufti32x8(u32 offset_range, u8 bucket_idx, + array lo_mask_16; + copy(hi_mask.begin(), hi_mask.begin() + 16, hi_mask_16.begin()); + copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_16.begin()); +- return make_unique ++ return ue2::make_unique + (hi_mask_16, lo_mask_16, bucket_select_mask, + neg_mask, base_offset, end_inst); + } +@@ -1277,7 +1277,7 @@ makeCheckShufti16x16(u32 offset_range, u8 bucket_idx, + bucket_select_mask_32.begin()); + copy(bucket_select_mask_hi.begin(), bucket_select_mask_hi.begin() + 16, + bucket_select_mask_32.begin() + 16); +- return make_unique ++ return ue2::make_unique + (hi_mask, lo_mask, bucket_select_mask_32, + neg_mask & 0xffff, base_offset, end_inst); + } +@@ -1294,7 +1294,7 @@ makeCheckShufti32x16(u32 offset_range, u8 bucket_idx, + return nullptr; + } + +- return make_unique ++ return ue2::make_unique + (hi_mask, lo_mask, bucket_select_mask_hi, + bucket_select_mask_lo, neg_mask, base_offset, end_inst); + } +@@ -1321,7 +1321,7 @@ makeCheckShufti64x8(u32 offset_range, u8 bucket_idx, + copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_64.begin() + 32); + copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_64.begin() + 48); + +- return make_unique ++ return ue2::make_unique + (hi_mask_64, lo_mask_64, bucket_select_mask, + neg_mask, base_offset, end_inst); + } +@@ -1361,7 +1361,7 @@ makeCheckShufti64x16(u32 offset_range, u8 bucket_idx, + copy(lo_mask.begin() + 16, lo_mask.begin() + 32, lo_mask_2.begin() + 32); + copy(lo_mask.begin() + 16, lo_mask.begin() + 32, lo_mask_2.begin() + 48); + +- return make_unique ++ return ue2::make_unique + (hi_mask_1, hi_mask_2, lo_mask_1, lo_mask_2, bucket_select_mask_hi, + bucket_select_mask_lo, neg_mask, base_offset, end_inst); + } +@@ -1486,7 +1486,7 @@ void makeLookaroundInstruction(const vector &look, + if (look.size() == 1) { + s8 offset = look.begin()->offset; + const CharReach &reach = look.begin()->reach; +- auto ri = make_unique(offset, reach, ++ auto ri = ue2::make_unique(offset, reach, + program.end_instruction()); + program.add_before_end(move(ri)); + return; +@@ -1508,7 +1508,7 @@ void makeLookaroundInstruction(const vector &look, + return; + } + +- auto ri = make_unique(look, ++ auto ri = ue2::make_unique(look, + program.end_instruction()); + program.add_before_end(move(ri)); + } +@@ -1584,7 +1584,7 @@ void makeCheckLitEarlyInstruction(const RoseBuildImpl &build, u32 lit_id, + + DEBUG_PRINTF("adding lit early check, min_offset=%u\n", min_offset); + const auto *end = prog.end_instruction(); +- prog.add_before_end(make_unique(min_offset, end)); ++ prog.add_before_end(ue2::make_unique(min_offset, end)); + } + + static +@@ -1595,7 +1595,7 @@ void makeGroupCheckInstruction(const RoseBuildImpl &build, u32 lit_id, + if (!info.group_mask) { + return; + } +- prog.add_before_end(make_unique(info.group_mask)); ++ prog.add_before_end(ue2::make_unique(info.group_mask)); + } + + static +@@ -1762,7 +1762,7 @@ bool makeRoleMultipathShufti(const vector> &multi_look, + copy(begin(lo_mask), begin(lo_mask) + 16, nib_mask.begin()); + copy(begin(hi_mask), begin(hi_mask) + 16, nib_mask.begin() + 16); + +- auto ri = make_unique ++ auto ri = ue2::make_unique + (nib_mask, bucket_select_lo, data_select_mask, hi_bits_mask, + lo_bits_mask, neg_mask, base_offset, last_start, end_inst); + program.add_before_end(move(ri)); +@@ -1771,20 +1771,20 @@ bool makeRoleMultipathShufti(const vector> &multi_look, + assert(!(hi_bits_mask & ~0xffffffffULL)); + assert(!(lo_bits_mask & ~0xffffffffULL)); + if (bit_index <= 8) { +- auto ri = make_unique ++ auto ri = ue2::make_unique + (hi_mask, lo_mask, bucket_select_lo, data_select_mask, + hi_bits_mask, lo_bits_mask, neg_mask, base_offset, + last_start, end_inst); + program.add_before_end(move(ri)); + } else { +- auto ri = make_unique ++ auto ri = ue2::make_unique + (hi_mask, lo_mask, bucket_select_hi, bucket_select_lo, + data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask, + base_offset, last_start, end_inst); + program.add_before_end(move(ri)); + } + } else { +- auto ri = make_unique ++ auto ri = ue2::make_unique + (hi_mask, lo_mask, bucket_select_lo, data_select_mask, + hi_bits_mask, lo_bits_mask, neg_mask, base_offset, + last_start, end_inst); +@@ -1856,7 +1856,7 @@ void makeRoleMultipathLookaround(const vector> &multi_look, + ordered_look.emplace_back(multi_entry); + } + +- auto ri = make_unique(move(ordered_look), ++ auto ri = ue2::make_unique(move(ordered_look), + last_start, start_mask, + program.end_instruction()); + program.add_before_end(move(ri)); +@@ -1932,7 +1932,7 @@ void makeRoleSuffix(const RoseBuildImpl &build, + event = MQE_TOP; + } + +- prog.add_before_end(make_unique(queue, event)); ++ prog.add_before_end(ue2::make_unique(queue, event)); + } + + static +@@ -1945,7 +1945,7 @@ void addInfixTriggerInstructions(vector triggers, + }); + for (const auto &ti : triggers) { + prog.add_before_end( +- make_unique(ti.cancel, ti.queue, ti.event)); ++ ue2::make_unique(ti.cancel, ti.queue, ti.event)); + } + } + +@@ -2039,7 +2039,7 @@ static + void addCheckOnlyEodInstruction(RoseProgram &prog) { + DEBUG_PRINTF("only at eod\n"); + const auto *end_inst = prog.end_instruction(); +- prog.add_before_end(make_unique(end_inst)); ++ prog.add_before_end(ue2::make_unique(end_inst)); + } + + static +@@ -2164,7 +2164,7 @@ void makeGroupSquashInstruction(const RoseBuildImpl &build, u32 lit_id, + DEBUG_PRINTF("squashes 0x%llx\n", info.group_mask); + assert(info.group_mask); + /* Note: group_mask is negated. */ +- prog.add_before_end(make_unique(~info.group_mask)); ++ prog.add_before_end(ue2::make_unique(~info.group_mask)); + } + + namespace { +@@ -2209,7 +2209,7 @@ RoseProgram assembleProgramBlocks(vector &&blocks_in) { + * only set if a state has been. */ + if (!prog.empty() && reads_work_done_flag(block)) { + RoseProgram clear_block; +- clear_block.add_before_end(make_unique()); ++ clear_block.add_before_end(ue2::make_unique()); + prog.add_block(move(clear_block)); + } + +@@ -2369,7 +2369,7 @@ void makeCatchupMpv(const ReportManager &rm, bool needs_mpv_catchup, + return; + } + +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + RoseProgram makeReportProgram(const RoseBuildImpl &build, +@@ -2402,7 +2402,7 @@ RoseProgram makeBoundaryProgram(const RoseBuildImpl &build, + void addIncludedJumpProgram(RoseProgram &program, u32 child_offset, + u8 squash) { + RoseProgram block; +- block.add_before_end(make_unique(child_offset, ++ block.add_before_end(ue2::make_unique(child_offset, + squash)); + program.add_block(move(block)); + } +@@ -2413,7 +2413,7 @@ void addPredBlockSingle(u32 pred_state, RoseProgram &pred_block, + // Prepend an instruction to check the pred state is on. + const auto *end_inst = pred_block.end_instruction(); + pred_block.insert(begin(pred_block), +- make_unique(pred_state, end_inst)); ++ ue2::make_unique(pred_state, end_inst)); + program.add_block(move(pred_block)); + } + +@@ -2428,7 +2428,7 @@ void addPredBlocksAny(map &pred_blocks, u32 num_states, + } + + const RoseInstruction *end_inst = sparse_program.end_instruction(); +- auto ri = make_unique(num_states, keys, end_inst); ++ auto ri = ue2::make_unique(num_states, keys, end_inst); + sparse_program.add_before_end(move(ri)); + + RoseProgram &block = pred_blocks.begin()->second; +@@ -2451,14 +2451,14 @@ void addPredBlocksMulti(map &pred_blocks, + vector> jump_table; + + // BEGIN instruction. +- auto ri_begin = make_unique(num_states, end_inst); ++ auto ri_begin = ue2::make_unique(num_states, end_inst); + RoseInstrSparseIterBegin *begin_inst = ri_begin.get(); + sparse_program.add_before_end(move(ri_begin)); + + // NEXT instructions, one per pred program. + u32 prev_key = pred_blocks.begin()->first; + for (auto it = next(begin(pred_blocks)); it != end(pred_blocks); ++it) { +- auto ri = make_unique(prev_key, begin_inst, ++ auto ri = ue2::make_unique(prev_key, begin_inst, + end_inst); + sparse_program.add_before_end(move(ri)); + prev_key = it->first; +@@ -2539,7 +2539,7 @@ void applyFinalSpecialisation(RoseProgram &program) { + auto it = next(program.rbegin()); + if (auto *ri = dynamic_cast(it->get())) { + DEBUG_PRINTF("replacing REPORT with FINAL_REPORT\n"); +- program.replace(it, make_unique( ++ program.replace(it, ue2::make_unique( + ri->onmatch, ri->offset_adjust)); + } + } +diff --git a/src/rose/rose_in_util.cpp b/src/rose/rose_in_util.cpp +index 9fe47c2..6fa56d1 100644 +--- a/src/rose/rose_in_util.cpp ++++ b/src/rose/rose_in_util.cpp +@@ -93,7 +93,7 @@ private: + + unique_ptr cloneRoseGraph(const RoseInGraph &ig) { + assert(hasCorrectlyNumberedVertices(ig)); +- unique_ptr out = make_unique(); ++ unique_ptr out = ue2::make_unique(); + + unordered_map> graph_map; + unordered_map> haig_map; +diff --git a/src/smallwrite/smallwrite_build.cpp b/src/smallwrite/smallwrite_build.cpp +index 4eb4801..6acdf3c 100644 +--- a/src/smallwrite/smallwrite_build.cpp ++++ b/src/smallwrite/smallwrite_build.cpp +@@ -680,7 +680,7 @@ unique_ptr buildDfa(LitTrie &trie, bool nocase) { + // Construct DFA states in BFS order. + const auto state_ids = makeStateMap(trie, ordering); + +- auto rdfa = make_unique(NFA_OUTFIX); ++ auto rdfa = ue2::make_unique(NFA_OUTFIX); + + // Calculate alphabet. + array unalpha; +diff --git a/tools/hsbench/main.cpp b/tools/hsbench/main.cpp +index 1c91813..4ec793e 100644 +--- a/tools/hsbench/main.cpp ++++ b/tools/hsbench/main.cpp +@@ -1038,7 +1038,7 @@ void runBenchmark(const Engine &db, + int HS_CDECL main(int argc, char *argv[]) { + unique_ptr grey; + #if !defined(RELEASE_BUILD) +- grey = make_unique(); ++ grey = ue2::make_unique(); + #endif + setlocale(LC_ALL, ""); // use the user's locale + +diff --git a/tools/hscheck/main.cpp b/tools/hscheck/main.cpp +index 197087b..bdecab8 100644 +--- a/tools/hscheck/main.cpp ++++ b/tools/hscheck/main.cpp +@@ -664,7 +664,7 @@ int HS_CDECL main(int argc, char **argv) { + num_of_threads = max(1u, std::thread::hardware_concurrency()); + + #if !defined(RELEASE_BUILD) +- g_grey = make_unique(); ++ g_grey = ue2::make_unique(); + #endif + processArgs(argc, argv, g_grey); + +diff --git a/tools/hscollider/GraphTruth.cpp b/tools/hscollider/GraphTruth.cpp +index 0b67b11..e43beb1 100644 +--- a/tools/hscollider/GraphTruth.cpp ++++ b/tools/hscollider/GraphTruth.cpp +@@ -134,7 +134,7 @@ void CNGInfo::compile() { + auto pl = ue2::make_unique(); + pl->parseLogicalCombination(id, re.c_str(), ~0U, 0, ~0ULL); + pl->logicalKeyRenumber(); +- cng = make_unique(move(pl)); ++ cng = ue2::make_unique(move(pl)); + return; + } + +@@ -193,7 +193,7 @@ void CNGInfo::compile() { + } + } + +- cng = make_unique(move(g), move(rm)); ++ cng = ue2::make_unique(move(g), move(rm)); + } catch (CompileError &e) { + throw NGCompileFailure(e.reason); + } catch (NGUnsupportedFailure &e) { +@@ -257,7 +257,7 @@ unique_ptr GraphTruth::preprocess(unsigned id, + } + } + +- auto cngi = make_unique(id, m_expr); ++ auto cngi = ue2::make_unique(id, m_expr); + cngi->utf8 = hs_flags & HS_FLAG_UTF8; + cngi->highlander = highlander; + cngi->prefilter = prefilter; +diff --git a/tools/hscollider/GroundTruth.cpp b/tools/hscollider/GroundTruth.cpp +index a267306..d9293dc 100644 +--- a/tools/hscollider/GroundTruth.cpp ++++ b/tools/hscollider/GroundTruth.cpp +@@ -331,7 +331,7 @@ GroundTruth::compile(unsigned id, bool no_callouts) { + int errloc = 0; + int errcode = 0; + +- unique_ptr compiled = make_unique(); ++ unique_ptr compiled = ue2::make_unique(); + compiled->utf8 = flags & PCRE_UTF8; + compiled->highlander = highlander; + compiled->prefilter = prefilter; +diff --git a/tools/hscollider/main.cpp b/tools/hscollider/main.cpp +index afa6ef5..c85526e 100644 +--- a/tools/hscollider/main.cpp ++++ b/tools/hscollider/main.cpp +@@ -1606,7 +1606,7 @@ void generateTests(CorporaSource &corpora_src, const ExpressionMap &exprMap, + max_generator_queue_len); + vector> generators; + for (size_t i = 0; i < numGeneratorThreads; i++) { +- auto c = make_unique(i, testq, corpq, corpora_src); ++ auto c = ue2::make_unique(i, testq, corpq, corpora_src); + c->start(); + generators.push_back(move(c)); + } +diff --git a/util/ng_corpus_generator.cpp b/util/ng_corpus_generator.cpp +index e5e8e06..2e0080a 100644 +--- a/util/ng_corpus_generator.cpp ++++ b/util/ng_corpus_generator.cpp +@@ -200,7 +200,7 @@ void findPaths(const NGHolder &g, CorpusProperties &cProps, + if (boost::next(ai) == ae) { + new_path = std::move(p); + } else { +- new_path = make_unique(*p); ++ new_path = ue2::make_unique(*p); + } + + new_path->push_back(v); diff --git a/recipes/hyperscan/all/test_package/CMakeLists.txt b/recipes/hyperscan/all/test_package/CMakeLists.txt index 0e579ae32cbada..8cfec33c7dfff6 100644 --- a/recipes/hyperscan/all/test_package/CMakeLists.txt +++ b/recipes/hyperscan/all/test_package/CMakeLists.txt @@ -1,16 +1,15 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(hyperscan COMPONENTS hs REQUIRED) + add_executable(hs_example hs_example.cpp) target_link_libraries(hs_example PRIVATE hyperscan::hs) +target_compile_features(hs_example PRIVATE cxx_std_11) if(BUILD_CHIMERA) find_package(hyperscan COMPONENTS chimera REQUIRED) add_executable(ch_example ch_example.cpp) target_link_libraries(ch_example PRIVATE hyperscan::chimera) + target_compile_features(ch_example PRIVATE cxx_std_11) endif() - diff --git a/recipes/hyperscan/all/test_package/conanfile.py b/recipes/hyperscan/all/test_package/conanfile.py index 5ce555b9552f06..e299e5dd32f1b8 100644 --- a/recipes/hyperscan/all/test_package/conanfile.py +++ b/recipes/hyperscan/all/test_package/conanfile.py @@ -1,25 +1,40 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv import os -from conans import ConanFile, CMake, tools -from conan.tools.build import cross_building +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + def requirements(self): + self.requires(self.tested_reference_str) -class HyperscanTestConan(ConanFile): - settings = "os", "build_type", "arch", "compiler" - generators = "cmake", "cmake_find_package" + def layout(self): + cmake_layout(self) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_CHIMERA"] = self.options["hyperscan"].build_chimera + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + venv = VirtualBuildEnv(self) + venv.generate(scope="build") def build(self): cmake = CMake(self) - cmake.definitions["BUILD_CHIMERA"] = self.options["hyperscan"].build_chimera cmake.configure() cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "hs_example") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "hs_example") self.run(bin_path, run_environment=True) if self.options["hyperscan"].build_chimera: - bin_path = os.path.join("bin", "ch_example") + bin_path = os.path.join(self.cpp.build.bindirs[0], "ch_example") self.run(bin_path, run_environment=True) diff --git a/recipes/hyperscan/all/test_v1_package/CMakeLists.txt b/recipes/hyperscan/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/hyperscan/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/hyperscan/all/test_v1_package/conanfile.py b/recipes/hyperscan/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..cb26b3fe155907 --- /dev/null +++ b/recipes/hyperscan/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +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.definitions["BUILD_CHIMERA"] = self.options["hyperscan"].build_chimera + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "hs_example") + self.run(bin_path, run_environment=True) + + if self.options["hyperscan"].build_chimera: + bin_path = os.path.join("bin", "ch_example") + self.run(bin_path, run_environment=True) diff --git a/recipes/imgui/all/conandata.yml b/recipes/imgui/all/conandata.yml index 9ed281a0bbcaf8..4ad544bfd412c9 100644 --- a/recipes/imgui/all/conandata.yml +++ b/recipes/imgui/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.89.2": + url: "https://github.com/ocornut/imgui/archive/v1.89.2.tar.gz" + sha256: "e110beffda505e6954feb7b13541d35a7c12a176b9723290c853684713df6a67" "1.89.1": url: "https://github.com/ocornut/imgui/archive/v1.89.1.tar.gz" sha256: "6d02a0079514d869e4b5f8f590f9060259385fcddd93a07ef21298b6a9610cbd" diff --git a/recipes/imgui/config.yml b/recipes/imgui/config.yml index 876df7dac77899..c809f19e5ffedd 100644 --- a/recipes/imgui/config.yml +++ b/recipes/imgui/config.yml @@ -1,4 +1,6 @@ versions: + "1.89.2": + folder: all "1.89.1": folder: all "1.88": diff --git a/recipes/itlib/all/conandata.yml b/recipes/itlib/all/conandata.yml index a892e231322bba..7baad7835ef3db 100644 --- a/recipes/itlib/all/conandata.yml +++ b/recipes/itlib/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.8.1": + url: "https://github.com/iboB/itlib/archive/v1.8.1.tar.gz" + sha256: "7a8619073d0bbd5a5cea0ee9bb1b3b749348cbab1d12e4e0c234215f26388aef" + "1.8.0": + url: "https://github.com/iboB/itlib/archive/v1.8.0.tar.gz" + sha256: "70b6493b0cc3a720ffd48e98e3f009e8d94003380800bf07e61f167e813a9add" "1.7.0": url: "https://github.com/iboB/itlib/archive/v1.7.0.tar.gz" sha256: "9a27138cfa8554eb69436bb1afacfafc5a3888b6e05f9124b2d20da7ab55b723" diff --git a/recipes/itlib/config.yml b/recipes/itlib/config.yml index 5f100c0f23fd3e..4399ebe9b5da56 100644 --- a/recipes/itlib/config.yml +++ b/recipes/itlib/config.yml @@ -1,4 +1,8 @@ versions: + "1.8.1": + folder: all + "1.8.0": + folder: all "1.7.0": folder: all "1.6.3": diff --git a/recipes/jasper/all/conandata.yml b/recipes/jasper/all/conandata.yml index e929114808462a..b08601c042de06 100644 --- a/recipes/jasper/all/conandata.yml +++ b/recipes/jasper/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.0.0": + url: "https://github.com/jasper-software/jasper/releases/download/version-4.0.0/jasper-4.0.0.tar.gz" + sha256: "39514e1b53a5333fcff817e19565371f016ea536c36fd2d13a9c4d8da8f0be0c" "3.0.6": url: "https://github.com/jasper-software/jasper/archive/refs/tags/version-3.0.6.tar.gz" sha256: "c79961bc00158f5b5dc5f5fcfa792fde9bebb024432689d0f9e3f95a097d0ec3" @@ -6,6 +9,17 @@ sources: url: "https://github.com/jasper-software/jasper/archive/refs/tags/version-2.0.33.tar.gz" sha256: "38b8f74565ee9e7fec44657e69adb5c9b2a966ca5947ced5717cde18a7d2eca6" patches: + "4.0.0": + - patch_file: "patches/4.0.0-0001-skip-rpath.patch" + patch_description: "Do not enforce rpath configuration" + patch_source: "https://github.com/jasper-software/jasper/pull/347" + patch_type: "conan" + - patch_file: "patches/4.0.0-0002-find-libjpeg.patch" + patch_description: "check_c_source_compilers does not work with conan gens. See https://github.com/conan-io/conan/issues/12180" + patch_type: "conan" + - patch_file: "patches/4.0.0-0003-deterministic-libname.patch" + patch_description: "No generator dependent libname" + patch_type: "conan" "3.0.6": - patch_file: "patches/3.0.6-0001-skip-rpath.patch" patch_description: "Do not enforce rpath configuration" diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index d677d22f394d50..9893cd476a58fd 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -3,6 +3,7 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os import textwrap @@ -20,7 +21,7 @@ class JasperConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "with_libjpeg": ["libjpeg", "libjpeg-turbo"], + "with_libjpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], } default_options = { "shared": False, @@ -45,10 +46,12 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - if self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.4") - elif self.options.with_libjpeg == "libjpeg": + if self.options.with_libjpeg == "libjpeg": self.requires("libjpeg/9e") + elif self.options.with_libjpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_libjpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -56,13 +59,17 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + if Version(self.version) >= "4.0.0": + tc.variables["JAS_ENABLE_PIC"] = self.options.get_safe("fPIC", True) tc.variables["JAS_ENABLE_DOC"] = False tc.variables["JAS_ENABLE_LATEX"] = False tc.variables["JAS_ENABLE_PROGRAMS"] = False tc.variables["JAS_ENABLE_SHARED"] = self.options.shared tc.variables["JAS_LIBJPEG_REQUIRED"] = "REQUIRED" + tc.variables["JAS_ENABLE_LIBJPEG"] = bool(self.options.with_libjpeg) + if Version(self.version) >= "3.0.0": + tc.variables["JAS_ENABLE_LIBHEIF"] = False tc.variables["JAS_ENABLE_OPENGL"] = False - tc.variables["JAS_ENABLE_LIBJPEG"] = True if cross_building(self): tc.cache_variables["JAS_CROSSCOMPILING"] = True @@ -126,6 +133,13 @@ def package_info(self): self.cpp_info.libs = ["jasper"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread"]) + self.cpp_info.requires = [] + if self.options.with_libjpeg == "libjpeg": + self.cpp_info.requires.append("libjpeg::libjpeg") + elif self.options.with_libjpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + elif self.options.with_libjpeg == "mozjpeg": + self.cpp_info.requires.append("mozjpeg::libjpeg") # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "Jasper" diff --git a/recipes/jasper/all/patches/4.0.0-0001-skip-rpath.patch b/recipes/jasper/all/patches/4.0.0-0001-skip-rpath.patch new file mode 100644 index 00000000000000..4be85edcc1149d --- /dev/null +++ b/recipes/jasper/all/patches/4.0.0-0001-skip-rpath.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -793,19 +793,15 @@ if(JAS_ENABLE_SHARED) + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH +- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # The RPATH to be used when installing, but only if it's not a + # system directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if(isSystemDir EQUAL -1) +- set(CMAKE_INSTALL_RPATH +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif() + endif() + diff --git a/recipes/jasper/all/patches/4.0.0-0002-find-libjpeg.patch b/recipes/jasper/all/patches/4.0.0-0002-find-libjpeg.patch new file mode 100644 index 00000000000000..b98de65fb7adfb --- /dev/null +++ b/recipes/jasper/all/patches/4.0.0-0002-find-libjpeg.patch @@ -0,0 +1,16 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -731,12 +731,7 @@ if(JAS_ENABLE_LIBJPEG) + # (e.g., stdio.h and stdint.h). So, we cannot reliably use + # check_include_file here. + jas_get_includes_from_targets(CMAKE_REQUIRED_INCLUDES JPEG::JPEG) +- check_c_source_compiles(" +- #include +- #include +- #include +- int main() {} +- " JAS_HAVE_JPEGLIB_H) ++ set(JAS_HAVE_JPEGLIB_H 1) + if(JAS_HAVE_JPEGLIB_H) + set(JAS_HAVE_LIBJPEG 1) + set(JAS_LIBJPEG_TARGET JPEG::JPEG) diff --git a/recipes/jasper/all/patches/4.0.0-0003-deterministic-libname.patch b/recipes/jasper/all/patches/4.0.0-0003-deterministic-libname.patch new file mode 100644 index 00000000000000..d2b29d21cbd988 --- /dev/null +++ b/recipes/jasper/all/patches/4.0.0-0003-deterministic-libname.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -262,7 +262,7 @@ endif() + # If a multiconfiguration generator is used, ensure that various output + # files are not placed in subdirectories (such as Debug and Release) + # as this will cause the CTest test suite to fail. +-if(JAS_MULTICONFIGURATION_GENERATOR) ++if(0) + if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_DEBUG_POSTFIX d) + endif() diff --git a/recipes/jasper/config.yml b/recipes/jasper/config.yml index 8b1f048c0d0c7b..4a60a36eef3ae0 100644 --- a/recipes/jasper/config.yml +++ b/recipes/jasper/config.yml @@ -1,4 +1,6 @@ versions: + "4.0.0": + folder: all "3.0.6": folder: all "2.0.33": diff --git a/recipes/jom/all/conanfile.py b/recipes/jom/all/conanfile.py index d1824504b7e54d..e94e1344b85efd 100644 --- a/recipes/jom/all/conanfile.py +++ b/recipes/jom/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import get, download +from conan.tools.files import copy, download, get from conan.errors import ConanInvalidConfiguration import os @@ -10,12 +10,10 @@ class JomInstallerConan(ConanFile): description = "jom is a clone of nmake to support the execution of multiple independent commands in parallel" url = "https://github.com/conan-io/conan-center-index" homepage = "http://wiki.qt.io/Jom" - license = "GPL-3.0" - topics = ("build", "makefile", "make") - + license = "GPL-3.0-only" + topics = ("build", "make", "makefile", "nmake") settings = "os", "arch", "compiler", "build_type" - # not needed but supress warning message from conan commands def layout(self): pass @@ -24,16 +22,19 @@ def package_id(self): del self.info.settings.build_type def validate(self): - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("Only Windows supported") + if self.info.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} only supports Windows") def source(self): + pass + + def build(self): get(self, **self.conan_data["sources"][self.version]) - download(self, f'https://code.qt.io/cgit/qt-labs/jom.git/plain/LICENSE.GPL?h=v{self.version}', filename='LICENSE.GPL') + download(self, f"https://code.qt.io/cgit/qt-labs/jom.git/plain/LICENSE.GPL?h=v{self.version}", filename="LICENSE.GPL") def package(self): - self.copy("LICENSE.GPL", dst= 'licenses', src='') - self.copy("*.exe", dst="bin", src="") + copy(self, "LICENSE.GPL", self.build_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.exe", self.build_folder, os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.frameworkdirs = [] @@ -41,10 +42,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/recipes/jom/all/test_package/conanfile.py b/recipes/jom/all/test_package/conanfile.py index f7976d712ed838..7762b725dc75e7 100644 --- a/recipes/jom/all/test_package/conanfile.py +++ b/recipes/jom/all/test_package/conanfile.py @@ -1,8 +1,18 @@ -from conans import ConanFile +from conan import ConanFile +from conan.tools.build import can_run class TestPackageConan(ConanFile): - settings = "os" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" - def test(self): - self.run("jom /VERSION") + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def build(self): + pass + + def test(self): + if can_run(self): + self.run("jom /VERSION") diff --git a/recipes/jom/all/test_v1_package/conanfile.py b/recipes/jom/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..524a49a2860477 --- /dev/null +++ b/recipes/jom/all/test_v1_package/conanfile.py @@ -0,0 +1,13 @@ +from conans import ConanFile +from conan.tools.build import can_run + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def build(self): + pass + + def test(self): + if can_run(self): + self.run("jom /VERSION", run_environment=True) diff --git a/recipes/json_dto/all/conanfile.py b/recipes/json_dto/all/conanfile.py index ee89f2d2edf517..8e39c9590814b2 100644 --- a/recipes/json_dto/all/conanfile.py +++ b/recipes/json_dto/all/conanfile.py @@ -1,11 +1,16 @@ -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.files import get, copy +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.52.0" -class JsondtoConan(ConanFile): + +class PackageConan(ConanFile): name = "json_dto" license = "BSD-3-Clause" homepage = "https://github.com/Stiffstream/json_dto" @@ -16,51 +21,53 @@ class JsondtoConan(ConanFile): no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - def requirements(self): - self.requires("rapidjson/1.1.0") + def _min_cppstd(self): + return 14 - def validate(self): - minimal_cpp_standard = "14" - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + @property + def _compilers_minimum_version(self): + return { "gcc": "5", "clang": "4", "apple-clang": "8", - "Visual Studio": "15" + "Visual Studio": "14", + "msvc": "190", } - compiler = str(self.settings.compiler) - if compiler not in 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)) - elif tools.Version(self.settings.compiler.version) < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - if self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) >= "11": - raise ConanInvalidConfiguration(f"{self.name} requires apple-clang less then version 11") + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("rapidjson/1.1.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"): + 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.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 package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = CMake(self) - cmake.definitions["JSON_DTO_INSTALL"] = True - cmake.definitions["JSON_DTO_FIND_DEPS"] = False - cmake.configure(source_folder=os.path.join(self._source_subfolder, "dev", "json_dto")) - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="pub.hpp", + dst=os.path.join(self.package_folder, "include", "json_dto"), + src=os.path.join(self.source_folder, "dev", "json_dto"), + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "json-dto") self.cpp_info.set_property("cmake_target_name", "json-dto::json-dto") self.cpp_info.names["cmake_find_package"] = "json-dto" diff --git a/recipes/jsoncpp/all/conanfile.py b/recipes/jsoncpp/all/conanfile.py index 99b1d8ec06857e..1354ccb9d19437 100644 --- a/recipes/jsoncpp/all/conanfile.py +++ b/recipes/jsoncpp/all/conanfile.py @@ -2,6 +2,7 @@ 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, save from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc import os import textwrap @@ -41,8 +42,7 @@ 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -70,7 +70,7 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - if self.settings.compiler == "Visual Studio" and self.settings.compiler.version == "11": + if is_msvc(self) and str(self.settings.compiler.version) in ("11", "170"): replace_in_file(self, os.path.join(self.source_folder, "include", "json", "value.h"), "explicit operator bool()", "operator bool()") @@ -123,6 +123,8 @@ def package_info(self): self.cpp_info.libs = ["jsoncpp"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("JSON_DLL") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/lcms/all/conandata.yml b/recipes/lcms/all/conandata.yml index 55991f5faffdb9..c5a742dcdcb990 100644 --- a/recipes/lcms/all/conandata.yml +++ b/recipes/lcms/all/conandata.yml @@ -5,15 +5,12 @@ sources: "2.13.1": url: "https://github.com/mm2/Little-CMS/archive/refs/tags/lcms2.13.1.tar.gz" sha256: "6f84c942ecde1b4852b5a051894502ac8c98d010acb3400dec958c6db1bc94ef" - "2.12": - url: "https://github.com/mm2/Little-CMS/archive/2.12.tar.gz" - sha256: "e501f1482fc424550ef3abbf86bf1c66090e1661249e89552d39ed5bf935df66" - "2.11": - url: "https://github.com/mm2/Little-CMS/archive/2.11.tar.gz" - sha256: "478c9c3938d7a91b1171de4616f8b04308a8676d73eadc19505b7ace41327f28" - "2.10": - url: "https://github.com/mm2/Little-CMS/archive/lcms2.10.tar.gz" - sha256: "f7529f90f0a9c7529c561a2c681043c10f2d30b78e6728fb44132828f89b666a" - "2.9": - url: "https://github.com/mm2/Little-CMS/archive/lcms2.9.tar.gz" - sha256: "8e23a09dc81af856db37941a4ea26acdf6a45b0281ec5b7ee94b5a4e9f7afbf7" +patches: + "2.14": + - patch_file: "patches/2.13.1-0001-fix-msvc-import-lib.patch" + patch_description: "Fix msvc import lib" + patch_type: "portability" + "2.13.1": + - patch_file: "patches/2.13.1-0001-fix-msvc-import-lib.patch" + patch_description: "Fix msvc import lib" + patch_type: "portability" diff --git a/recipes/lcms/all/conanfile.py b/recipes/lcms/all/conanfile.py index e73dd6770d2e09..a0de3a3a66bf78 100644 --- a/recipes/lcms/all/conanfile.py +++ b/recipes/lcms/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild +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, replace_in_file, rm, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version import os -import re -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class LcmsConan(ConanFile): @@ -12,7 +16,7 @@ class LcmsConan(ConanFile): description = "A free, open source, CMM engine." license = "MIT" homepage = "https://github.com/mm2/Little-CMS" - topics = ("lcms", "cmm", "icc", "cmm-engine") + topics = ("littlecms", "little-cms", "cmm", "icc", "cmm-engine", "color-management-engine") settings = "os", "arch", "compiler", "build_type" options = { @@ -24,23 +28,8 @@ class LcmsConan(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): - 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): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,118 +37,70 @@ 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") 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") + self.tool_requires("meson/1.0.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], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + tc.generate() def _patch_sources(self): - compiler_version = tools.Version(self.settings.compiler.version) - if (self.settings.compiler == "Visual Studio" and compiler_version >= "14") or \ - str(self.settings.compiler) == "msvc": + apply_conandata_patches(self) + compiler_version = Version(self.settings.compiler.version) + if (str(self.settings.compiler) == "Visual Studio" and compiler_version >= "14") or \ + (str(self.settings.compiler) == "msvc" and compiler_version >= "190"): # since VS2015 vsnprintf is built-in - path = os.path.join(self._source_subfolder, "src", "lcms2_internal.h") - tools.replace_in_file(path, "# define vsnprintf _vsnprintf", "") - if (self.settings.compiler == "Visual Studio" and compiler_version >= "16") or \ - (str(self.settings.compiler) == "msvc" and compiler_version >= "192"): - # since VS2019, don't need to specify the WindowsTargetPlatformVersion - path = os.path.join(self._source_subfolder, "Projects", "VC2015", "lcms2_static", "lcms2_static.vcxproj") - tools.replace_in_file(path, "8.1", "") - if self.settings.os == "Android" and self._settings_build.os == "Windows": - # remove escape for quotation marks, to make ndk on windows happy - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "s/[ `~#$^&*(){}\\\\|;'\\\''\"<>?]/\\\\&/g", - "s/[ `~#$^&*(){}\\\\|;<>?]/\\\\&/g") - - def _build_visual_studio(self): - if tools.Version(self.version) <= "2.11": - vc_sln_subdir = "VC2013" - else: - vc_sln_subdir = "VC2015" - with tools.chdir(os.path.join(self._source_subfolder, "Projects", vc_sln_subdir )): - target = "lcms2_DLL" if self.options.shared else "lcms2_static" - if self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) <= "12": - upgrade_project = False - else: - upgrade_project = True - # Enable LTO when CFLAGS contains -GL - if any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))): - lto = "true" - else: - lto = "false" - properties = { - "WholeProgramOptimization": lto, - } - # run build - msbuild = MSBuild(self) - msbuild.build("lcms2.sln", targets=[target], platforms={"x86": "Win32"}, - upgrade_project=upgrade_project, properties=properties) - - 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" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--without-tiff", - "--without-jpeg", - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + path = os.path.join(self.source_folder, "src", "lcms2_internal.h") + replace_in_file(self, path, "# define vsnprintf _vsnprintf", "") def build(self): self._patch_sources() - if self._is_msvc: - self._build_visual_studio() - 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")) - autotools = self._configure_autotools() - autotools.make() + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy(pattern="*.h", src=os.path.join(self._source_subfolder, "include"), dst="include", keep_path=True) - if self.options.shared: - self.copy(pattern="*.lib", src=os.path.join(self._source_subfolder, "bin"), dst="lib", keep_path=False) - self.copy(pattern="*.dll", src=os.path.join(self._source_subfolder, "bin"), dst="bin", keep_path=False) - else: - self.copy(pattern="*.lib", src=os.path.join(self._source_subfolder, "Lib", "MS"), dst="lib", - keep_path=False) - else: - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - # remove utilities - if self.settings.os == "Windows" and self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*[!.dll]") - else: - tools.rmdir(os.path.join(self.package_folder, "bin")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "lcms2") - suffix = "_static" if self._is_msvc and not self.options.shared else "" - self.cpp_info.libs = ["lcms2{}".format(suffix)] - if self._is_msvc and self.options.shared: + self.cpp_info.libs = ["lcms2"] + if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("CMS_DLL") if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs.append("m") - - self.cpp_info.names["pkg_config"] = "lcms2" + self.cpp_info.system_libs.extend(["m", "pthread"]) + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib""" + from conan.tools.files import rename + from conan.tools.microsoft import is_msvc + 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/lcms/all/patches/2.13.1-0001-fix-msvc-import-lib.patch b/recipes/lcms/all/patches/2.13.1-0001-fix-msvc-import-lib.patch new file mode 100644 index 00000000000000..6200fe4cf44ee4 --- /dev/null +++ b/recipes/lcms/all/patches/2.13.1-0001-fix-msvc-import-lib.patch @@ -0,0 +1,10 @@ +--- a/meson.build ++++ b/meson.build +@@ -73,7 +73,6 @@ liblcms2_lib = library('lcms2', lcms2_srcs, + dependencies: deps, + c_args: cargs, + version: library_version, +- vs_module_defs: 'src/lcms2.def', + install: true, + ) + diff --git a/recipes/lcms/all/test_package/CMakeLists.txt b/recipes/lcms/all/test_package/CMakeLists.txt index 7b9b613cbb24a3..c0d476f3440242 100644 --- a/recipes/lcms/all/test_package/CMakeLists.txt +++ b/recipes/lcms/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(lcms REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE lcms::lcms) diff --git a/recipes/lcms/all/test_package/conanfile.py b/recipes/lcms/all/test_package/conanfile.py index d4128b04507778..98ab55852ad565 100644 --- a/recipes/lcms/all/test_package/conanfile.py +++ b/recipes/lcms/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 = "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,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/lcms/all/test_v1_package/CMakeLists.txt b/recipes/lcms/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/lcms/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/lcms/all/test_v1_package/conanfile.py b/recipes/lcms/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/lcms/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/lcms/config.yml b/recipes/lcms/config.yml index 82126a56f46e64..8a6c0dd7e6e99d 100644 --- a/recipes/lcms/config.yml +++ b/recipes/lcms/config.yml @@ -3,11 +3,3 @@ versions: folder: all "2.13.1": folder: all - "2.12": - folder: all - "2.11": - folder: all - "2.10": - folder: all - "2.9": - folder: all diff --git a/recipes/libalsa/all/test_package/test_package.c b/recipes/libalsa/all/test_package/test_package.c index 532921eec833ce..5fe270f6f4fcc2 100644 --- a/recipes/libalsa/all/test_package/test_package.c +++ b/recipes/libalsa/all/test_package/test_package.c @@ -1,895 +1,8 @@ - -/* - * This small demo sends a simple sinusoidal wave to your speakers. - */ #include -#include -#include -#include -#include -#include -#include "alsa/asoundlib.h" -#include -#include - - -static time_t get_current_time() -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - - return tv.tv_sec; -} - -static time_t start_time; - -static int is_playing() -{ - return (get_current_time() - start_time) < 5; -} - -static char *device = "plughw:0,0"; /* playback device */ -static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ -static unsigned int rate = 44100; /* stream rate */ -static unsigned int channels = 1; /* count of channels */ -static unsigned int buffer_time = 500000; /* ring buffer length in us */ -static unsigned int period_time = 100000; /* period time in us */ -static double freq = 440; /* sinusoidal wave frequency in Hz */ -static int verbose = 0; /* verbose flag */ -static int resample = 1; /* enable alsa-lib resampling */ -static int period_event = 0; /* produce poll event after each period */ -static snd_pcm_sframes_t buffer_size; -static snd_pcm_sframes_t period_size; -static snd_output_t *output = NULL; -static void generate_sine(const snd_pcm_channel_area_t *areas, - snd_pcm_uframes_t offset, - int count, double *_phase) -{ - static double max_phase = 2. * M_PI; - double phase = *_phase; - double step = max_phase*freq/(double)rate; - unsigned char *samples[channels]; - int steps[channels]; - unsigned int chn; - int format_bits = snd_pcm_format_width(format); - unsigned int maxval = (1 << (format_bits - 1)) - 1; - int bps = format_bits / 8; /* bytes per sample */ - int phys_bps = snd_pcm_format_physical_width(format) / 8; - int big_endian = snd_pcm_format_big_endian(format) == 1; - int to_unsigned = snd_pcm_format_unsigned(format) == 1; - int is_float = (format == SND_PCM_FORMAT_FLOAT_LE || - format == SND_PCM_FORMAT_FLOAT_BE); - /* verify and prepare the contents of areas */ - for (chn = 0; chn < channels; chn++) { - if ((areas[chn].first % 8) != 0) { - printf("areas[%i].first == %i, aborting...\n", chn, areas[chn].first); - exit(EXIT_FAILURE); - } - samples[chn] = /*(signed short *)*/(((unsigned char *)areas[chn].addr) + (areas[chn].first / 8)); - if ((areas[chn].step % 16) != 0) { - printf("areas[%i].step == %i, aborting...\n", chn, areas[chn].step); - exit(EXIT_FAILURE); - } - steps[chn] = areas[chn].step / 8; - samples[chn] += offset * steps[chn]; - } - /* fill the channel areas */ - while (count-- > 0) { - union { - float f; - int i; - } fval; - int res, i; - if (is_float) { - fval.f = sin(phase); - res = fval.i; - } else - res = sin(phase) * maxval; - if (to_unsigned) - res ^= 1U << (format_bits - 1); - for (chn = 0; chn < channels; chn++) { - /* Generate data in native endian format */ - if (big_endian) { - for (i = 0; i < bps; i++) - *(samples[chn] + phys_bps - 1 - i) = (res >> i * 8) & 0xff; - } else { - for (i = 0; i < bps; i++) - *(samples[chn] + i) = (res >> i * 8) & 0xff; - } - samples[chn] += steps[chn]; - } - phase += step; - if (phase >= max_phase) - phase -= max_phase; - } - *_phase = phase; -} -static int set_hwparams(snd_pcm_t *handle, - snd_pcm_hw_params_t *params, - snd_pcm_access_t access) -{ - unsigned int rrate; - snd_pcm_uframes_t size; - int err, dir; - /* choose all parameters */ - err = snd_pcm_hw_params_any(handle, params); - if (err < 0) { - printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err)); - return err; - } - /* set hardware resampling */ - err = snd_pcm_hw_params_set_rate_resample(handle, params, resample); - if (err < 0) { - printf("Resampling setup failed for playback: %s\n", snd_strerror(err)); - return err; - } - /* set the interleaved read/write format */ - err = snd_pcm_hw_params_set_access(handle, params, access); - if (err < 0) { - printf("Access type not available for playback: %s\n", snd_strerror(err)); - return err; - } - /* set the sample format */ - err = snd_pcm_hw_params_set_format(handle, params, format); - if (err < 0) { - printf("Sample format not available for playback: %s\n", snd_strerror(err)); - return err; - } - /* set the count of channels */ - err = snd_pcm_hw_params_set_channels(handle, params, channels); - if (err < 0) { - printf("Channels count (%i) not available for playbacks: %s\n", channels, snd_strerror(err)); - return err; - } - /* set the stream rate */ - rrate = rate; - err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0); - if (err < 0) { - printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err)); - return err; - } - if (rrate != rate) { - printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err); - return -EINVAL; - } - /* set the buffer time */ - err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir); - if (err < 0) { - printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err)); - return err; - } - err = snd_pcm_hw_params_get_buffer_size(params, &size); - if (err < 0) { - printf("Unable to get buffer size for playback: %s\n", snd_strerror(err)); - return err; - } - buffer_size = size; - /* set the period time */ - err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); - if (err < 0) { - printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err)); - return err; - } - err = snd_pcm_hw_params_get_period_size(params, &size, &dir); - if (err < 0) { - printf("Unable to get period size for playback: %s\n", snd_strerror(err)); - return err; - } - period_size = size; - /* write the parameters to device */ - err = snd_pcm_hw_params(handle, params); - if (err < 0) { - printf("Unable to set hw params for playback: %s\n", snd_strerror(err)); - return err; - } - return 0; -} -static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams) -{ - int err; - /* get the current swparams */ - err = snd_pcm_sw_params_current(handle, swparams); - if (err < 0) { - printf("Unable to determine current swparams for playback: %s\n", snd_strerror(err)); - return err; - } - /* start the transfer when the buffer is almost full: */ - /* (buffer_size / avail_min) * avail_min */ - err = snd_pcm_sw_params_set_start_threshold(handle, swparams, (buffer_size / period_size) * period_size); - if (err < 0) { - printf("Unable to set start threshold mode for playback: %s\n", snd_strerror(err)); - return err; - } - /* allow the transfer when at least period_size samples can be processed */ - /* or disable this mechanism when period event is enabled (aka interrupt like style processing) */ - err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_event ? buffer_size : period_size); - if (err < 0) { - printf("Unable to set avail min for playback: %s\n", snd_strerror(err)); - return err; - } - /* enable period events when requested */ - if (period_event) { - err = snd_pcm_sw_params_set_period_event(handle, swparams, 1); - if (err < 0) { - printf("Unable to set period event: %s\n", snd_strerror(err)); - return err; - } - } - /* write the parameters to the playback device */ - err = snd_pcm_sw_params(handle, swparams); - if (err < 0) { - printf("Unable to set sw params for playback: %s\n", snd_strerror(err)); - return err; - } - return 0; -} -/* - * Underrun and suspend recovery - */ - -static int xrun_recovery(snd_pcm_t *handle, int err) -{ - if (verbose) - printf("stream recovery\n"); - if (err == -EPIPE) { /* under-run */ - err = snd_pcm_prepare(handle); - if (err < 0) - printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err)); - return 0; - } else if (err == -ESTRPIPE) { - while ((err = snd_pcm_resume(handle)) == -EAGAIN) - sleep(1); /* wait until the suspend flag is released */ - if (err < 0) { - err = snd_pcm_prepare(handle); - if (err < 0) - printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err)); - } - return 0; - } - return err; -} -/* - * Transfer method - write only - */ -static int write_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - double phase = 0; - signed short *ptr; - int err, cptr; - while (is_playing()) { - generate_sine(areas, 0, period_size, &phase); - ptr = samples; - cptr = period_size; - while (cptr > 0) { - err = snd_pcm_writei(handle, ptr, cptr); - if (err == -EAGAIN) - continue; - if (err < 0) { - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - break; /* skip one period */ - } - ptr += err * channels; - cptr -= err; - } - } -} - -/* - * Transfer method - write and wait for room in buffer using poll - */ -static int wait_for_poll(snd_pcm_t *handle, struct pollfd *ufds, unsigned int count) -{ - unsigned short revents; - while (is_playing()) { - poll(ufds, count, -1); - snd_pcm_poll_descriptors_revents(handle, ufds, count, &revents); - if (revents & POLLERR) - return -EIO; - if (revents & POLLOUT) - return 0; - } -} -static int write_and_poll_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - struct pollfd *ufds; - double phase = 0; - signed short *ptr; - int err, count, cptr, init; - count = snd_pcm_poll_descriptors_count (handle); - if (count <= 0) { - printf("Invalid poll descriptors count\n"); - return count; - } - ufds = malloc(sizeof(struct pollfd) * count); - if (ufds == NULL) { - printf("No enough memory\n"); - return -ENOMEM; - } - if ((err = snd_pcm_poll_descriptors(handle, ufds, count)) < 0) { - printf("Unable to obtain poll descriptors for playback: %s\n", snd_strerror(err)); - return err; - } - init = 1; - while (is_playing()) { - if (!init) { - err = wait_for_poll(handle, ufds, count); - if (err < 0) { - if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN || - snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) { - err = snd_pcm_state(handle) == SND_PCM_STATE_XRUN ? -EPIPE : -ESTRPIPE; - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - init = 1; - } else { - printf("Wait for poll failed\n"); - return err; - } - } - } - generate_sine(areas, 0, period_size, &phase); - ptr = samples; - cptr = period_size; - while (cptr > 0) { - err = snd_pcm_writei(handle, ptr, cptr); - if (err < 0) { - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - init = 1; - break; /* skip one period */ - } - if (snd_pcm_state(handle) == SND_PCM_STATE_RUNNING) - init = 0; - ptr += err * channels; - cptr -= err; - if (cptr == 0) - break; - /* it is possible, that the initial buffer cannot store */ - /* all data from the last period, so wait awhile */ - err = wait_for_poll(handle, ufds, count); - if (err < 0) { - if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN || - snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) { - err = snd_pcm_state(handle) == SND_PCM_STATE_XRUN ? -EPIPE : -ESTRPIPE; - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - init = 1; - } else { - printf("Wait for poll failed\n"); - return err; - } - } - } - } -} -/* - * Transfer method - asynchronous notification - */ -struct async_private_data { - signed short *samples; - snd_pcm_channel_area_t *areas; - double phase; -}; -static void async_callback(snd_async_handler_t *ahandler) -{ - snd_pcm_t *handle = snd_async_handler_get_pcm(ahandler); - struct async_private_data *data = snd_async_handler_get_callback_private(ahandler); - signed short *samples = data->samples; - snd_pcm_channel_area_t *areas = data->areas; - snd_pcm_sframes_t avail; - int err; - - avail = snd_pcm_avail_update(handle); - while (avail >= period_size) { - generate_sine(areas, 0, period_size, &data->phase); - err = snd_pcm_writei(handle, samples, period_size); - if (err < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if (err != period_size) { - printf("Write error: written %i expected %li\n", err, period_size); - exit(EXIT_FAILURE); - } - avail = snd_pcm_avail_update(handle); - } -} -static int async_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - struct async_private_data data; - snd_async_handler_t *ahandler; - int err, count; - data.samples = samples; - data.areas = areas; - data.phase = 0; - err = snd_async_add_pcm_handler(&ahandler, handle, async_callback, &data); - if (err < 0) { - printf("Unable to register async handler\n"); - exit(EXIT_FAILURE); - } - for (count = 0; count < 2; count++) { - generate_sine(areas, 0, period_size, &data.phase); - err = snd_pcm_writei(handle, samples, period_size); - if (err < 0) { - printf("Initial write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if (err != period_size) { - printf("Initial write error: written %i expected %li\n", err, period_size); - exit(EXIT_FAILURE); - } - } - if (snd_pcm_state(handle) == SND_PCM_STATE_PREPARED) { - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - /* because all other work is done in the signal handler, - suspend the process */ - while (is_playing()) { - sleep(1); - } -} -/* - * Transfer method - asynchronous notification + direct write - */ -static void async_direct_callback(snd_async_handler_t *ahandler) -{ - snd_pcm_t *handle = snd_async_handler_get_pcm(ahandler); - struct async_private_data *data = snd_async_handler_get_callback_private(ahandler); - const snd_pcm_channel_area_t *my_areas; - snd_pcm_uframes_t offset, frames, size; - snd_pcm_sframes_t avail, commitres; - snd_pcm_state_t state; - int first = 0, err; - - while (is_playing()) { - state = snd_pcm_state(handle); - if (state == SND_PCM_STATE_XRUN) { - err = xrun_recovery(handle, -EPIPE); - if (err < 0) { - printf("XRUN recovery failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } else if (state == SND_PCM_STATE_SUSPENDED) { - err = xrun_recovery(handle, -ESTRPIPE); - if (err < 0) { - printf("SUSPEND recovery failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - avail = snd_pcm_avail_update(handle); - if (avail < 0) { - err = xrun_recovery(handle, avail); - if (err < 0) { - printf("avail update failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - continue; - } - if (avail < period_size) { - if (first) { - first = 0; - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } else { - break; - } - continue; - } - size = period_size; - while (size > 0) { - frames = size; - err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("MMAP begin avail error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - generate_sine(my_areas, offset, frames, &data->phase); - commitres = snd_pcm_mmap_commit(handle, offset, frames); - if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { - if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - printf("MMAP commit error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - size -= frames; - } - } -} -static int async_direct_loop(snd_pcm_t *handle, - signed short *samples ATTRIBUTE_UNUSED, - snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED) -{ - struct async_private_data data; - snd_async_handler_t *ahandler; - const snd_pcm_channel_area_t *my_areas; - snd_pcm_uframes_t offset, frames, size; - snd_pcm_sframes_t commitres; - int err, count; - data.samples = NULL; /* we do not require the global sample area for direct write */ - data.areas = NULL; /* we do not require the global areas for direct write */ - data.phase = 0; - err = snd_async_add_pcm_handler(&ahandler, handle, async_direct_callback, &data); - if (err < 0) { - printf("Unable to register async handler\n"); - exit(EXIT_FAILURE); - } - for (count = 0; count < 2; count++) { - size = period_size; - while (size > 0) { - frames = size; - err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("MMAP begin avail error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - generate_sine(my_areas, offset, frames, &data.phase); - commitres = snd_pcm_mmap_commit(handle, offset, frames); - if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { - if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - printf("MMAP commit error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - size -= frames; - } - } - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - /* because all other work is done in the signal handler, - suspend the process */ - while (is_playing()) { - sleep(1); - } -} -/* - * Transfer method - direct write only - */ -static int direct_loop(snd_pcm_t *handle, - signed short *samples ATTRIBUTE_UNUSED, - snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED) -{ - double phase = 0; - const snd_pcm_channel_area_t *my_areas; - snd_pcm_uframes_t offset, frames, size; - snd_pcm_sframes_t avail, commitres; - snd_pcm_state_t state; - int err, first = 1; - while (is_playing()) { - state = snd_pcm_state(handle); - if (state == SND_PCM_STATE_XRUN) { - err = xrun_recovery(handle, -EPIPE); - if (err < 0) { - printf("XRUN recovery failed: %s\n", snd_strerror(err)); - return err; - } - first = 1; - } else if (state == SND_PCM_STATE_SUSPENDED) { - err = xrun_recovery(handle, -ESTRPIPE); - if (err < 0) { - printf("SUSPEND recovery failed: %s\n", snd_strerror(err)); - return err; - } - } - avail = snd_pcm_avail_update(handle); - if (avail < 0) { - err = xrun_recovery(handle, avail); - if (err < 0) { - printf("avail update failed: %s\n", snd_strerror(err)); - return err; - } - first = 1; - continue; - } - if (avail < period_size) { - if (first) { - first = 0; - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } else { - err = snd_pcm_wait(handle, -1); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("snd_pcm_wait error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - } - continue; - } - size = period_size; - while (size > 0) { - frames = size; - err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("MMAP begin avail error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - generate_sine(my_areas, offset, frames, &phase); - commitres = snd_pcm_mmap_commit(handle, offset, frames); - if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { - if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - printf("MMAP commit error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - size -= frames; - } - } -} - -/* - * Transfer method - direct write only using mmap_write functions - */ -static int direct_write_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - double phase = 0; - signed short *ptr; - int err, cptr; - while (is_playing()) { - generate_sine(areas, 0, period_size, &phase); - ptr = samples; - cptr = period_size; - while (cptr > 0) { - err = snd_pcm_mmap_writei(handle, ptr, cptr); - if (err == -EAGAIN) - continue; - if (err < 0) { - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - break; /* skip one period */ - } - ptr += err * channels; - cptr -= err; - } - } -} +#include -/* - * - */ -struct transfer_method { - const char *name; - snd_pcm_access_t access; - int (*transfer_loop)(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas); -}; -static struct transfer_method transfer_methods[] = { - { "write", SND_PCM_ACCESS_RW_INTERLEAVED, write_loop }, - { "write_and_poll", SND_PCM_ACCESS_RW_INTERLEAVED, write_and_poll_loop }, - { "async", SND_PCM_ACCESS_RW_INTERLEAVED, async_loop }, - { "async_direct", SND_PCM_ACCESS_MMAP_INTERLEAVED, async_direct_loop }, - { "direct_interleaved", SND_PCM_ACCESS_MMAP_INTERLEAVED, direct_loop }, - { "direct_noninterleaved", SND_PCM_ACCESS_MMAP_NONINTERLEAVED, direct_loop }, - { "direct_write", SND_PCM_ACCESS_MMAP_INTERLEAVED, direct_write_loop }, - { NULL, SND_PCM_ACCESS_RW_INTERLEAVED, NULL } -}; -static void help(void) -{ - int k; - printf( -"Usage: pcm [OPTION]... [FILE]...\n" -"-h,--help help\n" -"-D,--device playback device\n" -"-r,--rate stream rate in Hz\n" -"-c,--channels count of channels in stream\n" -"-f,--frequency sine wave frequency in Hz\n" -"-b,--buffer ring buffer size in us\n" -"-p,--period period size in us\n" -"-m,--method transfer method\n" -"-o,--format sample format\n" -"-v,--verbose show the PCM setup parameters\n" -"-n,--noresample do not resample\n" -"-e,--pevent enable poll event after each period\n" -"\n"); - printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { - const char *s = snd_pcm_format_name(k); - if (s) - printf(" %s", s); - } - printf("\n"); - printf("Recognized transfer methods are:"); - for (k = 0; transfer_methods[k].name; k++) - printf(" %s", transfer_methods[k].name); - printf("\n"); -} -int main(int argc, char *argv[]) +int main() { - struct option long_option[] = - { - {"help", 0, NULL, 'h'}, - {"device", 1, NULL, 'D'}, - {"rate", 1, NULL, 'r'}, - {"channels", 1, NULL, 'c'}, - {"frequency", 1, NULL, 'f'}, - {"buffer", 1, NULL, 'b'}, - {"period", 1, NULL, 'p'}, - {"method", 1, NULL, 'm'}, - {"format", 1, NULL, 'o'}, - {"verbose", 1, NULL, 'v'}, - {"noresample", 1, NULL, 'n'}, - {"pevent", 1, NULL, 'e'}, - {NULL, 0, NULL, 0}, - }; - snd_pcm_t *handle; - int err, morehelp; - snd_pcm_hw_params_t *hwparams; - snd_pcm_sw_params_t *swparams; - int method = 0; - signed short *samples; - unsigned int chn; - snd_pcm_channel_area_t *areas; - snd_pcm_hw_params_alloca(&hwparams); - snd_pcm_sw_params_alloca(&swparams); - morehelp = 0; - start_time = get_current_time(); - - while (1) { - int c; - if ((c = getopt_long(argc, argv, "hD:r:c:f:b:p:m:o:vne", long_option, NULL)) < 0) - break; - switch (c) { - case 'h': - morehelp++; - break; - case 'D': - device = strdup(optarg); - break; - case 'r': - rate = atoi(optarg); - rate = rate < 4000 ? 4000 : rate; - rate = rate > 196000 ? 196000 : rate; - break; - case 'c': - channels = atoi(optarg); - channels = channels < 1 ? 1 : channels; - channels = channels > 1024 ? 1024 : channels; - break; - case 'f': - freq = atoi(optarg); - freq = freq < 50 ? 50 : freq; - freq = freq > 5000 ? 5000 : freq; - break; - case 'b': - buffer_time = atoi(optarg); - buffer_time = buffer_time < 1000 ? 1000 : buffer_time; - buffer_time = buffer_time > 1000000 ? 1000000 : buffer_time; - break; - case 'p': - period_time = atoi(optarg); - period_time = period_time < 1000 ? 1000 : period_time; - period_time = period_time > 1000000 ? 1000000 : period_time; - break; - case 'm': - for (method = 0; transfer_methods[method].name; method++) - if (!strcasecmp(transfer_methods[method].name, optarg)) - break; - if (transfer_methods[method].name == NULL) - method = 0; - break; - case 'o': - for (format = 0; format < SND_PCM_FORMAT_LAST; format++) { - const char *format_name = snd_pcm_format_name(format); - if (format_name) - if (!strcasecmp(format_name, optarg)) - break; - } - if (format == SND_PCM_FORMAT_LAST) - format = SND_PCM_FORMAT_S16; - if (!snd_pcm_format_linear(format) && - !(format == SND_PCM_FORMAT_FLOAT_LE || - format == SND_PCM_FORMAT_FLOAT_BE)) { - printf("Invalid (non-linear/float) format %s\n", - optarg); - return 1; - } - break; - case 'v': - verbose = 1; - break; - case 'n': - resample = 0; - break; - case 'e': - period_event = 1; - break; - } - } - if (morehelp) { - help(); - return 0; - } - err = snd_output_stdio_attach(&output, stdout, 0); - if (err < 0) { - printf("Output failed: %s\n", snd_strerror(err)); - return 0; - } - printf("Playback device is %s\n", device); - printf("Stream parameters are %iHz, %s, %i channels\n", rate, snd_pcm_format_name(format), channels); - printf("Sine wave rate is %.4fHz\n", freq); - printf("Using transfer method: %s\n", transfer_methods[method].name); - if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { - printf("Playback open error: %s\n", snd_strerror(err)); - return 0; - } - - if ((err = set_hwparams(handle, hwparams, transfer_methods[method].access)) < 0) { - printf("Setting of hwparams failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if ((err = set_swparams(handle, swparams)) < 0) { - printf("Setting of swparams failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if (verbose > 0) - snd_pcm_dump(handle, output); - samples = malloc((period_size * channels * snd_pcm_format_physical_width(format)) / 8); - if (samples == NULL) { - printf("No enough memory\n"); - exit(EXIT_FAILURE); - } - - areas = calloc(channels, sizeof(snd_pcm_channel_area_t)); - if (areas == NULL) { - printf("No enough memory\n"); - exit(EXIT_FAILURE); - } - for (chn = 0; chn < channels; chn++) { - areas[chn].addr = samples; - areas[chn].first = chn * snd_pcm_format_physical_width(format); - areas[chn].step = channels * snd_pcm_format_physical_width(format); - } - err = transfer_methods[method].transfer_loop(handle, samples, areas); - if (err < 0) - printf("Transfer failed: %s\n", snd_strerror(err)); - free(areas); - free(samples); - snd_pcm_close(handle); - return 0; + printf("libalsa version %s\n", snd_asoundlib_version()); + return 0; } diff --git a/recipes/libarchive/all/conandata.yml b/recipes/libarchive/all/conandata.yml index dd56f7af959bf8..9a164839a427bb 100644 --- a/recipes/libarchive/all/conandata.yml +++ b/recipes/libarchive/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.6.2": + url: "https://github.com/libarchive/libarchive/releases/download/v3.6.2/libarchive-3.6.2.tar.xz" + sha256: "9e2c1b80d5fbe59b61308fdfab6c79b5021d7ff4ff2489fb12daf0a96a83551d" "3.6.1": url: "https://github.com/libarchive/libarchive/releases/download/v3.6.1/libarchive-3.6.1.tar.xz" sha256: "5a411aceb978f43e626f0c2d1812ddd8807b645ed892453acabd532376c148e6" @@ -18,6 +21,16 @@ sources: url: "https://github.com/libarchive/libarchive/releases/download/v3.4.0/libarchive-3.4.0.tar.gz" sha256: "8643d50ed40c759f5412a3af4e353cffbce4fdf3b5cf321cb72cacf06b2d825e" patches: + "3.6.2": + - patch_file: "patches/0001-3.6.2-zlib-winapi.patch" + patch_description: "Remove broken ZLIB WINAPI check" + patch_type: "portability" + - patch_file: "patches/0003-3.6.2-cmake.patch" + patch_description: "Make CMake build-system compatible with Conan" + patch_type: "conan" + - patch_file: "patches/0005-3.6.2-try-compile-cmakedeps.patch" + patch_description: "Patch try_compile check to work with imported CMake targets from Conan packages" + patch_type: "conan" "3.6.1": - patch_file: "patches/0001-3.6.0-zlib-winapi.patch" patch_description: "Remove broken ZLIB WINAPI check" diff --git a/recipes/libarchive/all/conanfile.py b/recipes/libarchive/all/conanfile.py index c388b063a3a02b..b5ea492609f904 100644 --- a/recipes/libarchive/all/conanfile.py +++ b/recipes/libarchive/all/conanfile.py @@ -91,7 +91,7 @@ def requirements(self): if self.options.with_nettle: self.requires("nettle/3.8.1") if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/3.0.7") if self.options.with_libb2: self.requires("libb2/20190723") if self.options.with_lz4: @@ -99,7 +99,7 @@ def requirements(self): if self.options.with_lzo: self.requires("lzo/2.10") if self.options.with_lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.0") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.get_safe("with_mbedtls"): diff --git a/recipes/libarchive/all/patches/0001-3.6.2-zlib-winapi.patch b/recipes/libarchive/all/patches/0001-3.6.2-zlib-winapi.patch new file mode 100644 index 00000000000000..62dd3ef8198757 --- /dev/null +++ b/recipes/libarchive/all/patches/0001-3.6.2-zlib-winapi.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 713e3bc..2315da5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -430,14 +430,7 @@ IF(ZLIB_FOUND) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) +- # +- # Test if ZLIB_WINAPI macro is needed to use. +- # +- TRY_MACRO_FOR_LIBRARY( +- "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" +- RUNS +- "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" +- ZLIB_WINAPI) ++ set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) diff --git a/recipes/libarchive/all/patches/0003-3.6.2-cmake.patch b/recipes/libarchive/all/patches/0003-3.6.2-cmake.patch new file mode 100644 index 00000000000000..80d49396aac872 --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.6.2-cmake.patch @@ -0,0 +1,103 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2315da5..1d8de96 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,7 +9,7 @@ endif() + # + PROJECT(libarchive C) + # +-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") + if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) + endif() +@@ -428,7 +428,7 @@ IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +- LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) ++ LIST(APPEND ADDITIONAL_LIBS ZLIB::ZLIB) + IF(WIN32 AND NOT CYGWIN) + set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) +@@ -490,7 +490,7 @@ IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) + CMAKE_PUSH_CHECK_STATE() +- SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) ++ SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIRS}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) + INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) + LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) +@@ -507,7 +507,7 @@ IF(LIBLZMA_FOUND) + ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -577,7 +577,7 @@ IF(ENABLE_LZ4) + ENDIF (LZ4_INCLUDE_DIR) + + FIND_PATH(LZ4_INCLUDE_DIR lz4.h) +- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) ++ FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4 lz4_static liblz4_static) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) + ELSE(ENABLE_LZ4) +@@ -799,7 +799,7 @@ ENDIF(ENABLE_NETTLE) + # Find OpenSSL + # (Except on Mac, where OpenSSL is deprecated.) + # +-IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") ++IF(ENABLE_OPENSSL) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index ff7ade0..1438819 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -243,11 +243,14 @@ ELSEIF(ARCHIVE_ACL_SUNOS) + ENDIF() + + # Libarchive is a shared library ++if (BUILD_SHARED_LIBS) + ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .) + TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) + ++else() ++ + # archive_static is a static library + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -257,13 +260,21 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN) ++endif() + + IF(ENABLE_INSTALL) + # How to install the libraries +- INSTALL(TARGETS archive archive_static +- RUNTIME DESTINATION bin +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib) ++ if (BUILD_SHARED_LIBS) ++ INSTALL(TARGETS archive ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ else() ++ INSTALL(TARGETS archive_static ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ endif() + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) + ENDIF() diff --git a/recipes/libarchive/all/patches/0005-3.6.2-try-compile-cmakedeps.patch b/recipes/libarchive/all/patches/0005-3.6.2-try-compile-cmakedeps.patch new file mode 100644 index 00000000000000..4bca48088c19b8 --- /dev/null +++ b/recipes/libarchive/all/patches/0005-3.6.2-try-compile-cmakedeps.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1d8de96f..d54975b7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -829,6 +829,8 @@ ENDIF(NOT OPENSSL_FOUND) + # + MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + FOREACH(ALGORITHM ${ALGORITHMS}) ++ include(CMakePushCheckState) ++ cmake_push_check_state() + IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) + STRING(TOLOWER "${ALGORITHM}" lower_algorithm) + STRING(TOUPPER "${ALGORITHM}" algorithm) +@@ -849,8 +851,7 @@ MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${OPENSSL_INCLUDE_DIR}") +- SET(TRY_CRYPTO_REQUIRED_LIBS +- "-DLINK_LIBRARIES:STRING=${OPENSSL_LIBRARIES}") ++ set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) + ELSEIF("${IMPLEMENTATION}" MATCHES "^MBEDTLS$" AND MBEDTLS_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${MBEDTLS_INCLUDE_DIRS}") +@@ -927,6 +928,7 @@ main(int argc, char **argv) + ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) ++ cmake_pop_check_state() + ENDFOREACH(ALGORITHM ${ALGORITHMS}) + ENDMACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + diff --git a/recipes/libarchive/config.yml b/recipes/libarchive/config.yml index 5e7bb50cad34c1..2cfb62acf52281 100644 --- a/recipes/libarchive/config.yml +++ b/recipes/libarchive/config.yml @@ -1,4 +1,6 @@ versions: + "3.6.2": + folder: all "3.6.1": folder: all "3.6.0": diff --git a/recipes/libavif/all/conanfile.py b/recipes/libavif/all/conanfile.py index 9c967ac3bf425c..dc46d0267dd992 100644 --- a/recipes/libavif/all/conanfile.py +++ b/recipes/libavif/all/conanfile.py @@ -13,7 +13,7 @@ class LibAVIFConan(ConanFile): license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/AOMediaCodec/libavif" - topics = "avif" + topics = ("avif") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -48,7 +48,7 @@ def _has_dav1d(self): def requirements(self): self.requires("libaom-av1/3.5.0") - self.requires("libyuv/1845") + self.requires("libyuv/1854") if self._has_dav1d: self.requires("dav1d/1.0.0") diff --git a/recipes/libavrocpp/all/CMakeLists.txt b/recipes/libavrocpp/all/CMakeLists.txt deleted file mode 100644 index 596a2f6f95b12a..00000000000000 --- a/recipes/libavrocpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder/lang/c++) diff --git a/recipes/libavrocpp/all/conandata.yml b/recipes/libavrocpp/all/conandata.yml index 5f1e3ccbae4994..4db9766f42d9f1 100644 --- a/recipes/libavrocpp/all/conandata.yml +++ b/recipes/libavrocpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.11.1": + url: "https://github.com/apache/avro/archive/release-1.11.1.tar.gz" + sha256: "599f96bb405f72a35154b2477caa6254d723bb4e3f6a0e54e9ae540664321752" "1.11.0": url: "https://github.com/apache/avro/archive/release-1.11.0.tar.gz" sha256: "c205140e7936d552286ba7131122a34e522d66f601ee912f272109d801f89773" @@ -9,30 +12,59 @@ sources: url: "https://github.com/apache/avro/archive/release-1.10.1.tar.gz" sha256: "8fd1f850ce37e60835e6d8335c0027a959aaa316773da8a9660f7d33a66ac142" patches: + "1.11.1": + - patch_file: "patches/0001-add-iterator-include-1-11-0.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-11-1.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage-1-11-0.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-11-1.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" + - patch_file: "patches/0005-fix-breaking-include-1-11-1.patch" + patch_description: "move impl/json/jsonDom.h to api/json" + patch_type: "backport" + patch_source: "https://issues.apache.org/jira/browse/AVRO-3601" "1.11.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-add-iterator-include-1-11-0.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-tests-1-11-0.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-allow-static-boost-linkage-1-11-0.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-fix-windows-shared-installation-1-11-0.patch" + - patch_file: "patches/0001-add-iterator-include-1-11-0.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-11-0.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage-1-11-0.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-11-0.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" "1.10.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-add-iterator-include.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-tests-1-10-2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-allow-static-boost-linkage.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-fix-windows-shared-installation-1-10-2.patch" + - patch_file: "patches/0001-add-iterator-include.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-10-2.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-10-2.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" "1.10.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-add-iterator-include.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-tests-1-10-1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-allow-static-boost-linkage.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-fix-windows-shared-installation-1-10-1.patch" + - patch_file: "patches/0001-add-iterator-include.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-10-1.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-10-1.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" diff --git a/recipes/libavrocpp/all/conanfile.py b/recipes/libavrocpp/all/conanfile.py index 9056fdb84fb51b..a27c9be2bf7317 100644 --- a/recipes/libavrocpp/all/conanfile.py +++ b/recipes/libavrocpp/all/conanfile.py @@ -1,18 +1,18 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -import functools -from conans import ConanFile, CMake, tools - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibavrocppConan(ConanFile): name = "libavrocpp" + description = "Avro is a data serialization system." license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" - description = "Avro is a data serialization system." homepage = "https://avro.apache.org/" - topics = ("serialization", "deserialization") - generators = "cmake", "cmake_find_package" + topics = ("serialization", "deserialization","avro") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,17 +25,11 @@ class LibavrocppConan(ConanFile): short_paths = True @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + 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": @@ -43,49 +37,53 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - 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("boost/1.78.0") + self.requires("boost/1.81.0") self.requires("snappy/1.1.9") + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + 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 generate(self): + tc = CMakeToolchain(self) + tc.variables["SNAPPY_ROOT_DIR"] = self.deps_cpp_info["snappy"].rootpath.replace("\\", "/") + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + 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) - tools.replace_in_file( - os.path.join(os.path.join(self._source_subfolder, "lang", "c++"), "CMakeLists.txt"), + apply_conandata_patches(self) + replace_in_file(self, + os.path.join(self.source_folder, "lang", "c++", "CMakeLists.txt"), "${SNAPPY_LIBRARIES}", "${Snappy_LIBRARIES}" ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SNAPPY_ROOT_DIR"] = self.deps_cpp_info["snappy"].rootpath.replace("\\", "/") - cmake.configure() - return 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, "lang", "c++")) cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - self.copy("NOTICE*", 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) + copy(self, pattern="NOTICE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() if self.settings.os == "Windows": for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: - tools.remove_files_by_mask(self.package_folder, dll_pattern_to_remove) + rm(self, dll_pattern_to_remove, os.path.join(self.package_folder, "bin")) def package_info(self): # FIXME: avro does not install under a CMake namespace https://github.com/apache/avro/blob/351f589913b9691322966fb77fe72269a0a2ec82/lang/c%2B%2B/CMakeLists.txt#L193 @@ -94,3 +92,6 @@ def package_info(self): self.cpp_info.components[target].requires = ["boost::boost", "snappy::snappy"] if self.options.shared: self.cpp_info.components[target].defines.append("AVRO_DYN_LINK") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + diff --git a/recipes/libavrocpp/all/patches/0002-disable-tests-1-11-1.patch b/recipes/libavrocpp/all/patches/0002-disable-tests-1-11-1.patch new file mode 100644 index 00000000000000..a1505a597e4da1 --- /dev/null +++ b/recipes/libavrocpp/all/patches/0002-disable-tests-1-11-1.patch @@ -0,0 +1,30 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index 6098613..c27fab7 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -171,10 +171,6 @@ target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIE + enable_testing() + + macro (unittest name) +- add_executable (${name} test/${name}.cc) +- target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES}) +- add_test (NAME ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name}) + endmacro (unittest) + + unittest (buffertest) +@@ -190,14 +186,6 @@ unittest (AvrogencppTests) + unittest (CompilerTests) + unittest (AvrogencppTestReservedWords) + +-add_dependencies (AvrogencppTestReservedWords cpp_reserved_words_hh) +- +-add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_hh +- tweet_hh +- union_array_union_hh union_map_union_hh union_conflict_hh +- recursive_hh reuse_hh circulardep_hh tree1_hh tree2_hh crossref_hh +- primitivetypes_hh empty_record_hh) +- + include (InstallRequiredSystemLibraries) + + set (CPACK_PACKAGE_FILE_NAME "avrocpp-${AVRO_VERSION_MAJOR}") diff --git a/recipes/libavrocpp/all/patches/0004-fix-windows-shared-installation-1-11-1.patch b/recipes/libavrocpp/all/patches/0004-fix-windows-shared-installation-1-11-1.patch new file mode 100644 index 00000000000000..842c3ca3ec866d --- /dev/null +++ b/recipes/libavrocpp/all/patches/0004-fix-windows-shared-installation-1-11-1.patch @@ -0,0 +1,13 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index 5ceb045..e19b5a9 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -190,7 +190,7 @@ include (CPack) + install (TARGETS avrocpp avrocpp_s + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +- RUNTIME DESTINATION lib) ++ RUNTIME DESTINATION bin) + + install (TARGETS avrogencpp RUNTIME DESTINATION bin) + diff --git a/recipes/libavrocpp/all/patches/0005-fix-breaking-include-1-11-1.patch b/recipes/libavrocpp/all/patches/0005-fix-breaking-include-1-11-1.patch new file mode 100644 index 00000000000000..778bdf6bbbdab7 --- /dev/null +++ b/recipes/libavrocpp/all/patches/0005-fix-breaking-include-1-11-1.patch @@ -0,0 +1,473 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index e19b5a9..0249c37 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -106,7 +106,7 @@ set (AVRO_SOURCE_FILES + impl/json/JsonIO.cc + impl/json/JsonDom.cc + impl/Resolver.cc impl/Validator.cc +- impl/CustomFields.cc ++ impl/CustomAttributes.cc + ) + + add_library (avrocpp SHARED ${AVRO_SOURCE_FILES}) +diff --git b/lang/c++/api/CustomAttributes.hh b/lang/c++/api/CustomAttributes.hh +new file mode 100644 +index 0000000..2bd572c +--- /dev/null ++++ b/lang/c++/api/CustomAttributes.hh +@@ -0,0 +1,55 @@ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one ++ * or more contributor license agreements. See the NOTICE file ++ * distributed with this work for additional information ++ * regarding copyright ownership. The ASF licenses this file ++ * to you under the Apache License, Version 2.0 (the ++ * "License"); you may not use this file except in compliance ++ * with the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef avro_CustomAttributes_hh__ ++#define avro_CustomAttributes_hh__ ++ ++#include ++#include ++#include ++#include "Config.hh" ++ ++namespace avro { ++ ++// CustomAttributes class stores avro custom attributes. ++// Each attribute is represented by a unique name and value. ++// User is supposed to create CustomAttributes object and then add it to Schema. ++class AVRO_DECL CustomAttributes { ++ public: ++ // Retrieves the custom attribute json entity for that attributeName, returns an ++ // null if the attribute doesn't exist. ++ std::string getAttribute(const std::string &name) const; ++ ++ // Adds a custom attribute. If the attribute already exists, throw an exception. ++ void addAttribute(const std::string &name, const std::string &value); ++ ++ // Provides a way to iterate over the custom attributes or check attribute size. ++ const std::map &attributes() const { ++ return attributes_; ++ } ++ ++ // Prints the attribute value for the specific attribute. ++ void printJson(std::ostream& os, const std::string &name) const; ++ ++ private: ++ std::map attributes_; ++}; ++ ++} // namespace avro ++ ++#endif +diff --git a/lang/c++/api/CustomFields.hh a/lang/c++/api/CustomFields.hh +deleted file mode 100644 +index 01468ff..0000000 +--- a/lang/c++/api/CustomFields.hh ++++ /dev/null +@@ -1,55 +0,0 @@ +-/* +- * Licensed to the Apache Software Foundation (ASF) under one +- * or more contributor license agreements. See the NOTICE file +- * distributed with this work for additional information +- * regarding copyright ownership. The ASF licenses this file +- * to you under the Apache License, Version 2.0 (the +- * "License"); you may not use this file except in compliance +- * with the License. You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, software +- * distributed under the License is distributed on an "AS IS" BASIS, +- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- * See the License for the specific language governing permissions and +- * limitations under the License. +- */ +- +-#ifndef avro_CustomFields_hh__ +-#define avro_CustomFields_hh__ +- +-#include +- +-#include "../impl/json/JsonDom.hh" +- +-namespace avro { +- +-// CustomFields class stores avro custom attributes. +-// Each field is represented by a unique name and value. +-// User is supposed to create CustomFields object and then add it to Schema. +-class AVRO_DECL CustomFields { +- public: +- // Retrieves the custom field json entity for that fieldName, returns an +- // null Entity if the field doesn't exist. +- json::Entity getField(const std::string &fieldName) const; +- +- // Adds a custom field. If the field already exists, throw an exception. +- void addField(const std::string &fieldName, const json::Entity &fieldValue); +- void addField(const std::string &fieldName, const std::string &fieldValue); +- +- // Provides a way to iterate over the custom fields or check field size. +- const std::map &fields() const { +- return fields_; +- } +- +- // Prints the json string for the specific field. +- void printJson(std::ostream& os, const std::string &fieldName) const; +- +- private: +- std::map fields_; +-}; +- +-} // namespace avro +- +-#endif +diff --git a/lang/c++/api/Node.hh b/lang/c++/api/Node.hh +index c9af126..3f5fe5b 100644 +--- a/lang/c++/api/Node.hh ++++ b/lang/c++/api/Node.hh +@@ -26,7 +26,7 @@ + #include + #include + +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + #include "Exception.hh" + #include "LogicalType.hh" + #include "SchemaResolution.hh" +@@ -154,7 +154,7 @@ public: + } + virtual size_t fixedSize() const = 0; + +- void addCustomAttributesForField(const CustomFields& customAttributes) { ++ void addCustomAttributesForField(const CustomAttributes& customAttributes) { + checkLock(); + doAddCustomAttribute(customAttributes); + } +@@ -191,7 +191,7 @@ protected: + virtual void doAddLeaf(const NodePtr &newLeaf) = 0; + virtual void doAddName(const std::string &name) = 0; + virtual void doSetFixedSize(size_t size) = 0; +- virtual void doAddCustomAttribute(const CustomFields& customFields) = 0; ++ virtual void doAddCustomAttribute(const CustomAttributes& customAttributes) = 0; + + private: + const Type type_; +diff --git a/lang/c++/api/NodeImpl.hh b/lang/c++/api/NodeImpl.hh +index 62e62eb..bf0e352 100644 +--- a/lang/c++/api/NodeImpl.hh ++++ b/lang/c++/api/NodeImpl.hh +@@ -32,7 +32,7 @@ + + #include "Node.hh" + #include "NodeConcepts.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + + namespace avro { + +@@ -160,8 +160,8 @@ protected: + + void setLeafToSymbolic(size_t index, const NodePtr &node) override; + +- void doAddCustomAttribute(const CustomFields &customfields) override { +- customAttributes_.add(customfields); ++ void doAddCustomAttribute(const CustomAttributes &customAttributes) override { ++ customAttributes_.add(customAttributes); + } + + SchemaResolution furtherResolution(const Node &reader) const { +@@ -223,8 +223,8 @@ using MultiLeaves = concepts::MultiAttribute; + + using NoLeafNames = concepts::NoAttribute; + using LeafNames = concepts::MultiAttribute; +-using MultiAttributes = concepts::MultiAttribute; +-using NoAttributes = concepts::NoAttribute; ++using MultiAttributes = concepts::MultiAttribute; ++using NoAttributes = concepts::NoAttribute; + + using NoSize = concepts::NoAttribute; + using HasSize = concepts::SingleAttribute; +diff --git a/lang/c++/api/Schema.hh b/lang/c++/api/Schema.hh +index fa50481..b0d1e39 100644 +--- a/lang/c++/api/Schema.hh ++++ b/lang/c++/api/Schema.hh +@@ -21,7 +21,7 @@ + + #include "Config.hh" + #include "NodeImpl.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + #include + + /// \file +@@ -103,7 +103,7 @@ public: + void addField(const std::string &name, const Schema &fieldSchema); + // Add a field with custom attributes + void addField(const std::string &name, const Schema &fieldSchema, +- const CustomFields &customFields); ++ const CustomAttributes &customFields); + + std::string getDoc() const; + void setDoc(const std::string &); +diff --git a/lang/c++/impl/Compiler.cc b/lang/c++/impl/Compiler.cc +index 014229e..383798c 100644 +--- a/lang/c++/impl/Compiler.cc ++++ b/lang/c++/impl/Compiler.cc +@@ -21,7 +21,7 @@ + #include + + #include "Compiler.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + #include "NodeConcepts.hh" + #include "Schema.hh" + #include "Stream.hh" +@@ -149,8 +149,8 @@ struct Field { + const string name; + const NodePtr schema; + const GenericDatum defaultValue; +- const CustomFields customFields; +- Field(string n, NodePtr v, GenericDatum dv, const CustomFields& cf) : name(std::move(n)), schema(std::move(v)), defaultValue(std::move(dv)), customFields(std::move(cf)) {} ++ const CustomAttributes customAttributes; ++ Field(string n, NodePtr v, GenericDatum dv, const CustomAttributes& ca) : name(std::move(n)), schema(std::move(v)), defaultValue(std::move(dv)), customAttributes(std::move(ca)) {} + }; + + static void assertType(const Entity &e, EntityType et) { +@@ -268,14 +268,14 @@ static const std::unordered_set& getKnownFields() { + return kKnownFields; + } + +-static void getCustomAttributes(const Object& m, CustomFields &customAttributes) ++static void getCustomAttributes(const Object& m, CustomAttributes &customAttributes) + { + // Don't add known fields on primitive type and fixed type into custom + // fields. + const std::unordered_set& kKnownFields = getKnownFields(); + for (const auto &entry : m) { + if (kKnownFields.find(entry.first) == kKnownFields.end()) { +- customAttributes.addField(entry.first, entry.second); ++ customAttributes.addAttribute(entry.first, entry.second.stringValue()); + } + } + } +@@ -291,7 +291,7 @@ static Field makeField(const Entity &e, SymbolTable &st, const string &ns) { + } + GenericDatum d = (it2 == m.end()) ? GenericDatum() : makeGenericDatum(node, it2->second, st); + // Get custom attributes +- CustomFields customAttributes; ++ CustomAttributes customAttributes; + getCustomAttributes(m, customAttributes); + + return Field(n, node, d, customAttributes); +@@ -304,7 +304,7 @@ static NodePtr makeRecordNode(const Entity &e, const Name &name, + const Array &v = getArrayField(e, m, "fields"); + concepts::MultiAttribute fieldNames; + concepts::MultiAttribute fieldValues; +- concepts::MultiAttribute customAttributes; ++ concepts::MultiAttribute customAttributes; + vector defaultValues; + + for (const auto &it : v) { +@@ -312,7 +312,7 @@ static NodePtr makeRecordNode(const Entity &e, const Name &name, + fieldNames.add(f.name); + fieldValues.add(f.schema); + defaultValues.push_back(f.defaultValue); +- customAttributes.add(f.customFields); ++ customAttributes.add(f.customAttributes); + } + NodeRecord *node; + if (doc == nullptr) { +diff --git b/lang/c++/impl/CustomAttributes.cc b/lang/c++/impl/CustomAttributes.cc +new file mode 100644 +index 0000000..bb56438 +--- /dev/null ++++ b/lang/c++/impl/CustomAttributes.cc +@@ -0,0 +1,51 @@ ++ ++/** ++ * Licensed to the Apache Software Foundation (ASF) under one ++ * or more contributor license agreements. See the NOTICE file ++ * distributed with this work for additional information ++ * regarding copyright ownership. The ASF licenses this file ++ * to you under the Apache License, Version 2.0 (the ++ * "License"); you may not use this file except in compliance ++ * with the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++#include "CustomAttributes.hh" ++#include ++#include ++#include "Exception.hh" ++ ++namespace avro { ++ ++std::string CustomAttributes::getAttribute(const std::string &name) const { ++ std::map::const_iterator iter = ++ attributes_.find(name); ++ if (iter == attributes_.end()) { ++ return NULL; ++ } ++ return iter->second; ++} ++ ++void CustomAttributes::addAttribute(const std::string& name, ++ const std::string& value) { ++ auto iter_and_find = ++ attributes_.insert(std::pair(name, value)); ++ if (!iter_and_find.second) { ++ throw Exception(name + " already exists and cannot be added"); ++ } ++} ++ ++void CustomAttributes::printJson(std::ostream& os, ++ const std::string& name) const { ++ if (attributes().find(name) == attributes().end()) { ++ throw Exception(name + " doesn't exist"); ++ } ++ os << "\"" << name << "\": \"" << attributes().at(name) << "\""; ++} ++} // namespace avro +diff --git a/lang/c++/impl/CustomFields.cc a/lang/c++/impl/CustomFields.cc +deleted file mode 100644 +index 04541da..0000000 +--- a/lang/c++/impl/CustomFields.cc ++++ /dev/null +@@ -1,59 +0,0 @@ +- +-/** +- * Licensed to the Apache Software Foundation (ASF) under one +- * or more contributor license agreements. See the NOTICE file +- * distributed with this work for additional information +- * regarding copyright ownership. The ASF licenses this file +- * to you under the Apache License, Version 2.0 (the +- * "License"); you may not use this file except in compliance +- * with the License. You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, software +- * distributed under the License is distributed on an "AS IS" BASIS, +- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- * See the License for the specific language governing permissions and +- * limitations under the License. +- */ +-#include "CustomFields.hh" +-#include +-#include +-#include "Exception.hh" +- +-namespace avro { +- +-using json::Entity; +- +-Entity CustomFields::getField(const std::string &fieldName) const { +- std::map::const_iterator iter = +- fields_.find(fieldName); +- if (iter == fields_.end()) { +- return Entity(); +- } +- return iter->second; +-} +- +-void CustomFields::addField(const std::string& fieldName, +- const std::string& fieldValue) { +- addField(fieldName, +- json::Entity(std::make_shared(fieldValue))); +-} +- +-void CustomFields::addField(const std::string& fieldName, +- const Entity& fieldValue) { +- auto iter_and_find = +- fields_.insert(std::pair(fieldName, fieldValue)); +- if (!iter_and_find.second) { +- throw Exception(fieldName + " already exists and cannot be added"); +- } +-} +- +-void CustomFields::printJson(std::ostream& os, +- const std::string& fieldName) const { +- if (fields_.find(fieldName) == fields_.end()) { +- throw Exception(fieldName + " doesn't exist"); +- } +- os << "\"" << fieldName << "\": " << fields_.at(fieldName).toString(); +-} +-} // namespace avro +diff --git a/lang/c++/impl/NodeImpl.cc b/lang/c++/impl/NodeImpl.cc +index 37c8555..5549c68 100644 +--- a/lang/c++/impl/NodeImpl.cc ++++ b/lang/c++/impl/NodeImpl.cc +@@ -83,13 +83,13 @@ std::ostream &operator<<(std::ostream &os, indent x) { + return os; + } + +-void printCustomFields(const CustomFields& customFields, int depth, ++void printCustomAttributes(const CustomAttributes& customAttributes, int depth, + std::ostream &os) { +- std::map::const_iterator iter = +- customFields.fields().begin(); +- while (iter != customFields.fields().end()) { ++ std::map::const_iterator iter = ++ customAttributes.attributes().begin(); ++ while (iter != customAttributes.attributes().end()) { + os << ",\n" << indent(depth); +- customFields.printJson(os, iter->first); ++ customAttributes.printJson(os, iter->first); + ++iter; + } + } +@@ -287,7 +287,7 @@ void NodeRecord::printJson(std::ostream &os, size_t depth) const { + } + } + if(customAttributes_.size() == fields) { +- printCustomFields(customAttributes_.get(i), depth, os); ++ printCustomAttributes(customAttributes_.get(i), depth, os); + } + os << '\n'; + os << indent(--depth) << '}'; +diff --git a/lang/c++/impl/Schema.cc b/lang/c++/impl/Schema.cc +index fa90d34..3315f25 100644 +--- a/lang/c++/impl/Schema.cc ++++ b/lang/c++/impl/Schema.cc +@@ -19,7 +19,7 @@ + #include + + #include "Schema.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + + namespace avro { + +@@ -28,11 +28,11 @@ RecordSchema::RecordSchema(const std::string &name) : Schema(new NodeRecord) { + } + + void RecordSchema::addField(const std::string &name, const Schema &fieldSchema) { +- const CustomFields emptyCustomField; +- addField(name, fieldSchema, emptyCustomField); ++ const CustomAttributes emptyCustomAttribute; ++ addField(name, fieldSchema, emptyCustomAttribute); + } + +-void RecordSchema::addField(const std::string &name, const Schema &fieldSchema, const CustomFields &customFields) { ++void RecordSchema::addField(const std::string &name, const Schema &fieldSchema, const CustomAttributes &customFields) { + // add the name first. it will throw if the name is a duplicate, preventing + // the leaf from being added + node_->addName(name); diff --git a/recipes/libavrocpp/all/test_package/CMakeLists.txt b/recipes/libavrocpp/all/test_package/CMakeLists.txt index 68d787b464e8d9..b68f9ecbb512a1 100644 --- a/recipes/libavrocpp/all/test_package/CMakeLists.txt +++ b/recipes/libavrocpp/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ 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(libavrocpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(TARGET libavrocpp::avrocpp) target_link_libraries(${PROJECT_NAME} libavrocpp::avrocpp) diff --git a/recipes/libavrocpp/all/test_package/conanfile.py b/recipes/libavrocpp/all/test_package/conanfile.py index 75634e62bcb667..a9fb96656f2039 100644 --- a/recipes/libavrocpp/all/test_package/conanfile.py +++ b/recipes/libavrocpp/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_layout, CMake 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 = "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 +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/libavrocpp/all/test_v1_package/CMakeLists.txt b/recipes/libavrocpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libavrocpp/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/libavrocpp/all/test_v1_package/conanfile.py b/recipes/libavrocpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libavrocpp/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/libavrocpp/config.yml b/recipes/libavrocpp/config.yml index ed319d069e4869..9fcb2d236146c1 100644 --- a/recipes/libavrocpp/config.yml +++ b/recipes/libavrocpp/config.yml @@ -1,4 +1,6 @@ versions: + 1.11.1: + folder: all 1.11.0: folder: all 1.10.2: diff --git a/recipes/libcap/all/conandata.yml b/recipes/libcap/all/conandata.yml index 847c16afd3b785..96d617e32dbb60 100644 --- a/recipes/libcap/all/conandata.yml +++ b/recipes/libcap/all/conandata.yml @@ -23,29 +23,71 @@ sources: "2.65": url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.65.tar.xz" sha256: "73e350020cc31fe15360879d19384ffa3395a825f065fcf6bda3a5cdf965bebd" + "2.66": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.66.tar.xz" + sha256: "15c40ededb3003d70a283fe587a36b7d19c8b3b554e33f86129c059a4bb466b2" patches: "2.45": - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.46": - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.48": - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.50": - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.57": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.58": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.62": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.65": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.66": + - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" + - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" diff --git a/recipes/libcap/all/conanfile.py b/recipes/libcap/all/conanfile.py index 735fde82a02435..84f7ed56fc46a5 100644 --- a/recipes/libcap/all/conanfile.py +++ b/recipes/libcap/all/conanfile.py @@ -3,11 +3,12 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import cross_building -from conan.tools.files import apply_conandata_patches, copy, chdir, get, rmdir -from conan.tools.layout import basic_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, chdir, export_conandata_patches, get, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class LibcapConan(ConanFile): @@ -17,7 +18,7 @@ class LibcapConan(ConanFile): homepage = "https://git.kernel.org/pub/scm/libs/libcap/libcap.git" description = "This is a library for getting and setting POSIX.1e" \ " (formerly POSIX 6) draft 15 capabilities" - topics = ("libcap", "capabilities") + topics = ("capabilities") settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -29,26 +30,22 @@ class LibcapConan(ConanFile): "fPIC": True, "psx_syscals": False, } - exports_sources = "patches/**" def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def validate(self): if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux supported") + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def layout(self): - basic_layout(self, src_folder="source") + basic_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -64,8 +61,10 @@ def generate(self): env.define("lib", "lib") if cross_building(self) and not env.vars(self).get("BUILD_CC"): - native_cc = "cc" - self.output.info("Using native compiler '{}'".format(native_cc)) + native_cc = VirtualBuildEnv(self).vars().get("CC") + if not native_cc: + native_cc = "cc" + self.output.info(f"Using native compiler '{native_cc}'") env.define("BUILD_CC", native_cc) tc.generate(env) diff --git a/recipes/libcap/all/test_package/conanfile.py b/recipes/libcap/all/test_package/conanfile.py index 2e57d4c1e40559..833f2d61cd5bb9 100644 --- a/recipes/libcap/all/test_package/conanfile.py +++ b/recipes/libcap/all/test_package/conanfile.py @@ -2,23 +2,20 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake +from conan.tools.cmake import CMake, cmake_layout from conan.tools.env import Environment -from conan.tools.cmake import cmake_layout - -required_conan_version = ">=1.38.0" class LibcapTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv" + generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv" test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/1.9.3") def layout(self): cmake_layout(self) diff --git a/recipes/libcap/all/test_v1_package/CMakeLists.txt b/recipes/libcap/all/test_v1_package/CMakeLists.txt index 2b3baa53f33471..925ecbe19e448d 100644 --- a/recipes/libcap/all/test_v1_package/CMakeLists.txt +++ b/recipes/libcap/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -find_package(PkgConfig REQUIRED) -pkg_check_modules(CAP REQUIRED IMPORTED_TARGET libcap) - -add_executable(example ../test_package/example.c) -target_link_libraries(example PRIVATE PkgConfig::CAP) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libcap/all/test_v1_package/conanfile.py b/recipes/libcap/all/test_v1_package/conanfile.py index f90b4e8b52f6ed..8ee3af7509e31b 100644 --- a/recipes/libcap/all/test_v1_package/conanfile.py +++ b/recipes/libcap/all/test_v1_package/conanfile.py @@ -10,7 +10,7 @@ class LibcapTestConan(ConanFile): generators = "cmake", "pkg_config" def build_requirements(self): - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/1.9.3") def build(self): cmake = CMake(self) diff --git a/recipes/libcap/config.yml b/recipes/libcap/config.yml index ee4c4ae443408b..58715d0f047445 100644 --- a/recipes/libcap/config.yml +++ b/recipes/libcap/config.yml @@ -15,3 +15,5 @@ versions: folder: all "2.65": folder: all + "2.66": + folder: all diff --git a/recipes/libcbor/all/conandata.yml b/recipes/libcbor/all/conandata.yml index 62e7073df986d0..a14b76e6d87db8 100644 --- a/recipes/libcbor/all/conandata.yml +++ b/recipes/libcbor/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.10.1": + url: "https://github.com/PJK/libcbor/archive/v0.10.1.tar.gz" + sha256: "e8fa0a726b18861c24428561c80b3c95aca95f468df4e2f3e3ac618be12d3047" + "0.10.0": + url: "https://github.com/PJK/libcbor/archive/v0.10.0.tar.gz" + sha256: "4f79c6a9e587aaf877f1c4e74a842a599f2b56b5afb6bf59e51bc643b4f69ba0" "0.9.0": url: "https://github.com/PJK/libcbor/archive/v0.9.0.tar.gz" sha256: "da81e4f9333e0086d4e2745183c7052f04ecc4dbcffcf910029df24f103c15d1" @@ -8,6 +14,12 @@ sources: patches: "0.9.0": - patch_file: "patches/0.7.0/002_fix_cmake_module_path.patch" + patch_description: "fix cmake module path" + patch_type: "portability" "0.7.0": - patch_file: "patches/0.7.0/001_fix_shared_build.patch" + patch_description: "fix shared build compilation error" + patch_type: "conan" - patch_file: "patches/0.7.0/002_fix_cmake_module_path.patch" + patch_description: "fix cmake module path" + patch_type: "portability" diff --git a/recipes/libcbor/all/test_package/CMakeLists.txt b/recipes/libcbor/all/test_package/CMakeLists.txt index fc2cbc0d5af6e0..94fca8fa664068 100644 --- a/recipes/libcbor/all/test_package/CMakeLists.txt +++ b/recipes/libcbor/all/test_package/CMakeLists.txt @@ -5,3 +5,7 @@ find_package(libcbor REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE libcbor::libcbor) + +if(libcbor_VERSION VERSION_GREATER_EQUAL "0.10.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE -DLIBCBOR_DEPRECATE_CUSTOM_ALLOC) +endif() diff --git a/recipes/libcbor/all/test_package/test_package.c b/recipes/libcbor/all/test_package/test_package.c index aeae930f3bd7be..63def1fbfb9b05 100644 --- a/recipes/libcbor/all/test_package/test_package.c +++ b/recipes/libcbor/all/test_package/test_package.c @@ -3,7 +3,9 @@ int main(int argc, char *argv[]) { printf("Hello from libcbor %s\n", CBOR_VERSION); +#ifndef LIBCBOR_DEPRECATE_CUSTOM_ALLOC printf("Custom allocation support: %s\n", CBOR_CUSTOM_ALLOC ? "yes" : "no"); +#endif printf("Pretty-printer support: %s\n", CBOR_PRETTY_PRINTER ? "yes" : "no"); printf("Buffer growth factor: %f\n", (float)CBOR_BUFFER_GROWTH); cbor_item_t *array = cbor_new_definite_array(4); diff --git a/recipes/libcbor/config.yml b/recipes/libcbor/config.yml index b4b6b81f6444ee..ec48c826910673 100644 --- a/recipes/libcbor/config.yml +++ b/recipes/libcbor/config.yml @@ -1,4 +1,8 @@ versions: + "0.10.1": + folder: "all" + "0.10.0": + folder: "all" "0.9.0": folder: "all" "0.7.0": diff --git a/recipes/libcurl/all/conandata.yml b/recipes/libcurl/all/conandata.yml index 65ff7d7373b901..5fb0b0c8d8687f 100644 --- a/recipes/libcurl/all/conandata.yml +++ b/recipes/libcurl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "7.87.0": + url: "https://curl.se/download/curl-7.87.0.tar.gz" + sha256: "8a063d664d1c23d35526b87a2bf15514962ffdd8ef7fd40519191b3c23e39548" "7.86.0": url: "https://curl.se/download/curl-7.86.0.tar.gz" sha256: "3dfdd39ba95e18847965cd3051ea6d22586609d9011d91df7bc5521288987a82" diff --git a/recipes/libcurl/all/conanfile.py b/recipes/libcurl/all/conanfile.py index dd2fe94b93cc0b..2e301658084e78 100644 --- a/recipes/libcurl/all/conanfile.py +++ b/recipes/libcurl/all/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration 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.cmake import CMake, CMakeToolchain, CMakeDeps, 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 @@ -153,6 +153,12 @@ def config_options(self): del self.options.with_zstd if not self._has_metalink_option: del self.options.with_libmetalink + + # Before 7.86.0, enabling unix sockets configure option would fail on windows + # It was fixed with this PR: https://github.com/curl/curl/pull/9688 + if self._is_mingw and Version(self.version) < "7.86.0": + del self.options.with_unix_sockets + # Default options self.options.with_ssl = "darwinssl" if is_apple_os(self) else "openssl" @@ -220,7 +226,7 @@ def layout(self): def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - download(self, "https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True, sha256="2cff03f9efdaf52626bd1b451d700605dc1ea000c5da56bd0fc59f8f43071040") + download(self, "https://curl.se/ca/cacert-2023-01-10.pem", "cacert.pem", verify=True, sha256="fb1ecd641d0a02c01bc9036d513cb658bbda62a75e246bedbc01764560a639f0") def generate(self): env = VirtualBuildEnv(self) @@ -299,7 +305,8 @@ def _patch_autotools(self): # add directives to build dll # used only for native mingw-make if not cross_building(self): - added_content = load(self, "lib_Makefile_add.am") + # The patch file is located in the base src folder + added_content = load(self, os.path.join(self.folders.base_source, "lib_Makefile_add.am")) save(self, lib_makefile, added_content, append=True) def _patch_cmake(self): @@ -385,7 +392,7 @@ def _generate_with_autotools(self): 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)}", + f"--enable-unix-sockets={self._yes_no(self.options.get_safe('with_unix_sockets'))}", ]) # Since 7.77.0, disabling TLS must be explicitly requested otherwise it fails @@ -468,6 +475,8 @@ def _generate_with_autotools(self): elif self.settings.os == "Android": pass # this just works, conan is great! + env = tc.environment() + # tweaks for mingw if self._is_mingw: rcflags = "-O COFF" @@ -476,7 +485,6 @@ def _generate_with_autotools(self): elif self.settings.arch == "x86_64": rcflags += " --target=pe-x86-64" tc.extra_defines.append("_AMD64_") - env = tc.environment() env.define("RCFLAGS", rcflags) if self.settings.os != "Windows": @@ -486,7 +494,7 @@ def _generate_with_autotools(self): if cross_building(self) and is_apple_os(self): tc.extra_defines.extend(['HAVE_SOCKET', 'HAVE_FCNTL_O_NONBLOCK']) - tc.generate() + tc.generate(env) tc = PkgConfigDeps(self) tc.generate() tc = AutotoolsDeps(self) @@ -515,10 +523,13 @@ def _arm_version(self, arch): return version def _generate_with_cmake(self): + dc = CMakeDeps(self) + dc.generate() if self._is_win_x_android: tc = CMakeToolchain(self, generator="Ninja") else: tc = CMakeToolchain(self) + tc.variables["ENABLE_UNICODE"] = True tc.variables["BUILD_TESTING"] = False tc.variables["BUILD_CURL_EXE"] = False tc.variables["CURL_DISABLE_LDAP"] = not self.options.with_ldap @@ -595,9 +606,9 @@ def package(self): rm(self, "*.la", os.path.join(self.package_folder, "lib")) if self._is_mingw and self.options.shared: # Handle only mingw libs - 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) + copy(self, pattern="*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, pattern="*.dll.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, pattern="*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "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/test_package.c b/recipes/libcurl/all/test_package/test_package.c index ed7ab4e3952c68..309b36d2e45f90 100644 --- a/recipes/libcurl/all/test_package/test_package.c +++ b/recipes/libcurl/all/test_package/test_package.c @@ -23,7 +23,7 @@ int main(void) /* provide a buffer to store errors in */ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf); - /* always cleanup */ + /* always cleanup */ curl_easy_cleanup(curl); printf("Succeed\n"); } else { diff --git a/recipes/libcurl/config.yml b/recipes/libcurl/config.yml index 67489a56924a20..5bb005da00271e 100644 --- a/recipes/libcurl/config.yml +++ b/recipes/libcurl/config.yml @@ -1,4 +1,6 @@ versions: + "7.87.0": + folder: all "7.86.0": folder: all "7.85.0": diff --git a/recipes/libdeflate/all/conandata.yml b/recipes/libdeflate/all/conandata.yml index 2f736fbb604425..a4d8bdf0c97fa1 100644 --- a/recipes/libdeflate/all/conandata.yml +++ b/recipes/libdeflate/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.17": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.17.tar.gz" + sha256: "fa4615af671513fa2a53dc2e7a89ff502792e2bdfc046869ef35160fcc373763" "1.15": url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.15.tar.gz" sha256: "58b95040df7383dc0413defb700d9893c194732474283cc4c8f144b00a68154b" diff --git a/recipes/libdeflate/all/test_package/CMakeLists.txt b/recipes/libdeflate/all/test_package/CMakeLists.txt index 8a0545abfaa5fa..267cdbc24f8b8b 100644 --- a/recipes/libdeflate/all/test_package/CMakeLists.txt +++ b/recipes/libdeflate/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) find_package(libdeflate REQUIRED CONFIG) diff --git a/recipes/libdeflate/config.yml b/recipes/libdeflate/config.yml index 10dff89847eaa9..297f2db78fab2a 100644 --- a/recipes/libdeflate/config.yml +++ b/recipes/libdeflate/config.yml @@ -1,4 +1,6 @@ versions: + "1.17": + folder: "all" "1.15": folder: "all" "1.14": diff --git a/recipes/libdrm/all/conandata.yml b/recipes/libdrm/all/conandata.yml index 385cbe19798415..c664ae449755db 100644 --- a/recipes/libdrm/all/conandata.yml +++ b/recipes/libdrm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.4.114": + url: "https://dri.freedesktop.org/libdrm/libdrm-2.4.114.tar.xz" + sha256: "3049cf843a47d12e5eeefbc3be3496d782fa09f42346bf0b7defe3d1e598d026" "2.4.109": url: "https://dri.freedesktop.org/libdrm/libdrm-2.4.109.tar.xz" sha256: "629352e08c1fe84862ca046598d8a08ce14d26ab25ee1f4704f993d074cb7f26" diff --git a/recipes/libdrm/all/conanfile.py b/recipes/libdrm/all/conanfile.py index cbc5ff81fd540f..aad89cccd5bf6d 100644 --- a/recipes/libdrm/all/conanfile.py +++ b/recipes/libdrm/all/conanfile.py @@ -1,8 +1,11 @@ import os import re -from conans import ConanFile, Meson, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, load, mkdir, rmdir, save +from conan.tools.scm import Version +from conans import Meson class LibdrmConan(ConanFile): @@ -63,11 +66,13 @@ def _build_subfolder(self): return "build_subfolder" def build_requirements(self): - self.build_requires("meson/0.59.0") + self.build_requires("meson/0.64.1") def config_options(self): if self.settings.os == 'Windows': del self.options.fPIC + if Version(self.version) >= "2.4.111": + del self.options.libkms def configure(self): del self.settings.compiler.libcxx @@ -86,19 +91,28 @@ def validate(self): raise ConanInvalidConfiguration("libdrm supports only Linux or FreeBSD") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_meson(self): meson = Meson(self) defs={ - "cairo-tests" : "false", + "cairo-tests" : "disabled" if Version(self.version) >= "2.4.113" else "false", "install-test-programs": "false" } - for o in ["libkms", "intel", "radeon", "amdgpu","nouveau", "vmwgfx", "omap", "exynos", - "freedreno", "tegra", "vc4", "etnaviv", "valgrind", "freedreno-kgsl", "udev"]: - defs[o] = "true" if getattr(self.options, o) else "false" + if Version(self.version) < "2.4.111": + defs["libkms"] = "true" if self.options.libkms else "false" + + defs["freedreno-kgsl"] = "true" if getattr(self.options, "freedreno-kgsl") else "false" + defs["udev"] = "true" if self.options.udev else "false" + + for o in ["intel", "radeon", "amdgpu","nouveau", "vmwgfx", "omap", "exynos", + "freedreno", "tegra", "vc4", "etnaviv", "valgrind"]: + if Version(self.version) >= "2.4.113": + defs[o] = "enabled" if getattr(self.options, o) else "disabled" + else: + defs[o] = "true" if getattr(self.options, o) else "false" defs["datadir"] = os.path.join(self.package_folder, "res") defs["mandir"] = os.path.join(self.package_folder, "res", "man") @@ -116,12 +130,12 @@ def build(self): def package(self): meson = self._configure_meson() meson.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.mkdir(os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + mkdir(self, os.path.join(self.package_folder, "licenses")) # Extract the License/s from the header to a file - tmp = tools.load(os.path.join(self._source_subfolder, "include", "drm", "drm.h")) + tmp = load(self, os.path.join(self._source_subfolder, "include", "drm", "drm.h")) license_contents = re.search("\*\/.*(\/\*(\*(?!\/)|[^*])*\*\/)", tmp, re.DOTALL)[1] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package_info(self): self.cpp_info.components["libdrm_libdrm"].libs = ["drm"] @@ -130,11 +144,12 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.components["libdrm_libdrm"].requires = ["linux-headers-generic::linux-headers-generic"] - if self.options.libkms: - self.cpp_info.components["libdrm_libkms"].libs = ["kms"] - self.cpp_info.components["libdrm_libkms"].includedirs.append(os.path.join('include', 'libkms')) - self.cpp_info.components["libdrm_libkms"].requires = ["libdrm_libdrm"] - self.cpp_info.components["libdrm_libkms"].set_property("pkg_config_name", "libkms") + if Version(self.version) < "2.4.111": + if self.options.libkms: + self.cpp_info.components["libdrm_libkms"].libs = ["kms"] + self.cpp_info.components["libdrm_libkms"].includedirs.append(os.path.join('include', 'libkms')) + self.cpp_info.components["libdrm_libkms"].requires = ["libdrm_libdrm"] + self.cpp_info.components["libdrm_libkms"].set_property("pkg_config_name", "libkms") if self.options.vc4: self.cpp_info.components["libdrm_vc4"].requires = ["libdrm_libdrm"] diff --git a/recipes/libdrm/config.yml b/recipes/libdrm/config.yml index 4beea198f8d482..90fca8a547e3e5 100644 --- a/recipes/libdrm/config.yml +++ b/recipes/libdrm/config.yml @@ -1,3 +1,5 @@ versions: + "2.4.114": + folder: all "2.4.109": folder: all diff --git a/recipes/libdxfrw/all/CMakeLists.txt b/recipes/libdxfrw/all/CMakeLists.txt deleted file mode 100644 index d17aaff199b4a6..00000000000000 --- a/recipes/libdxfrw/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libdxfrw/all/conandata.yml b/recipes/libdxfrw/all/conandata.yml index 56e52bb33b6944..163bfa884b042a 100644 --- a/recipes/libdxfrw/all/conandata.yml +++ b/recipes/libdxfrw/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.0": + url: "https://github.com/LibreCAD/libdxfrw/archive/refs/tags/LC2.2.0.tar.gz" + sha256: "b56535f8c234bb119b94e11b2436651531869ba0171bb10166b007588e97d69f" "1.0.1": url: "https://github.com/LibreCAD/libdxfrw/archive/1.0.1.tar.gz" sha256: "eea1021b296cb9ba4cab4417106e41d53a8fadfffe2cd108efe46afb04e2ec34" diff --git a/recipes/libdxfrw/all/conanfile.py b/recipes/libdxfrw/all/conanfile.py index 7f1e177de05d8e..22166b390cae7c 100644 --- a/recipes/libdxfrw/all/conanfile.py +++ b/recipes/libdxfrw/all/conanfile.py @@ -1,62 +1,80 @@ +from conan import ConanFile +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools +required_conan_version = ">=1.53.0" class LibdxfrwConan(ConanFile): name = "libdxfrw" + description = "C++ library to read/write DXF and read DWG files" license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/LibreCAD/libdxfrw" - description = "C++ library to read/write DXF and read DWG files" topics = ("dxf", "dwg", "cad") - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = "CMakeLists.txt" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + 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], 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["LIBDXFRW_BUILD_DOC"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + if Version(self.version) >= "2.2.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "-Werror", "") + + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - 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, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(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")) + 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 env var: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) self.cpp_info.libs = ["dxfrw"] + + self.cpp_info.set_property("pkg_config_name", "libdxfrw") + 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: {bin_path}") + self.env_info.PATH.append(bin_path) diff --git a/recipes/libdxfrw/all/test_package/CMakeLists.txt b/recipes/libdxfrw/all/test_package/CMakeLists.txt index 6aab347eddf535..3fefb4e7b7d8ad 100644 --- a/recipes/libdxfrw/all/test_package/CMakeLists.txt +++ b/recipes/libdxfrw/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libdxfrw REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_property(TARGET example PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libdxfrw::libdxfrw) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libdxfrw/all/test_package/conanfile.py b/recipes/libdxfrw/all/test_package/conanfile.py index 44bb963d9da9a8..a9fb96656f2039 100644 --- a/recipes/libdxfrw/all/test_package/conanfile.py +++ b/recipes/libdxfrw/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_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class LibdxfrwTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "example"), 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/libdxfrw/all/test_package/example.cpp b/recipes/libdxfrw/all/test_package/test_package.cpp similarity index 100% rename from recipes/libdxfrw/all/test_package/example.cpp rename to recipes/libdxfrw/all/test_package/test_package.cpp diff --git a/recipes/libdxfrw/all/test_v1_package/CMakeLists.txt b/recipes/libdxfrw/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libdxfrw/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/libdxfrw/all/test_v1_package/conanfile.py b/recipes/libdxfrw/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libdxfrw/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/libdxfrw/config.yml b/recipes/libdxfrw/config.yml index 715e55357a17be..a9f4753aaca711 100644 --- a/recipes/libdxfrw/config.yml +++ b/recipes/libdxfrw/config.yml @@ -1,3 +1,5 @@ versions: + "2.2.0": + folder: all "1.0.1": folder: all diff --git a/recipes/libffi/all/conanfile.py b/recipes/libffi/all/conanfile.py index fca2894b5fa7bc..0e8716fc839caa 100644 --- a/recipes/libffi/all/conanfile.py +++ b/recipes/libffi/all/conanfile.py @@ -10,7 +10,7 @@ import os import shutil -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibffiConan(ConanFile): @@ -44,18 +44,9 @@ def config_options(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): basic_layout(self, src_folder="src") diff --git a/recipes/libftdi/1.x/CMakeLists.txt b/recipes/libftdi/1.x/CMakeLists.txt deleted file mode 100644 index f4e5078f422288..00000000000000 --- a/recipes/libftdi/1.x/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -add_subdirectory(source_subfolder) diff --git a/recipes/libftdi/1.x/conandata.yml b/recipes/libftdi/1.x/conandata.yml index db04076175670b..3548dde53d9187 100644 --- a/recipes/libftdi/1.x/conandata.yml +++ b/recipes/libftdi/1.x/conandata.yml @@ -5,5 +5,5 @@ sources: patches: "1.5": - patch_file: "patches/0001-cmake-targets.patch" - base_path: "source_subfolder" - + patch_description: "Fix cmake targets and call project after cmake_minimum_required." + patch_type: "conan" diff --git a/recipes/libftdi/1.x/conanfile.py b/recipes/libftdi/1.x/conanfile.py index 951dbaa4f8b8a1..16c0bb3e46d342 100644 --- a/recipes/libftdi/1.x/conanfile.py +++ b/recipes/libftdi/1.x/conanfile.py @@ -1,103 +1,111 @@ import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, rmdir, export_conandata_patches +from conan.tools.files import apply_conandata_patches, copy +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +required_conan_version = ">=1.53.0" class LibFtdiConan(ConanFile): name = "libftdi" description = "A library to talk to FTDI chips" license = "LGPL-2.0-only", "GPLv2-or-later" - topics = ("conan", "libftdi1") + topics = "ftdi" homepage = "https://www.intra2net.com/en/developer/libftdi/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake", "cmake_find_package", "pkg_config" settings = "os", "arch", "compiler", "build_type" options = { - "shared" : [True, False], + "shared" : [True, False], "fPIC" : [True, False], "enable_cpp_wrapper" : [True, False], "build_eeprom_tool" : [True, False], "use_streaming" : [True, False], } default_options = { - "shared": False, + "shared": False, "fPIC": True, "enable_cpp_wrapper": True, "build_eeprom_tool" : False, "use_streaming" : True, } - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "libftdi1-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + strip_root=True) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.options.use_streaming = False + def layout(self): + cmake_layout(self, src_folder="src") + def configure(self): if self.options.shared: - del self.options.fPIC - - def _configure_cmake(self): - if self._cmake: - return self._cmake + self.options.rm_safe("fPIC") + self.license = ("LGPL-2.1-only", "GPL-2.0-only") if self.options.build_eeprom_tool or self.options.enable_cpp_wrapper else ("LGPL-2.1-only") - self._cmake = CMake(self) - options = { - "BUILD_TESTS": False, - "EXAMPLES": False, - "FTDI_EEPROM": self.options.build_eeprom_tool, - "FTDIPP" : self.options.enable_cpp_wrapper, - "STATICLIBS": not self.options.shared, - "ENABLE_STREAMING": self.options.use_streaming, - } - self._cmake.definitions.update(options) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["EXAMPLES"] = False + tc.variables["FTDI_EEPROM"] = self.options.build_eeprom_tool + tc.variables["FTDIPP"] = self.options.enable_cpp_wrapper + tc.variables["ENABLE_STREAMING"] = self.options.use_streaming + tc.variables["LIB_SUFFIX"] = "" + tc.generate() + tc = CMakeDeps(self) + tc.generate() def requirements(self): - self.requires("libusb/1.0.24") - self.requires("boost/1.75.0") + self.requires("libusb/1.0.26") + if self.options.enable_cpp_wrapper: + self.requires("boost/1.80.0") def validate(self): - if self.settings.compiler == "Visual Studio" and self.options.use_streaming: + if is_msvc(self) and self.options.use_streaming: raise ConanInvalidConfiguration("VS doesn't not compile with enabled option use_streaming") 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, "COPYING.LIB", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + if self.options.build_eeprom_tool or self.options.enable_cpp_wrapper: + copy(self, "COPYING.GPL", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - lib_folder = os.path.join(self.package_folder, "lib",) - tools.rmdir(os.path.join(lib_folder, "cmake")) - tools.rmdir(os.path.join(lib_folder, "pkgconfig")) + lib_folder = os.path.join(self.package_folder, "lib") + rmdir(self, os.path.join(lib_folder, "cmake")) + rmdir(self, os.path.join(lib_folder, "pkgconfig")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "LibFTDI1" - self.cpp_info.names["cmake_find_package_multi"] = "LibFTDI1" - self.cpp_info.names["pkgconfig"] = "libftdi1" + # Remove "self.cpp_info.filenames.." statements in Conan V2 + self.cpp_info.filenames['cmake_find_package'] = "LibFTDI1" + self.cpp_info.filenames['cmake_find_package_multi'] = "LibFTDI1" - self.cpp_info.components["ftdi"].names["pkg_config"] = "libftdi1" + self.cpp_info.set_property("cmake_file_name", "LibFTDI1") + self.cpp_info.components["ftdi"].set_property("pkg_config_name", "libftdi1") self.cpp_info.components["ftdi"].libs = ["ftdi1"] self.cpp_info.components["ftdi"].requires = ["libusb::libusb"] self.cpp_info.components["ftdi"].includedirs.append(os.path.join("include", "libftdi1")) + self.cpp_info.components["ftdi"].names["pkg_config"] = "libftdi1" - self.cpp_info.components["ftdipp"].names["pkg_config"] = "libftdi1pp" - self.cpp_info.components["ftdipp"].libs = ["ftdipp1"] - self.cpp_info.components["ftdipp"].requires = ["ftdi", "boost::headers"] - self.cpp_info.components["ftdipp"].includedirs.append(os.path.join("include", "libftdipp1")) + if self.options.enable_cpp_wrapper: + self.cpp_info.components["ftdipp"].set_property("pkg_config_name", "libftdipp1") + self.cpp_info.components["ftdipp"].libs = ["ftdipp1"] + self.cpp_info.components["ftdipp"].requires = ["ftdi", "boost::headers"] + self.cpp_info.components["ftdipp"].names["pkg_config"] = "libftdipp1" + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ftdipp"].system_libs.append("m") diff --git a/recipes/libftdi/1.x/patches/0001-cmake-targets.patch b/recipes/libftdi/1.x/patches/0001-cmake-targets.patch index 751ff4099d9f07..9ca28ffd1fc5eb 100644 --- a/recipes/libftdi/1.x/patches/0001-cmake-targets.patch +++ b/recipes/libftdi/1.x/patches/0001-cmake-targets.patch @@ -4,7 +4,9 @@ index 5aecafc..abb133f 100644 +++ b/CMakeLists.txt @@ -1,36 +1,54 @@ -# Project - project(libftdi1 C) +-project(libftdi1 C) ++cmake_minimum_required(VERSION 3.15 FATAL_ERROR) ++project(libftdi1) + set(MAJOR_VERSION 1) set(MINOR_VERSION 5) @@ -21,7 +23,6 @@ index 5aecafc..abb133f 100644 set(CMAKE_COLOR_MAKEFILE ON) -cmake_minimum_required(VERSION 2.6 FATAL_ERROR) + -+cmake_minimum_required(VERSION 3.0 FATAL_ERROR) +if(POLICY CMP0057) + cmake_policy(SET CMP0057 NEW) +endif() diff --git a/recipes/libftdi/1.x/test_package/CMakeLists.txt b/recipes/libftdi/1.x/test_package/CMakeLists.txt index 9664d7d8fd8453..efdfd6bd92c126 100644 --- a/recipes/libftdi/1.x/test_package/CMakeLists.txt +++ b/recipes/libftdi/1.x/test_package/CMakeLists.txt @@ -1,13 +1,11 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() find_package(LibFTDI1 REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(test_package - PRIVATE LibFTDI1::ftdipp) +target_link_libraries(${PROJECT_NAME} + PRIVATE libftdi::ftdipp) diff --git a/recipes/libftdi/1.x/test_package/conanfile.py b/recipes/libftdi/1.x/test_package/conanfile.py index b64dc731888531..39f848c25cab4b 100644 --- a/recipes/libftdi/1.x/test_package/conanfile.py +++ b/recipes/libftdi/1.x/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_layout, CMake import os -from conans import ConanFile, CMake, tools - 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) @@ -13,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/libftdi/1.x/test_v1_package/CMakeLists.txt b/recipes/libftdi/1.x/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..eb26d0c1b0943b --- /dev/null +++ b/recipes/libftdi/1.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +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/libftdi/1.x/test_v1_package/conanfile.py b/recipes/libftdi/1.x/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..90c431a11ee68e --- /dev/null +++ b/recipes/libftdi/1.x/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", "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/libgd/all/CMakeLists.txt b/recipes/libgd/all/CMakeLists.txt deleted file mode 100644 index 088ba36390ce82..00000000000000 --- a/recipes/libgd/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -set(CMAKE_C_STANDARD 99) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libgd/all/conandata.yml b/recipes/libgd/all/conandata.yml index 775ee73a32dbbc..e4acad43d15b22 100644 --- a/recipes/libgd/all/conandata.yml +++ b/recipes/libgd/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.3": + url: "https://github.com/libgd/libgd/archive/gd-2.3.3.tar.gz" + sha256: "24429f9d0dbe0f865aaa4b1a63558242396ba9134e6cfd32ca5e486a84483350" "2.3.2": url: "https://github.com/libgd/libgd/archive/gd-2.3.2.tar.gz" sha256: "dcc22244d775f469bee21dce1ea42552adbb72ba0cc423f9fa6a64601b3a1893" @@ -12,29 +15,47 @@ sources: url: "https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz" sha256: "a66111c9b4a04e818e9e2a37d7ae8d4aae0939a100a36b0ffb52c706a09074b5" patches: + "2.3.3": + - patch_file: "patches/2.3.3-qualify-nondll.patch" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" + - patch_file: "patches/2.3.x-png-msvc.patch" + patch_description: "support png on msvc" + patch_type: "portability" "2.3.2": - patch_file: "patches/remove-unistd-h.patch" - base_path: "source_subfolder" + patch_description: "remove unistd.h to fix build error" + patch_type: "portability" - patch_file: "patches/2.3.2-qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" - patch_file: "patches/2.3.x-png-msvc.patch" - base_path: "source_subfolder" + patch_description: "support png on msvc" + patch_type: "portability" "2.3.1": - patch_file: "patches/remove-unistd-h.patch" - base_path: "source_subfolder" + patch_description: "remove unistd.h to fix build error" + patch_type: "portability" - patch_file: "patches/qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" - patch_file: "patches/2.3.x-png-msvc.patch" - base_path: "source_subfolder" + patch_description: "support png on msvc" + patch_type: "portability" "2.3.0": - patch_file: "patches/remove-unistd-h.patch" - base_path: "source_subfolder" + patch_description: "remove unistd.h to fix build error" + patch_type: "portability" - patch_file: "patches/qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" - patch_file: "patches/2.3.x-png-msvc.patch" - base_path: "source_subfolder" + patch_description: "support png on msvc" + patch_type: "conan" "2.2.5": - patch_file: "patches/2.2.5-msvc-static-lib.patch" - base_path: "source_subfolder" + patch_description: "support static build on msvc" + patch_type: "conan" - patch_file: "patches/2.2.5-qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "conan" diff --git a/recipes/libgd/all/conanfile.py b/recipes/libgd/all/conanfile.py index b26dbdb4a30148..169f9e3ba1f8c7 100644 --- a/recipes/libgd/all/conanfile.py +++ b/recipes/libgd/all/conanfile.py @@ -1,21 +1,20 @@ from conan import ConanFile from conan.tools.microsoft import is_msvc -from conans import CMake -from conan.tools.files import get, patch, replace_in_file, rmdir, collect_libs +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.47.0" - +required_conan_version = ">=1.53.0" class LibgdConan(ConanFile): name = "libgd" + description = ("GD is an open source code library for the dynamic" + "creation of images by programmers.") license = "BSD-like" url = "https://github.com/conan-io/conan-center-index" - description = ("GD is an open source code library for the dynamic " - "creation of images by programmers.") - topics = ("images", "graphics") homepage = "https://libgd.github.io" + topics = ("images", "graphics") settings = "os", "arch", "compiler", "build_type" options = { @@ -35,17 +34,8 @@ class LibgdConan(ConanFile): "with_freetype": False, } - exports_sources = "CMakeLists.txt", "patches/**" - 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): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,77 +43,87 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + 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.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if is_msvc(self): self.requires("getopt-for-visual-studio/20200201") if self.options.with_jpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.with_tiff: self.requires("libtiff/4.4.0") if self.options.with_freetype: self.requires("freetype/2.12.1") 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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_C_STANDARD"] = "99" + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + if Version(self.version) >= "2.3.0": + tc.variables["ENABLE_GD_FORMATS"] = True + tc.variables["ENABLE_PNG"] = self.options.with_png + tc.variables["ENABLE_LIQ"] = False + tc.variables["ENABLE_JPEG"] = self.options.with_jpeg + tc.variables["ENABLE_TIFF"] = self.options.with_tiff + tc.variables["ENABLE_ICONV"] = False + tc.variables["ENABLE_XPM"] = False + tc.variables["ENABLE_FREETYPE"] = self.options.with_freetype + tc.variables["ENABLE_FONTCONFIG"] = False + tc.variables["ENABLE_WEBP"] = False + if Version(self.version) >= "2.3.2": + tc.variables["ENABLE_HEIF"] = False + tc.variables["ENABLE_AVIF"] = False + if Version(self.version) >= "2.3.0": + tc.variables["ENABLE_RAQM"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch(self): - for patch_file in self.conan_data.get("patches", {}).get(self.version, []): - patch(self, **patch_file) - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") + apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") replace_in_file(self, cmakelists, "${CMAKE_SOURCE_DIR}", "${CMAKE_CURRENT_SOURCE_DIR}") replace_in_file(self, cmakelists, "SET(CMAKE_MODULE_PATH \"${GD_SOURCE_DIR}/cmake/modules\")", "LIST(APPEND CMAKE_MODULE_PATH \"${GD_SOURCE_DIR}/cmake/modules\")") - replace_in_file(self, os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "RUNTIME DESTINATION bin", "RUNTIME DESTINATION bin BUNDLE DESTINATION bin") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_STATIC_LIBS"] = not self.options.shared - if Version(self.version) >= "2.3.0": - self._cmake.definitions["ENABLE_GD_FORMATS"] = True - self._cmake.definitions["ENABLE_PNG"] = self.options.with_png - self._cmake.definitions["ENABLE_LIQ"] = False - self._cmake.definitions["ENABLE_JPEG"] = self.options.with_jpeg - self._cmake.definitions["ENABLE_TIFF"] = self.options.with_tiff - self._cmake.definitions["ENABLE_ICONV"] = False - self._cmake.definitions["ENABLE_XPM"] = False - self._cmake.definitions["ENABLE_FREETYPE"] = self.options.with_freetype - self._cmake.definitions["ENABLE_FONTCONFIG"] = False - self._cmake.definitions["ENABLE_WEBP"] = False - if Version(self.version) >= "2.3.2": - self._cmake.definitions["ENABLE_HEIF"] = False - self._cmake.definitions["ENABLE_AVIF"] = False - if Version(self.version) >= "2.3.0": - self._cmake.definitions["ENABLE_RAQM"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def build(self): self._patch() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - 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() + 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.names["pkg_config"]= "gdlib" - self.cpp_info.libs = collect_libs(self) + prefix_libs = "lib" if self.settings.os == "Windows" else "" + suffix_libs = "_static" if self.settings.os == "Windows" and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix_libs}gd{suffix_libs}"] + self.cpp_info.set_property("pkg_config_name", "gdlib") + if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.defines.append("BGD_NONDLL") self.cpp_info.defines.append("BGDWIN32") @@ -133,3 +133,6 @@ 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) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["pkg_config"]= "gdlib" diff --git a/recipes/libgd/all/patches/2.3.3-qualify-nondll.patch b/recipes/libgd/all/patches/2.3.3-qualify-nondll.patch new file mode 100644 index 00000000000000..8dfcac14807e1b --- /dev/null +++ b/recipes/libgd/all/patches/2.3.3-qualify-nondll.patch @@ -0,0 +1,26 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 3839bc7..3b271a8 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -86,7 +86,7 @@ if (WIN32 AND NOT MINGW AND NOT MSYS) + # SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib") + + if (BUILD_STATIC_LIBS) +- SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1) ++ SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS BGD_NONDLL=1) + endif() + + ENDIF(WIN32 AND NOT MINGW AND NOT MSYS) +diff --git a/src/gd.h b/src/gd.h +index 3056039..e3635ab 100644 +--- a/src/gd.h ++++ b/src/gd.h +@@ -47,7 +47,7 @@ extern "C" { + /* http://gcc.gnu.org/wiki/Visibility */ + #if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE) + # ifdef BGDWIN32 +-# ifdef NONDLL ++# ifdef BGD_NONDLL + # define BGD_EXPORT_DATA_PROT + # else + # ifdef __GNUC__ diff --git a/recipes/libgd/all/test_package/CMakeLists.txt b/recipes/libgd/all/test_package/CMakeLists.txt index e4f67d2408b0ac..bc37e91faebeb9 100644 --- a/recipes/libgd/all/test_package/CMakeLists.txt +++ b/recipes/libgd/all/test_package/CMakeLists.txt @@ -1,10 +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(libgd CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE libgd::libgd) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libgd/all/test_package/conanfile.py b/recipes/libgd/all/test_package/conanfile.py index 38f4483872d47f..a9fb96656f2039 100644 --- a/recipes/libgd/all/test_package/conanfile.py +++ b/recipes/libgd/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/libgd/all/test_v1_package/CMakeLists.txt b/recipes/libgd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libgd/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/libgd/all/test_v1_package/conanfile.py b/recipes/libgd/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libgd/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/libgd/config.yml b/recipes/libgd/config.yml index 73437bcaccb055..5343c7968ac522 100644 --- a/recipes/libgd/config.yml +++ b/recipes/libgd/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.3": + folder: all "2.3.2": folder: all "2.3.1": diff --git a/recipes/libiconv/all/conanfile.py b/recipes/libiconv/all/conanfile.py index c2cbe29066cee3..465c95b05f4f35 100644 --- a/recipes/libiconv/all/conanfile.py +++ b/recipes/libiconv/all/conanfile.py @@ -15,7 +15,6 @@ from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc, unix_path from conan.tools.scm import Version -from conans.tools import get_gnu_triplet import os required_conan_version = ">=1.53.0" @@ -85,17 +84,23 @@ def generate(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"): + msvc_version = {"Visual Studio": "12", "msvc": "180"} + if is_msvc(self) and Version(self.settings.compiler.version) >= msvc_version[str(self.settings.compiler)]: + # https://github.com/conan-io/conan/issues/6514 tc.extra_cflags.append("-FS") if cross_building(self) and is_msvc(self): + triplet_arch_windows = {"x86_64": "x86_64", "x86": "i686", "armv8": "aarch64"} # ICU doesn't like GNU triplet of conan for msvc (see https://github.com/conan-io/conan/issues/12546) - host = get_gnu_triplet(str(self.settings.os), str(self.settings.arch), "gcc") - build = get_gnu_triplet(str(self._settings_build.os), str(self._settings_build.arch), "gcc") - tc.configure_args.extend([ - f"--host={host}", - f"--build={build}", - ]) + host_arch = triplet_arch_windows.get(str(self.settings.arch)) + build_arch = triplet_arch_windows.get(str(self._settings_build.arch)) + + if host_arch and build_arch: + host = f"{host_arch}-w64-mingw32" + build = f"{build_arch}-w64-mingw32" + tc.configure_args.extend([ + f"--host={host}", + f"--build={build}", + ]) tc.generate() if is_msvc(self) or self._is_clang_cl: diff --git a/recipes/libinterpolate/all/conandata.yml b/recipes/libinterpolate/all/conandata.yml new file mode 100644 index 00000000000000..04998351d32b8b --- /dev/null +++ b/recipes/libinterpolate/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "2.6.2": + url: + - "https://github.com/CD3/libInterpolate/archive/refs/tags/2.6.2.tar.gz" + sha256: "42f40c9b77fda6e0c52ed39b522458456e89fb4981d63f812aa158c6f4be8ab0" diff --git a/recipes/libinterpolate/all/conanfile.py b/recipes/libinterpolate/all/conanfile.py new file mode 100644 index 00000000000000..62e7baa6e4ea42 --- /dev/null +++ b/recipes/libinterpolate/all/conanfile.py @@ -0,0 +1,101 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "libinterpolate" + description = "A C++ interpolation library with a simple interface that supports multiple interpolation methods." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/CD3/libInterpolate" + topics = ("math", "spline", "interpolation", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "19.0", + "gcc": "7", + "clang": "4", + "apple-clang": "10", + } + + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.80.0", transitive_headers=True) + self.requires("eigen/3.3.7", transitive_headers=True) + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("libInterpolate currently only supports Linux. Upstream PR's are welcome (https://github.com/CD3/libInterpolate/issues/14).") + + 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.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], strip_root=True) + + def build(self): + pass + + def package(self): + copy( + self, + pattern="LICENSE.md", + 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, "src"), + ) + + def package_id(self): + self.info.clear() + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "libInterpolate") + self.cpp_info.set_property( + "cmake_target_name", "libInterpolate::Interpolate" + ) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "libInterpolate" + self.cpp_info.filenames["cmake_find_package_multi"] = "libInterpolate" + self.cpp_info.names["cmake_find_package"] = "libInterpolate" + self.cpp_info.names["cmake_find_package_multi"] = "libInterpolate" + self.cpp_info.components["Interpolate"].names["cmake_find_package"] = "Interpolate" + self.cpp_info.components["Interpolate"].names["cmake_find_package_multi"] = "Interpolate" + self.cpp_info.components["Interpolate"].requires = ["eigen::eigen","boost::boost"] diff --git a/recipes/libinterpolate/all/test_package/CMakeLists.txt b/recipes/libinterpolate/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..05a0c0e049e56f --- /dev/null +++ b/recipes/libinterpolate/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(libInterpolate REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libInterpolate::Interpolate) diff --git a/recipes/libinterpolate/all/test_package/conanfile.py b/recipes/libinterpolate/all/test_package/conanfile.py new file mode 100644 index 00000000000000..48499fa0989d9c --- /dev/null +++ b/recipes/libinterpolate/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +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 = "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/libinterpolate/all/test_package/test_package.cpp b/recipes/libinterpolate/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..c42798ca5d0d03 --- /dev/null +++ b/recipes/libinterpolate/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include + +#include + +int main(void) +{ + std::vector x(2), y(2); + + x[0] = 0; + x[1] = 1; + y[0] = 10; + y[1] = 20; + + _1D::LinearInterpolator interp; + interp.setData(x, y); + + std::cout << "f(0.5) = " << interp(0.5) << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/libinterpolate/all/test_v1_package/CMakeLists.txt b/recipes/libinterpolate/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..b5b37b01b534cd --- /dev/null +++ b/recipes/libinterpolate/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +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/libinterpolate/all/test_v1_package/conanfile.py b/recipes/libinterpolate/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c492184eec19c2 --- /dev/null +++ b/recipes/libinterpolate/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/libinterpolate/config.yml b/recipes/libinterpolate/config.yml new file mode 100644 index 00000000000000..8296a371553bed --- /dev/null +++ b/recipes/libinterpolate/config.yml @@ -0,0 +1,3 @@ +versions: + "2.6.2": + folder: all diff --git a/recipes/libjpeg/all/conandata.yml b/recipes/libjpeg/all/conandata.yml index 772d543a521400..b147d8fb1dd7dd 100644 --- a/recipes/libjpeg/all/conandata.yml +++ b/recipes/libjpeg/all/conandata.yml @@ -11,7 +11,13 @@ sources: patches: "9e": - patch_file: "patches/0001-9e-libjpeg-add-msvc-dll-support.patch" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" "9d": - patch_file: "patches/0001-libjpeg-add-msvc-dll-support.patch" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" "9c": - patch_file: "patches/0001-libjpeg-add-msvc-dll-support.patch" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" diff --git a/recipes/libjpeg/all/conanfile.py b/recipes/libjpeg/all/conanfile.py index a3daa952b7fe24..bc3d55d6dfc4ab 100644 --- a/recipes/libjpeg/all/conanfile.py +++ b/recipes/libjpeg/all/conanfile.py @@ -9,6 +9,7 @@ import re import shutil + required_conan_version = ">=1.53.0" diff --git a/recipes/libjpeg/all/test_package/CMakeLists.txt b/recipes/libjpeg/all/test_package/CMakeLists.txt index f6e52def001115..7885c9011ac59a 100644 --- a/recipes/libjpeg/all/test_package/CMakeLists.txt +++ b/recipes/libjpeg/all/test_package/CMakeLists.txt @@ -1,18 +1,20 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) -endif() - -find_package(JPEG REQUIRED) +find_package(JPEG REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG) target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) +if (MSVC) + target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) +endif() if(BUILD_TRANSUPP) add_executable(test_transupp test_transupp.c ${LIBJPEG_RES_DIR}/transupp.c) target_link_libraries(test_transupp PRIVATE JPEG::JPEG) target_compile_features(test_transupp PRIVATE c_std_99) + if (MSVC) + target_compile_definitions(test_transupp PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) + endif() endif() diff --git a/recipes/libjpeg/all/test_v1_package/CMakeLists.txt b/recipes/libjpeg/all/test_v1_package/CMakeLists.txt index e6eccdbfe81845..961b416af6b075 100644 --- a/recipes/libjpeg/all/test_v1_package/CMakeLists.txt +++ b/recipes/libjpeg/all/test_v1_package/CMakeLists.txt @@ -4,16 +4,5 @@ project(test_package LANGUAGES C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) -endif() - -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) - -add_executable(test_transupp ../test_package/test_transupp.c "${CONAN_LIBJPEG_ROOT}/res/transupp.c") -target_link_libraries(test_transupp PRIVATE JPEG::JPEG) -target_compile_features(test_transupp PRIVATE c_std_99) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libjpeg/all/test_v1_package/conanfile.py b/recipes/libjpeg/all/test_v1_package/conanfile.py index d9893410defb60..803919e9ca6722 100644 --- a/recipes/libjpeg/all/test_v1_package/conanfile.py +++ b/recipes/libjpeg/all/test_v1_package/conanfile.py @@ -5,7 +5,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "cmake", "cmake_find_package", "cmake_find_package_multi" @property def _test_transupp(self): @@ -14,6 +14,9 @@ def _test_transupp(self): def build(self): cmake = CMake(self) + cmake.definitions["BUILD_TRANSUPP"] = self._test_transupp + if self._test_transupp: + cmake.definitions["LIBJPEG_RES_DIR"] = os.path.join(self.deps_cpp_info["libjpeg"].rootpath, "res").replace("\\", "/") cmake.configure() cmake.build() diff --git a/recipes/libmicrohttpd/all/conandata.yml b/recipes/libmicrohttpd/all/conandata.yml index 0276eb4f1e40eb..ead353a01eb871 100644 --- a/recipes/libmicrohttpd/all/conandata.yml +++ b/recipes/libmicrohttpd/all/conandata.yml @@ -4,9 +4,6 @@ sources: 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" - - patch_file: "patches/0.9.75-0002-allow-release-with-debug-runtime.patch" - patch_description: "Remove RuntimeLibrary from vcxproject + use conantoolchain.props" + - patch_file: "patches/0.9.75-0001-allow-release-with-debug-runtime.patch" + patch_description: "Allow to build Release with Debug runtime" patch_type: "conan" diff --git a/recipes/libmicrohttpd/all/conanfile.py b/recipes/libmicrohttpd/all/conanfile.py index 1811e1503e36c7..82ca43a61b7adc 100644 --- a/recipes/libmicrohttpd/all/conanfile.py +++ b/recipes/libmicrohttpd/all/conanfile.py @@ -1,12 +1,15 @@ -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 import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class LibmicrohttpdConan(ConanFile): @@ -42,12 +45,13 @@ class LibmicrohttpdConan(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC 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 @@ -58,62 +62,45 @@ def config_options(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - 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 layout(self): + basic_layout(self, src_folder="src") def requirements(self): - if self.options.get_safe("with_zlib", False): + if self.options.get_safe("with_zlib"): self.requires("zlib/1.2.13") - if self.options.get_safe("with_https", False): + + def validate(self): + if is_msvc(self) and self.settings.arch not in ("x86", "x86_64"): + raise ConanInvalidConfiguration("Unsupported architecture (only x86 and x86_64 are supported)") + if self.options.get_safe("with_https"): 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): + if not self.conf.get("tools.microsoft.bash:path", 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) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): if is_msvc(self): tc = MSBuildToolchain(self) tc.configuration = self._msvc_configuration + tc.properties["WholeProgramOptimization"] = "false" tc.generate() else: + VirtualBuildEnv(self).generate() + if not cross_building(self): + VirtualRunEnv(self).generate(scope="build") + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - pkg = PkgConfigDeps(self) - pkg.generate() - autotools = AutotoolsToolchain(self) - autotools.configure_args.extend([ + tc.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)}", @@ -125,44 +112,48 @@ def generate(self): "--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() + tc.generate() + AutotoolsDeps(self).generate() @property def _msvc_configuration(self): - return f"{self.settings.build_type}-{'dll' if self.options.shared else 'static'}" + prefix = "Debug" if self.settings.build_type == "Debug" else "Release" + suffix = "dll" if self.options.shared else "static" + return f"{prefix}-{suffix}" @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_platform(self): - return { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - - def _patch_sources(self): - apply_conandata_patches(self) + # TODO: use VS-Any-Version folder once https://github.com/conan-io/conan/pull/12817 available in conan client + return os.path.join(self.source_folder, "w32", "VS2022") def build(self): - self._patch_sources() + apply_conandata_patches(self) if is_msvc(self): + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_file = os.path.join(self._msvc_sln_folder, "libmicrohttpd.vcxproj") + replace_in_file( + self, vcxproj_file, + "true", + "", + ) + toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, vcxproj_file, + "v143", + f"{toolset}", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + #============================== + msbuild = MSBuild(self) msbuild.build_type = self._msvc_configuration - msbuild.platform = self._msvc_platform + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform msbuild.build(sln=os.path.join(self._msvc_sln_folder, "libmicrohttpd.sln"), targets=["libmicrohttpd"]) else: autotools = Autotools(self) @@ -170,22 +161,18 @@ def build(self): autotools.make() def package(self): - copy(self, "COPYING", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - # 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")) + output_dir = os.path.join(self._msvc_sln_folder, "Output") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.h", src=output_dir, dst=os.path.join(self.package_folder, "include"), keep_path=False) 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")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libmicrohttps") 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-0001-allow-release-with-debug-runtime.patch similarity index 79% rename from recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch rename to recipes/libmicrohttpd/all/patches/0.9.75-0001-allow-release-with-debug-runtime.patch index c833862d3cee1e..1f25b932b8a7a9 100644 --- a/recipes/libmicrohttpd/all/patches/0.9.75-0002-allow-release-with-debug-runtime.patch +++ b/recipes/libmicrohttpd/all/patches/0.9.75-0001-allow-release-with-debug-runtime.patch @@ -1,4 +1,3 @@ -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 @@ 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 deleted file mode 100644 index b3dc82df26fa99..00000000000000 --- a/recipes/libmicrohttpd/all/patches/0.9.75-0001-msbuild-RuntimeLibrary.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- 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/conanfile.py b/recipes/libmicrohttpd/all/test_package/conanfile.py index f72d1f660e19fb..98ab55852ad565 100644 --- a/recipes/libmicrohttpd/all/test_package/conanfile.py +++ b/recipes/libmicrohttpd/all/test_package/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" def layout(self): @@ -15,10 +15,6 @@ def 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() diff --git a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt index 0b95e58322269d..0d20897301b68b 100644 --- a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt +++ b/recipes/libmicrohttpd/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") +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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmp3lame/all/conanfile.py b/recipes/libmp3lame/all/conanfile.py index a7f412633c3e7c..2ccdfa9388237d 100644 --- a/recipes/libmp3lame/all/conanfile.py +++ b/recipes/libmp3lame/all/conanfile.py @@ -1,4 +1,5 @@ from conan import ConanFile +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, chdir, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain @@ -155,6 +156,7 @@ def package(self): 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")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["mp3lame"] diff --git a/recipes/libmysqlclient/all/conandata.yml b/recipes/libmysqlclient/all/conandata.yml index 3284d28321c06a..b97a4d30e8770b 100644 --- a/recipes/libmysqlclient/all/conandata.yml +++ b/recipes/libmysqlclient/all/conandata.yml @@ -1,4 +1,9 @@ sources: + "8.0.31": + url: + - "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.31.tar.gz" + - "https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.31.tar.gz" + sha256: "67bb8cba75b28e95c7f7948563f01fb84528fcbb1a35dba839d4ce44fe019baa" "8.0.30": url: - "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.30.tar.gz" @@ -16,6 +21,9 @@ sources: url: "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.17.tar.gz" sha256: "c6e3f38199a77bfd8a4925ca00b252d3b6159b90e4980c7232f1c58d6ca759d6" patches: + "8.0.31": + - patch_file: "patches/0006-fix-cpp20-build-8.0.29.patch" + base_path: "source_subfolder" "8.0.30": - patch_file: "patches/0006-fix-cpp20-build-8.0.29.patch" base_path: "source_subfolder" diff --git a/recipes/libmysqlclient/config.yml b/recipes/libmysqlclient/config.yml index 33b7ea062fadba..7e3ed9bab4222e 100644 --- a/recipes/libmysqlclient/config.yml +++ b/recipes/libmysqlclient/config.yml @@ -1,4 +1,6 @@ versions: + "8.0.31": + folder: all "8.0.30": folder: all "8.0.29": diff --git a/recipes/libpciaccess/all/conandata.yml b/recipes/libpciaccess/all/conandata.yml index a9f6a4bea00576..223034d0c456a9 100644 --- a/recipes/libpciaccess/all/conandata.yml +++ b/recipes/libpciaccess/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.17": + url: "https://www.x.org/archive//individual/lib/libpciaccess-0.17.tar.xz" + sha256: "74283ba3c974913029e7a547496a29145b07ec51732bbb5b5c58d5025ad95b73" "0.16": - url: "https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/archive/libpciaccess-0.16/libpciaccess-libpciaccess-0.16.tar.gz" - sha256: "983b31ab586e3f2da810bd6bcbbcf9d643f8968d2280c6e573fec95b556e971f" + url: "https://www.x.org/archive//individual/lib/libpciaccess-0.16.tar.gz" + sha256: "84413553994aef0070cf420050aa5c0a51b1956b404920e21b81e96db6a61a27" diff --git a/recipes/libpciaccess/all/test_v1_package/conanfile.py b/recipes/libpciaccess/all/test_v1_package/conanfile.py index 75c0cd81d2d2f3..38f4483872d47f 100644 --- a/recipes/libpciaccess/all/test_v1_package/conanfile.py +++ b/recipes/libpciaccess/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/libpciaccess/config.yml b/recipes/libpciaccess/config.yml index 95828182e346dd..5b9c678c9d3927 100644 --- a/recipes/libpciaccess/config.yml +++ b/recipes/libpciaccess/config.yml @@ -1,3 +1,5 @@ versions: + "0.17": + folder: all "0.16": folder: all diff --git a/recipes/libpq/all/conanfile.py b/recipes/libpq/all/conanfile.py index bedadf84e5a0c5..39386dc4ee730b 100644 --- a/recipes/libpq/all/conanfile.py +++ b/recipes/libpq/all/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path, VCVars +from conan.tools.files import replace_in_file, rmdir +from conan.tools.scm import Version import os import glob -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibpqConan(ConanFile): @@ -30,14 +39,6 @@ class LibpqConan(ConanFile): _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 _is_clang8_x86(self): return self.settings.os == "Linux" and \ @@ -50,147 +51,134 @@ 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": - del self.options.fPIC - del self.options.disable_rpath + self.options.rm_safe('fPIC') + self.options.rm_safe('disable_rpath') def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe('fPIC') + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") - - def validate(self): - if self.settings.os == "Windows" and self.settings.compiler == "gcc" and self.options.shared: - raise ConanInvalidConfiguration("static mingw build is not possible") + self.requires("openssl/1.1.1s") def build_requirements(self): - if self._is_msvc: - self.build_requires("strawberryperl/5.30.0.1") - elif self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("strawberryperl/5.32.1.1") + elif 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 source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = ['--without-readline'] - args.append('--without-zlib') - args.append('--with-openssl' if self.options.with_openssl else '--without-openssl') - if tools.cross_building(self) and not self.options.with_openssl: - args.append("--disable-strong-random") - if tools.cross_building(self, skip_x64_x86=True): - args.append("USE_DEV_URANDOM=1") + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if is_msvc(self): + vcvars = VCVars(self) + vcvars.generate() + config = "DEBUG" if self.settings.build_type == "Debug" else "RELEASE" + env = Environment() + env.define("CONFIG", config) + env.vars(self).save_script("conanbuild_msvc") + else: + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.configure_args.append('--without-readline') + tc.configure_args.append('--without-zlib') + tc.configure_args.append('--with-openssl' if self.options.with_openssl else '--without-openssl') + if cross_building(self) and not self.options.with_openssl: + tc.configure_args.append("--disable-strong-random") + if cross_building(self, skip_x64_x86=True): + tc.configure_args.append("USE_DEV_URANDOM=1") if self.settings.os != "Windows" and self.options.disable_rpath: - args.append('--disable-rpath') + tc.configure_args.append('--disable-rpath') if self._is_clang8_x86: - self._autotools.flags.append("-msse2") - with tools.chdir(self._source_subfolder): - self._autotools.configure(args=args) - return self._autotools - - @property - def _make_args(self): - args = [] - if self.settings.os == "Windows": - args.append("MAKE_DLL={}".format(str(self.options.shared).lower())) - return args - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tc.extra_cflags.append("-msse2") + tc.make_args.append(f"DESTDIR={unix_path(self, self.package_folder)}") + if self.settings.os == "Windows": + tc.make_args.append("MAKE_DLL={}".format(str(self.options.shared).lower())) + tc.generate() - if self._is_msvc: + def _patch_sources(self): + if is_msvc(self): # https://www.postgresql.org/docs/8.3/install-win32-libpq.html # https://github.com/postgres/postgres/blob/master/src/tools/msvc/README if not self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "tools", "msvc", "MKvcbuild.pm"), + replace_in_file(self,os.path.join(self.source_folder, "src", "tools", "msvc", "MKvcbuild.pm"), "$libpq = $solution->AddProject('libpq', 'dll', 'interfaces',", "$libpq = $solution->AddProject('libpq', 'lib', 'interfaces',") system_libs = ", ".join(["'{}.lib'".format(lib) for lib in self.deps_cpp_info.system_libs]) - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "tools", "msvc", "Project.pm"), + replace_in_file(self,os.path.join(self.source_folder, "src", "tools", "msvc", "Project.pm"), "libraries => [],", "libraries => [{}],".format(system_libs)) - if self.settings.compiler == "Visual Studio": - runtime = { - "MT": "MultiThreaded", - "MTd": "MultiThreadedDebug", - "MD": "MultiThreadedDLL", - "MDd": "MultiThreadedDebugDLL", - }.get(str(self.settings.compiler.runtime)) - else: - runtime = "MultiThreaded{}{}".format( - "Debug" if self.settings.compiler.runtime_type == "Debug" else "", - "DLL" if self.settings.compiler.runtime == "dynamic" else "", - ) - msbuild_project_pm = os.path.join(self._source_subfolder, "src", "tools", "msvc", "MSBuildProject.pm") - tools.replace_in_file(msbuild_project_pm, "", """ + runtime = { + "MT": "MultiThreaded", + "MTd": "MultiThreadedDebug", + "MD": "MultiThreadedDLL", + "MDd": "MultiThreadedDebugDLL", + }.get(msvc_runtime_flag(self)) + msbuild_project_pm = os.path.join(self.source_folder, "src", "tools", "msvc", "MSBuildProject.pm") + replace_in_file(self,msbuild_project_pm, "", """ $targetmachine """) - tools.replace_in_file(msbuild_project_pm, "'MultiThreadedDebugDLL'", "'%s'" % runtime) - tools.replace_in_file(msbuild_project_pm, "'MultiThreadedDLL'", "'%s'" % runtime) - config_default_pl = os.path.join(self._source_subfolder, "src", "tools", "msvc", "config_default.pl") - solution_pm = os.path.join(self._source_subfolder, "src", "tools", "msvc", "Solution.pm") + replace_in_file(self,msbuild_project_pm, "'MultiThreadedDebugDLL'", "'%s'" % runtime) + replace_in_file(self,msbuild_project_pm, "'MultiThreadedDLL'", "'%s'" % runtime) + config_default_pl = os.path.join(self.source_folder, "src", "tools", "msvc", "config_default.pl") + solution_pm = os.path.join(self.source_folder, "src", "tools", "msvc", "Solution.pm") if self.options.with_openssl: + openssl = self.dependencies["openssl"] for ssl in ["VC\libssl32", "VC\libssl64", "libssl"]: - tools.replace_in_file(solution_pm, + replace_in_file(self,solution_pm, "%s.lib" % ssl, - "%s.lib" % self.deps_cpp_info["openssl"].libs[0]) + "%s.lib" % openssl.libs[0]) for crypto in ["VC\libcrypto32", "VC\libcrypto64", "libcrypto"]: - tools.replace_in_file(solution_pm, + replace_in_file(self,solution_pm, "%s.lib" % crypto, - "%s.lib" % self.deps_cpp_info["openssl"].libs[1]) - tools.replace_in_file(config_default_pl, + "%s.lib" % openssl.libs[1]) + replace_in_file(self,config_default_pl, "openssl => undef", - "openssl => '%s'" % self.deps_cpp_info["openssl"].rootpath.replace("\\", "/")) - with tools.vcvars(self.settings): - config = "DEBUG" if self.settings.build_type == "Debug" else "RELEASE" - with tools.environment_append({"CONFIG": config}): - with tools.chdir(os.path.join(self._source_subfolder, "src", "tools", "msvc")): - self.run("perl build.pl libpq") - if not self.options.shared: - self.run("perl build.pl libpgport") + "openssl => '%s'" % openssl.package_folder.replace("\\", "/")) + + def build(self): + apply_conandata_patches(self) + self._patch_sources() + if is_msvc(self): + with chdir(self, os.path.join(self.source_folder, "src", "tools", "msvc")): + self.run("perl build.pl libpq") + if not self.options.shared: + self.run("perl build.pl libpgport") else: - # relocatable shared lib on macOS - tools.replace_in_file( - os.path.join(self._source_subfolder, "src", "Makefile.shlib"), - "-install_name '$(libdir)/", - "-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( - os.path.join(self._source_subfolder, "configure"), - "#! /bin/sh\n", - "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), - ) - autotools = self._configure_autotools() - with tools.chdir(os.path.join(self._source_subfolder, "src", "backend")): - autotools.make(args=self._make_args, target="generated-headers") - with tools.chdir(os.path.join(self._source_subfolder, "src", "common")): - autotools.make(args=self._make_args) - if tools.Version(self.version) >= "12": - with tools.chdir(os.path.join(self._source_subfolder, "src", "port")): - autotools.make(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "include")): - autotools.make(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "interfaces", "libpq")): - autotools.make(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "bin", "pg_config")): - autotools.make(args=self._make_args) + autotools = Autotools(self) + with chdir(self, os.path.join(self.source_folder)): + autotools.configure() + with chdir(self, os.path.join(self.source_folder, "src", "backend")): + autotools.make(target="generated-headers") + with chdir(self, os.path.join(self.source_folder, "src", "common")): + autotools.make() + with chdir(self, os.path.join(self.source_folder, "src", "include")): + autotools.make() + with chdir(self, os.path.join(self.source_folder, "src", "interfaces", "libpq")): + autotools.make() + if Version(self.version) >= 12: + with chdir(self, os.path.join(self.source_folder, "src", "port")): + autotools.make() + with chdir(self, os.path.join(self.source_folder, "src", "bin", "pg_config")): + autotools.make() def _remove_unused_libraries_from_package(self): if self.options.shared: @@ -204,55 +192,48 @@ def _remove_unused_libraries_from_package(self): os.path.join(self.package_folder, "bin", "*.dll"), os.path.join(self.package_folder, "lib", "libpq*.dylib") ] - if self.settings.os == "Windows": - os.unlink(os.path.join(self.package_folder, "lib", "libpq.dll")) for globi in globs: for file in glob.glob(globi): os.remove(file) def package(self): - self.copy(pattern="COPYRIGHT", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy("*postgres_ext.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*pg_config.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*pg_config_ext.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*libpq-fe.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*libpq-events.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*.h", src=os.path.join(self._source_subfolder, "src", "include", "libpq"), dst=os.path.join("include", "libpq"), keep_path=False) - self.copy("*genbki.h", src=self._source_subfolder, dst=os.path.join("include", "catalog"), keep_path=False) - self.copy("*pg_type.h", src=self._source_subfolder, dst=os.path.join("include", "catalog"), keep_path=False) + copy(self, pattern="COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder, keep_path=False) + if is_msvc(self): + copy(self, pattern="*postgres_ext.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*pg_config.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*pg_config_ext.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*libpq-fe.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*libpq-events.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, os.path.join("include", "libpq")), src=os.path.join(self.source_folder, "src", "include", "libpq"), keep_path=False) + copy(self, pattern="*genbki.h", dst=os.path.join(self.package_folder, os.path.join("include", "catalog")), src=self.source_folder, keep_path=False) + copy(self, pattern="*pg_type.h", dst=os.path.join(self.package_folder, os.path.join("include", "catalog")), src=self.source_folder, keep_path=False) if self.options.shared: - self.copy("**/libpq.dll", src=self._source_subfolder, dst="bin", keep_path=False) - self.copy("**/libpq.lib", src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, pattern="**/libpq.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder, keep_path=False) + copy(self, pattern="**/libpq.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) else: - self.copy("*.lib", src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) else: - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)#self._configure_autotools() - with tools.chdir(os.path.join(self._source_subfolder, "src", "common")): - autotools.install(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "include")): - autotools.install(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "interfaces", "libpq")): - autotools.install(args=self._make_args) - if tools.Version(self.version) >= "12": - with tools.chdir(os.path.join(self._source_subfolder, "src", "port")): - autotools.install(args=self._make_args) - - with tools.chdir(os.path.join(self._source_subfolder, "src", "bin", "pg_config")): - autotools.install(args=self._make_args) + autotools = Autotools(self) + with chdir(self, os.path.join(self.source_folder, "src", "common")): + autotools.install() + with chdir(self, os.path.join(self.source_folder, "src", "include")): + autotools.install() + with chdir(self, os.path.join(self.source_folder, "src", "interfaces", "libpq")): + autotools.install() + if Version(self.version) >= 12: + with chdir(self, os.path.join(self.source_folder, "src", "port")): + autotools.install() + with chdir(self, os.path.join(self.source_folder, "src", "bin", "pg_config")): + autotools.install() self._remove_unused_libraries_from_package() - tools.rmdir(os.path.join(self.package_folder, "include", "postgresql", "server")) - self.copy(pattern="*.h", dst=os.path.join("include", "catalog"), src=os.path.join(self._source_subfolder, "src", "include", "catalog")) - self.copy(pattern="*.h", dst=os.path.join("include", "catalog"), src=os.path.join(self._source_subfolder, "src", "backend", "catalog")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - def _construct_library_name(self, name): - if self._is_msvc: - return "lib{}".format(name) - return name + rmdir(self, os.path.join(self.package_folder, "include", "postgresql", "server")) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include", "catalog"), src=os.path.join(self.build_folder, "src", "include", "catalog"), keep_path=False) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include", "catalog"), src=os.path.join(self.build_folder, "src", "backend", "catalog"), keep_path=False) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -260,35 +241,32 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "PostgreSQL::PostgreSQL") self.cpp_info.set_property("pkg_config_name", "libpq") - self.cpp_info.names["cmake_find_package"] = "PostgreSQL" - self.cpp_info.names["cmake_find_package_multi"] = "PostgreSQL" - self.env_info.PostgreSQL_ROOT = self.package_folder - self.cpp_info.components["pq"].libs = [self._construct_library_name("pq")] + self.cpp_info.components["pq"].libs = [f"{'lib' if is_msvc(self) else ''}pq"] if self.options.with_openssl: self.cpp_info.components["pq"].requires.append("openssl::openssl") if not self.options.shared: - if self._is_msvc: - if tools.Version(self.version) < "12": - self.cpp_info.components["pgport"].libs = ["libpgport"] - self.cpp_info.components["pq"].requires.extend(["pgport"]) - else: + if is_msvc(self): + self.cpp_info.components["pgport"].libs = ["libpgport"] + self.cpp_info.components["pq"].requires.append("pgport") + if Version(self.version) >= "12": self.cpp_info.components["pgcommon"].libs = ["libpgcommon"] - self.cpp_info.components["pgport"].libs = ["libpgport"] - self.cpp_info.components["pq"].requires.extend(["pgport", "pgcommon"]) + self.cpp_info.components["pq"].requires.append("pgcommon") else: - if tools.Version(self.version) < "12": - self.cpp_info.components["pgcommon"].libs = ["pgcommon"] - self.cpp_info.components["pq"].requires.extend(["pgcommon"]) - else: - self.cpp_info.components["pgcommon"].libs = ["pgcommon", "pgcommon_shlib"] + self.cpp_info.components["pgcommon"].libs = ["pgcommon"] + self.cpp_info.components["pq"].requires.append("pgcommon") + if Version(self.version) >= "12": + self.cpp_info.components["pgcommon"].libs.append("pgcommon_shlib") self.cpp_info.components["pgport"].libs = ["pgport", "pgport_shlib"] - self.cpp_info.components["pq"].requires.extend(["pgport", "pgcommon"]) + self.cpp_info.components["pgcommon"].requires.append("pgport") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["pq"].system_libs = ["pthread"] elif self.settings.os == "Windows": self.cpp_info.components["pq"].system_libs = ["ws2_32", "secur32", "advapi32", "shell32", "crypt32", "wldap32"] + + self.cpp_info.names["cmake_find_package"] = "PostgreSQL" + self.cpp_info.names["cmake_find_package_multi"] = "PostgreSQL" diff --git a/recipes/libpq/all/test_package/CMakeLists.txt b/recipes/libpq/all/test_package/CMakeLists.txt index 537d802359b5d9..db0dafd7c09848 100644 --- a/recipes/libpq/all/test_package/CMakeLists.txt +++ b/recipes/libpq/all/test_package/CMakeLists.txt @@ -1,10 +1,6 @@ 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(PostgreSQL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PostgreSQL::PostgreSQL) +target_link_libraries(${PROJECT_NAME} PRIVATE PostgreSQL::PostgreSQL) diff --git a/recipes/libpq/all/test_package/conanfile.py b/recipes/libpq/all/test_package/conanfile.py index 8a563eaeb2264b..e845ae751a3017 100644 --- a/recipes/libpq/all/test_package/conanfile.py +++ b/recipes/libpq/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" + 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 +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/libpq/all/test_v1_package/CMakeLists.txt b/recipes/libpq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..de3b75d9538de0 --- /dev/null +++ b/recipes/libpq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES 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/libpq/all/test_v1_package/conanfile.py b/recipes/libpq/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5f9efeb33878bd --- /dev/null +++ b/recipes/libpq/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" + + 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/libraw/all/CMakeLists.txt b/recipes/libraw/all/CMakeLists.txt index 2022d590fa2a2b..1aba64dbf532a4 100644 --- a/recipes/libraw/all/CMakeLists.txt +++ b/recipes/libraw/all/CMakeLists.txt @@ -1,20 +1,24 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) +project(LibRaw LANGUAGES CXX) -project(LibRaw) +file(GLOB_RECURSE headers "${LIBRAW_SRC_DIR}/libraw/*.h") -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -file(GLOB_RECURSE headers "source_subfolder/libraw/*.h") +if(RAW_LIB_VERSION_STRING VERSION_LESS 0.21) + set(libraw_LIB_SRCS ${LIBRAW_SRC_DIR}/internal/dcraw_common.cpp + ${LIBRAW_SRC_DIR}/internal/dcraw_fileio.cpp + ${LIBRAW_SRC_DIR}/internal/demosaic_packs.cpp + ${LIBRAW_SRC_DIR}/src/libraw_cxx.cpp + ${LIBRAW_SRC_DIR}/src/libraw_c_api.cpp + ${LIBRAW_SRC_DIR}/src/libraw_datastream.cpp + ) +else() + file(GLOB_RECURSE libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_SRC_DIR}/src/*.cpp") -set(sources - "source_subfolder/src/libraw_c_api.cpp" - "source_subfolder/src/libraw_cxx.cpp" - "source_subfolder/src/libraw_datastream.cpp" - "source_subfolder/internal/dcraw_common.cpp" - "source_subfolder/internal/dcraw_fileio.cpp" - "source_subfolder/internal/demosaic_packs.cpp" -) + # Exclude placeholder (stub) implementations + file(GLOB_RECURSE exclude_libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_SRC_DIR}/src/*_ph.cpp") + list(REMOVE_ITEM libraw_LIB_SRCS ${exclude_libraw_LIB_SRCS}) +endif() if(WIN32) add_definitions(-DWIN32) @@ -26,32 +30,41 @@ if(WIN32) endif() endif() -if (TARGET CONAN_PKG::libjpeg OR TARGET CONAN_PKG::libjpeg-turbo) +find_package(JPEG CONFIG) +find_package(libjpeg-turbo CONFIG) +find_package(lcms CONFIG) +find_package(Jasper CONFIG) + +if (TARGET JPEG::JPEG OR TARGET libjpeg-turbo::jpeg OR TARGET libjpeg-turbo::jpeg_static) add_definitions(-DUSE_JPEG -DUSE_JPEG8) endif () -if (TARGET CONAN_PKG::lcms) +if (TARGET lcms::lcms) add_definitions(-DUSE_LCMS2) endif () -if (TARGET CONAN_PKG::jasper) +if (TARGET Jasper::Jasper) add_definitions(-DUSE_JASPER) endif () -add_library(raw ${headers} ${sources}) -set_property(TARGET raw PROPERTY CXX_STANDARD 11) -target_include_directories(raw PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/") +add_library(raw ${headers} ${libraw_LIB_SRCS}) +target_compile_features(raw PRIVATE cxx_std_11) +target_include_directories(raw PUBLIC "${LIBRAW_SRC_DIR}") +set_target_properties(raw PROPERTIES LINKER_LANGUAGE CXX) target_compile_options(raw PUBLIC $<$:/W0>) -if (TARGET CONAN_PKG::libjpeg) - target_link_libraries(raw PUBLIC CONAN_PKG::libjpeg) +if (TARGET JPEG::JPEG) + target_link_libraries(raw PUBLIC JPEG::JPEG) +endif () +if (TARGET libjpeg-turbo::jpeg) + target_link_libraries(raw PUBLIC libjpeg-turbo::jpeg) endif () -if (TARGET CONAN_PKG::libjpeg-turbo) - target_link_libraries(raw PUBLIC CONAN_PKG::libjpeg-turbo) +if (TARGET libjpeg-turbo::jpeg_static) + target_link_libraries(raw PUBLIC libjpeg-turbo::jpeg_static) endif () -if (TARGET CONAN_PKG::lcms) - target_link_libraries(raw PUBLIC CONAN_PKG::lcms) +if (TARGET lcms::lcms) + target_link_libraries(raw PUBLIC lcms::lcms) endif () -if (TARGET CONAN_PKG::jasper) - target_link_libraries(raw PUBLIC CONAN_PKG::jasper) +if (TARGET Jasper::Jasper) + target_link_libraries(raw PUBLIC Jasper::Jasper) endif () -install(DIRECTORY "source_subfolder/libraw" DESTINATION include) +install(DIRECTORY "${LIBRAW_SRC_DIR}/libraw" DESTINATION include) install(TARGETS raw ARCHIVE DESTINATION lib RUNTIME DESTINATION bin LIBRARY DESTINATION lib) diff --git a/recipes/libraw/all/conandata.yml b/recipes/libraw/all/conandata.yml index 47981769832c65..2293cc11d33ee7 100644 --- a/recipes/libraw/all/conandata.yml +++ b/recipes/libraw/all/conandata.yml @@ -1,10 +1,13 @@ sources: - "0.19.5": - url: "https://github.com/LibRaw/LibRaw/archive/0.19.5.tar.gz" - sha256: "9a2a40418e4fb0ab908f6d384ff6f9075f4431f8e3d79a0e44e5a6ea9e75abdc" - "0.20.0": - url: "https://github.com/LibRaw/LibRaw/archive/0.20.0.tar.gz" - sha256: "f38cd2620d5adc32d2c9f51cd0dc66d72c75671f1c81dfd13d30c45c6be80d40" + "0.21.1": + url: "https://github.com/LibRaw/LibRaw/archive/0.21.1.tar.gz" + sha256: "b63d7ffa43463f74afcc02f9083048c231349b41cc9255dec0840cf8a67b52e0" "0.20.2": url: "https://github.com/LibRaw/LibRaw/archive/0.20.2.tar.gz" sha256: "02df7d403b34602b769bb38e5bf7d4258e075eeefbe980b6832e6e1491989d60" + "0.20.0": + url: "https://github.com/LibRaw/LibRaw/archive/0.20.0.tar.gz" + sha256: "f38cd2620d5adc32d2c9f51cd0dc66d72c75671f1c81dfd13d30c45c6be80d40" + "0.19.5": + url: "https://github.com/LibRaw/LibRaw/archive/0.19.5.tar.gz" + sha256: "9a2a40418e4fb0ab908f6d384ff6f9075f4431f8e3d79a0e44e5a6ea9e75abdc" diff --git a/recipes/libraw/all/conanfile.py b/recipes/libraw/all/conanfile.py index 47b1f62f9d69b6..e68c86171e78e4 100644 --- a/recipes/libraw/all/conanfile.py +++ b/recipes/libraw/all/conanfile.py @@ -1,17 +1,19 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.files import get, copy, collect_libs +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os +required_conan_version = ">=1.53.0" + class LibRawConan(ConanFile): name = "libraw" description = "LibRaw is a library for reading RAW files obtained from digital photo cameras (CRW/CR2, NEF, RAF, DNG, and others)." - topics = ["image", "photography", "raw"] + license = "CDDL-1.0", "LGPL-2.1-only" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.libraw.org/" - license = "CDDL-1.0/LGPL-2.1-only" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + topics = ["image", "photography", "raw"] settings = "os", "arch", "compiler", "build_type" - options = { "shared": [True, False], "fPIC": [True, False], @@ -26,12 +28,11 @@ class LibRawConan(ConanFile): "with_lcms": True, "with_jasper": True } - - _cmake = None + exports_sources = ["CMakeLists.txt"] @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": @@ -39,51 +40,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): # TODO: RawSpeed dependency (-DUSE_RAWSPEED) # TODO: DNG SDK dependency (-DUSE_DNGSDK) if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.1") + self.requires("libjpeg-turbo/2.1.4") if self.options.with_lcms: - self.requires("lcms/2.12") + self.requires("lcms/2.14") if self.options.with_jasper: - self.requires("jasper/2.0.33") + self.requires("jasper/4.0.0") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("LibRaw-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RAW_LIB_VERSION_STRING"] = self.version + tc.variables["LIBRAW_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + 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): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - - self.copy("LICENSE.*", src=self._source_subfolder, dst="licenses") def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.defines.append("WIN32") + self.cpp_info.system_libs.append("ws2_32") if not self.options.shared: self.cpp_info.defines.append("LIBRAW_NODLL") diff --git a/recipes/libraw/all/test_package/CMakeLists.txt b/recipes/libraw/all/test_package/CMakeLists.txt index 33ae887aa6aea3..a201657a760805 100644 --- a/recipes/libraw/all/test_package/CMakeLists.txt +++ b/recipes/libraw/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(libraw 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 libraw::libraw) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libraw/all/test_package/conanfile.py b/recipes/libraw/all/test_package/conanfile.py index 4903f1a7e8fa0f..a9fb96656f2039 100644 --- a/recipes/libraw/all/test_package/conanfile.py +++ b/recipes/libraw/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" + 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.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/libraw/all/test_v1_package/CMakeLists.txt b/recipes/libraw/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libraw/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/libraw/all/test_v1_package/conanfile.py b/recipes/libraw/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libraw/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/libraw/config.yml b/recipes/libraw/config.yml index 07ec3840f78d8a..35c98427b7408f 100644 --- a/recipes/libraw/config.yml +++ b/recipes/libraw/config.yml @@ -1,7 +1,9 @@ versions: - "0.19.5": + "0.21.1": + folder: all + "0.20.2": folder: all "0.20.0": folder: all - "0.20.2": + "0.19.5": folder: all diff --git a/recipes/libsafec/all/conanfile.py b/recipes/libsafec/all/conanfile.py index 5e2784dc36adc3..6924adfd04703a 100644 --- a/recipes/libsafec/all/conanfile.py +++ b/recipes/libsafec/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.files import get, rmdir, copy, rm, chdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conans import AutoToolsBuildEnvironment, tools import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibSafeCConan(ConanFile): @@ -18,14 +22,16 @@ class LibSafeCConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "strmax": ["ANY"], + "memmax": ["ANY"], } default_options = { "shared": False, "fPIC": True, + "strmax": 4096, + "memmax": 268435456, } - exports_sources = "patches/*" - _autotools = None @property @@ -42,20 +48,20 @@ 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def build_requirements(self): - self.build_requires("libtool/2.4.6") + self.tool_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") + self.tool_requires("msys2/cci.latest") @property def _supported_compiler(self): compiler = self.settings.compiler - version = tools.Version(self.settings.compiler.version) - if compiler == "Visual Studio": + version = Version(self.settings.compiler.version) + if is_msvc(self): return False if compiler == "gcc" and version < "5": return False @@ -63,14 +69,16 @@ def _supported_compiler(self): def validate(self): if self.settings.os == "Macos" and self.settings.arch == "armv8": - raise ConanInvalidConfiguration("This platform is not yet supported by libsafec (os=Macos arch=armv8)") + raise ConanInvalidConfiguration(f"This platform is not yet supported by {self.ref} (os=Macos arch=armv8)") if not self._supported_compiler: raise ConanInvalidConfiguration( - "libsafec doesn't support {}/{}".format( - self.settings.compiler, self.settings.compiler.version)) + f"{self.ref} doesn't support {self.settings.compiler}-{self.settings.compiler.version}") + + if not str(self.info.options.strmax).isdigit(): + raise ConanException(f"{self.ref} option 'strmax' must be a valid integer number.") 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) def _configure_autotools(self): @@ -84,28 +92,30 @@ def _configure_autotools(self): "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), "--disable-doc", "--disable-Werror", + "--enable-strmax={}".format(self.options.strmax), + "--enable-memmax={}".format(self.options.memmax), ] self._autotools.configure(args=args, configure_dir=self._source_subfolder) return self._autotools def build(self): - with tools.chdir(self._source_subfolder): + with chdir(self, self._source_subfolder): self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True) autotools = self._configure_autotools() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") + copy(self, "COPYING", src=self._source_subfolder, dst=os.path.join(self.package_folder, "licenses")) autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "libsafec")) self.cpp_info.libs = ["safec-{}".format(self.version)] - self.cpp_info.names["pkg_config"] = "libsafec" + self.cpp_info.set_property("pkg_config_name", "libsafec") bin_dir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_dir)) diff --git a/recipes/libserial/all/conandata.yml b/recipes/libserial/all/conandata.yml new file mode 100644 index 00000000000000..6677947184a94b --- /dev/null +++ b/recipes/libserial/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20200930": + url: "https://github.com/crayzeewulf/libserial/archive/1d1e47a2faae0470f93eb291263b0ce7ea119a81.tar.gz" + sha256: "a433b04bd42e8b4504e5e1fbe7ec22b648f2872d3d125e58c17b9c6c1b171bba" diff --git a/recipes/libserial/all/conanfile.py b/recipes/libserial/all/conanfile.py new file mode 100644 index 00000000000000..9415f1c8d2625a --- /dev/null +++ b/recipes/libserial/all/conanfile.py @@ -0,0 +1,92 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + +class LibserialConan(ConanFile): + name = "libserial" + description = "Serial Port Programming in C++" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/crayzeewulf/libserial" + topics = ("serial-ports", "rs232", "usb-serial") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + } + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} support Linux only.") + + if self.info.settings.compiler.cppstd: + 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._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 generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBSERIAL_ENABLE_TESTING"] = False + tc.variables["LIBSERIAL_BUILD_EXAMPLES"] = False + tc.variables["LIBSERIAL_PYTHON_ENABLE"] = False + tc.variables["LIBSERIAL_BUILD_DOCS"] = False + tc.variables["INSTALL_STATIC"] = not self.options.shared + tc.variables["INSTALL_SHARED"] = self.options.shared + tc.generate() + + def build(self): + 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, "share")) + rm(self, "Makefile.am", os.path.join(self.package_folder, "include", "libserial")) + + def package_info(self): + self.cpp_info.libs = ["serial"] + + self.cpp_info.set_property("pkg_config_name", "libserial") + + 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/libserial/all/test_package/CMakeLists.txt b/recipes/libserial/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..c896bd464b19d3 --- /dev/null +++ b/recipes/libserial/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(libserial REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libserial::libserial) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/libserial/all/test_package/conanfile.py b/recipes/libserial/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/libserial/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/libserial/all/test_package/test_package.cpp b/recipes/libserial/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..00c0ba2b470c9b --- /dev/null +++ b/recipes/libserial/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include + +#include +#include + +int main(void) { + using LibSerial::SerialPort ; + using LibSerial::SerialStream ; + + // Instantiate a Serial Port and a Serial Stream object. + SerialPort serial_port ; + SerialStream serial_stream ; + + serial_port.IsOpen(); + serial_stream.IsOpen(); + + return EXIT_SUCCESS; +} diff --git a/recipes/libserial/all/test_v1_package/CMakeLists.txt b/recipes/libserial/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libserial/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/libserial/all/test_v1_package/conanfile.py b/recipes/libserial/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libserial/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/libserial/config.yml b/recipes/libserial/config.yml new file mode 100644 index 00000000000000..27812caf46f4d9 --- /dev/null +++ b/recipes/libserial/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20200930": + folder: all diff --git a/recipes/libsodium/all/conanfile.py b/recipes/libsodium/all/conanfile.py index 48c328202cd684..f895ac1f52b3c6 100644 --- a/recipes/libsodium/all/conanfile.py +++ b/recipes/libsodium/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration, ConanException +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import VirtualBuildEnv -from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, rmdir, copy, rm, replace_in_file +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, 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, MSBuildDeps, MSBuildToolchain, MSBuild, VCVars, unix_path, msvc_runtime_flag, vs_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" class LibsodiumConan(ConanFile): @@ -49,24 +50,12 @@ def config_options(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): - if is_msvc(self): - vs_layout(self) - else: - basic_layout(self, src_folder="src") + basic_layout(self, src_folder="src") def validate(self): if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): @@ -81,136 +70,87 @@ def build_requirements(self): if not self.conf.get("tools.microsoft.bash:path", check_type=str): self.tool_requires("msys2/cci.latest") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): if is_msvc(self): tc = MSBuildToolchain(self) - tc.generate() - tc = MSBuildDeps(self) - tc.generate() - tc = VCVars(self) + tc.configuration = "{}{}".format( + "Debug" if self.settings.build_type == "Debug" else "Release", + "DLL" if self.options.shared else "LIB", + ) tc.generate() else: - tc = AutotoolsToolchain(self) + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" tc.configure_args.append("--enable-soname-versions={}".format(yes_no(self.options.use_soname))) tc.configure_args.append("--enable-pie={}".format(yes_no(self.options.PIE))) - - env = tc.environment() - - # if self._is_mingw: - # add libssp (gcc support library) for some missing symbols (e.g. __strcpy_chk) - # FIXME how do I do this in conan v2? - # autotools.libs.append("ssp") - + if self._is_mingw: + tc.extra_ldflags.append("-lssp") if self.settings.os == "Emscripten": # FIXME: this is an old comment/test, has not been re-tested with conan2 upgrade self.output.warn("os=Emscripten is not tested/supported by this recipe") # FIXME: ./dist-build/emscripten.sh does not respect options of this recipe - - tc.generate(env) - - env = VirtualBuildEnv(self) - env.generate() - - def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + tc.generate() @property def _msvc_sln_folder(self): - if self.settings.compiler == "Visual Studio": - folder = { + sln_folders = { + "Visual Studio": { "10": "vs2010", "11": "vs2012", "12": "vs2013", "14": "vs2015", "15": "vs2017", "16": "vs2019", - } - elif self.settings.compiler == "msvc": - folder = { + }, + "msvc": { + "170": "vs2012", + "180": "vs2013", "190": "vs2015", "191": "vs2017", "192": "vs2019", - } - else: - raise ConanException("Should not call this function with any other compiler") - + }, + } + default_folder = "vs2019" if self.version != "1.0.18": - if self.settings.compiler == "Visual Studio": - folder["17"] = "vs2022" - else: - folder["193"] = "vs2022" + sln_folders["Visual Studio"]["17"] = "vs2022" + sln_folders["msvc"]["193"] = "vs2022" + default_folder = "vs2022" - return folder.get(str(self.settings.compiler.version)) + return sln_folders.get(str(self.settings.compiler), {}).get(str(self.settings.compiler.version), default_folder) - @property - def _msvc_platform(self): - return { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - - # Method copied from xz_utils - def _fix_msvc_platform_toolset(self, vcxproj_file, old_toolset): - platform_toolset = { - "Visual Studio": { - "8": "v80", - "9": "v90", - "10": "v100", - "11": "v110", - "12": "v120", - "14": "v140", - "15": "v141", - "16": "v142", - "17": "v143", - }, - "msvc": { - "170": "v110", - "180": "v120", - "190": "v140", - "191": "v141", - "192": "v142", - "193": "v143", - } - }.get(str(self.settings.compiler), {}).get(str(self.settings.compiler.version)) - if not platform_toolset: - raise ConanException( - f"Unknown platform toolset for {self.settings.compiler} {self.settings.compiler.version}", + def _build_msvc(self): + msvc_sln_folder = os.path.join(self.source_folder, "builds", "msvc", self._msvc_sln_folder) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + if self.version == "1.0.18" and self._msvc_sln_folder == "vs2019": + toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj"), + "v142", + f"{toolset}", ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) replace_in_file( - self, - vcxproj_file, - f"{old_toolset}", - f"{platform_toolset}", + self, os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj"), + "", + f"", ) + #============================== - def _build_msvc(self): - msvc_ver_subfolder = self._msvc_sln_folder or ("vs2022" if self.version != "1.0.18" else "vs2019") - msvc_sln_folder = os.path.join(self.build_folder, self.source_folder, "builds", "msvc", msvc_ver_subfolder) - - msvc_sln_path = os.path.join(msvc_sln_folder, "libsodium.sln") - - # 1.0.18 only supported up to vs2019. Add support for newer toolsets. - if self.version == "1.0.18" and msvc_ver_subfolder == "vs2019": - vcxproj_path = os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj") - self._fix_msvc_platform_toolset(vcxproj_path, "v142") - - build_type = "{}{}".format( + msbuild = MSBuild(self) + msbuild.build_type = "{}{}".format( "Dyn" if self.options.shared else "Static", "Debug" if self.settings.build_type == "Debug" else "Release", ) - - platform = { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - - msbuild = MSBuild(self) - msbuild.build_type = build_type - msbuild.platform = platform - msbuild.build(msvc_sln_path) - + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(msvc_sln_folder, "libsodium.sln")) def build(self): apply_conandata_patches(self) @@ -218,22 +158,25 @@ def build(self): self._build_msvc() else: autotools = Autotools(self) + if self._is_mingw: + autotools.autoreconf() autotools.configure() autotools.make() def package(self): - copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False) + copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) - inc_src = os.path.join(self.source_folder, "src", self.name, "include") - copy(self, "*.h", src=inc_src, dst=os.path.join(self.package_folder, "include"), keep_path=True, excludes=("*/private/*")) + output_dir = os.path.join(self.source_folder, "bin") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + inc_src = os.path.join(self.source_folder, "src", "libsodium", "include") + copy(self, "*.h", src=inc_src, dst=os.path.join(self.package_folder, "include"), excludes=("*/private/*")) else: 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)}"]) + autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libsodium") diff --git a/recipes/libsodium/all/test_package/CMakeLists.txt b/recipes/libsodium/all/test_package/CMakeLists.txt index b1d5e6b147fa44..ffb72d743454e6 100644 --- a/recipes/libsodium/all/test_package/CMakeLists.txt +++ b/recipes/libsodium/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) find_package(libsodium REQUIRED CONFIG) diff --git a/recipes/libsodium/all/test_v1_package/CMakeLists.txt b/recipes/libsodium/all/test_v1_package/CMakeLists.txt index b8e19e1fbee268..0d20897301b68b 100644 --- a/recipes/libsodium/all/test_v1_package/CMakeLists.txt +++ b/recipes/libsodium/all/test_v1_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsodium/all/test_v1_package/conanfile.py b/recipes/libsodium/all/test_v1_package/conanfile.py index 5a299b64446c96..38f4483872d47f 100644 --- a/recipes/libsodium/all/test_v1_package/conanfile.py +++ b/recipes/libsodium/all/test_v1_package/conanfile.py @@ -3,8 +3,8 @@ class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) diff --git a/recipes/libsvtav1/all/conandata.yml b/recipes/libsvtav1/all/conandata.yml new file mode 100644 index 00000000000000..de724043d87d6d --- /dev/null +++ b/recipes/libsvtav1/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.2.1": + url: https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v1.2.1/SVT-AV1-v1.2.1.tar.bz2 + sha256: 805827daa8aedec4f1362b959f377075e2a811680bfc76b6f4fbf2ef4e7101d4 diff --git a/recipes/libsvtav1/all/conanfile.py b/recipes/libsvtav1/all/conanfile.py new file mode 100644 index 00000000000000..ec65f7fe245ee2 --- /dev/null +++ b/recipes/libsvtav1/all/conanfile.py @@ -0,0 +1,98 @@ +import os +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import copy, get, rmdir + +required_conan_version = ">=1.53.0" + + +class SVTAV1Conan(ConanFile): + name = "libsvtav1" + license = "BSD-3-Clause" + description = "An AV1-compliant software encoder/decoder library" + topics = "av1", "codec", "encoder", "ffmpeg", "video" + homepage = "https://gitlab.com/AOMediaCodec/SVT-AV1" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_encoder": [True, False], + "build_decoder": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_encoder": True, + "build_decoder": True, + } + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def build_requirements(self): + if self.settings.arch in ("x86", "x86_64"): + self.tool_requires("nasm/2.15.05") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_APPS"] = False + tc.variables["BUILD_DEC"] = self.options.build_decoder + tc.variables["BUILD_ENC"] = self.options.build_encoder + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + if self.settings.arch in ("x86", "x86_64"): + tc.variables["ENABLE_NASM"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + "LICENSE.md", + self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + copy( + self, + "PATENTS.md", + self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + + cmake = CMake(self) + cmake.configure() + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + if self.options.build_encoder: + self.cpp_info.components["encoder"].libs = ["SvtAv1Enc"] + self.cpp_info.components["encoder"].includedirs = ["include/svt-av1"] + self.cpp_info.components["encoder"].set_property("pkg_config_name", "SvtAv1Enc") + self.cpp_info.components["encoder"].names["pkg_config"] = "SvtAv1Enc" + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"] + if self.options.build_decoder: + self.cpp_info.components["decoder"].libs = ["SvtAv1Dec"] + self.cpp_info.components["decoder"].includedirs = ["include/svt-av1"] + self.cpp_info.components["decoder"].set_property("pkg_config_name", "SvtAv1Dec") + self.cpp_info.components["decoder"].names["pkg_config"] = "SvtAv1Dec" + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"] diff --git a/recipes/libsvtav1/all/test_package/CMakeLists.txt b/recipes/libsvtav1/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..57e131a83ee089 --- /dev/null +++ b/recipes/libsvtav1/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(libsvtav1 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::encoder) +target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::decoder) diff --git a/recipes/libsvtav1/all/test_package/conanfile.py b/recipes/libsvtav1/all/test_package/conanfile.py new file mode 100644 index 00000000000000..f76921cc6be61e --- /dev/null +++ b/recipes/libsvtav1/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + 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) + 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/libsvtav1/all/test_package/test_package.cpp b/recipes/libsvtav1/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..cb808440d268ee --- /dev/null +++ b/recipes/libsvtav1/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include "EbSvtAv1Enc.h" +#include "EbSvtAv1Dec.h" + +#include + +int main() { std::cout << svt_av1_get_version() << "\n"; } diff --git a/recipes/libsvtav1/all/test_v1_package/CMakeLists.txt b/recipes/libsvtav1/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libsvtav1/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/libsvtav1/all/test_v1_package/conanfile.py b/recipes/libsvtav1/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libsvtav1/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/libsvtav1/config.yml b/recipes/libsvtav1/config.yml new file mode 100644 index 00000000000000..b230418434b611 --- /dev/null +++ b/recipes/libsvtav1/config.yml @@ -0,0 +1,3 @@ +versions: + "1.2.1": + folder: all diff --git a/recipes/libsystemd/all/conandata.yml b/recipes/libsystemd/all/conandata.yml index bad16940c7037f..5c8e2c6ade205d 100644 --- a/recipes/libsystemd/all/conandata.yml +++ b/recipes/libsystemd/all/conandata.yml @@ -14,15 +14,18 @@ sources: "251.4": url: "https://github.com/systemd/systemd-stable/archive/v251.4.tar.gz" sha256: "3459239979f52b8c4ace33734d31c2fb69fa13cf81d04b1b982f7d8d4651e015" + "252.4": + url: "https://github.com/systemd/systemd-stable/archive/v252.4.tar.gz" + sha256: "cf2d27e67663d599a045101c7178cf0ec63d9df2962a54adf7de0d0357724f00" patches: "246.16": - patch_file: "patches/246.16/0001-Drop-bundled-copy-of-linux-if_arp.h.patch" patch_description: "fix build error with Linux headers >= 5.14 by removing a bundled copy of it" - patch_type: "backport" + patch_type: "portability" patch_source: "https://github.com/systemd/systemd-stable/commit/06dea04b38ce506c1436cd4fef9bf9919a34f441" - patch_file: "patches/246.16/0002-meson.build-change-operator-combining-bools-from-to-.patch" patch_description: "allow to build with meson >= 0.60.0 by fixing syntax error" - patch_type: "backport" + patch_type: "bugfix" patch_source: "https://github.com/systemd/systemd-stable/commit/3d0666d9091dd097022f02fae79890b5746285c1" - patch_file: "patches/246.16/0003-Remove-dependency-from-coreutils.patch" patch_description: "allow to build in environments without 'realpath --relative-to' by replacing it with conan-specific build variable" @@ -52,3 +55,10 @@ patches: - patch_file: "patches/251.4/0001-Remove-dependency-from-coreutils.patch" patch_description: "allow to build in environments without 'realpath --relative-to' by replacing it with conan-specific build variable" patch_type: "conan" + "252.4": + - patch_file: "patches/248.10/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch" + patch_description: "allow to use meson.build with older versions of Python by replacing utf8 message to ascii message in the helper script" + patch_type: "conan" + - patch_file: "patches/251.4/0001-Remove-dependency-from-coreutils.patch" + patch_description: "allow to build in environments without 'realpath --relative-to' by replacing it with conan-specific build variable" + patch_type: "conan" diff --git a/recipes/libsystemd/config.yml b/recipes/libsystemd/config.yml index 46dd6c53cbb3c2..c1a22f5e0a469c 100644 --- a/recipes/libsystemd/config.yml +++ b/recipes/libsystemd/config.yml @@ -9,3 +9,5 @@ versions: folder: all "251.4": folder: all + "252.4": + folder: all diff --git a/recipes/libunwind/all/conanfile.py b/recipes/libunwind/all/conanfile.py index ffee26f9f18537..a3d3087179b7ac 100644 --- a/recipes/libunwind/all/conanfile.py +++ b/recipes/libunwind/all/conanfile.py @@ -107,7 +107,7 @@ def package(self): shutil.copy(source_path, symlink_path) def package_info(self): - self.cpp_info.components["unwind"].names["pkg_config"] = "libunwind" + self.cpp_info.components["unwind"].set_property("pkg_config_name", "libunwind") self.cpp_info.components["unwind"].libs = ["unwind"] if self.options.minidebuginfo: self.cpp_info.components["unwind"].requires.append("xz_utils::xz_utils") @@ -115,18 +115,18 @@ def package_info(self): self.cpp_info.components["unwind"].requires.append("zlib::zlib") if self.settings.os == "Linux": self.cpp_info.components["unwind"].system_libs.append("pthread") - self.cpp_info.components["generic"].names["pkg_config"] = "libunwind-generic" + self.cpp_info.components["generic"].set_property("pkg_config_name", "libunwind-generic") self.cpp_info.components["generic"].libs = ["unwind-generic"] self.cpp_info.components["generic"].requires = ["unwind"] if self.options.ptrace: - self.cpp_info.components["ptrace"].names["pkg_config"] = "libunwind-ptrace" + self.cpp_info.components["ptrace"].set_property("pkg_config_name", "libunwind-ptrace") self.cpp_info.components["ptrace"].libs = ["unwind-ptrace"] self.cpp_info.components["ptrace"].requires = ["generic", "unwind"] if self.options.setjmp: - self.cpp_info.components["setjmp"].names["pkg_config"] = "libunwind-setjmp" + self.cpp_info.components["setjmp"].set_property("pkg_config_name", "libunwind-setjmp") self.cpp_info.components["setjmp"].libs = ["unwind-setjmp"] self.cpp_info.components["setjmp"].requires = ["unwind"] if self.options.coredump: - self.cpp_info.components["coredump"].names["pkg_config"] = "libunwind-coredump" + self.cpp_info.components["coredump"].set_property("pkg_config_name", "libunwind-coredump") self.cpp_info.components["coredump"].libs = ["unwind-coredump"] self.cpp_info.components["coredump"].requires = ["generic", "unwind"] diff --git a/recipes/libusb/all/conandata.yml b/recipes/libusb/all/conandata.yml index 77c9b6023c5e86..447075d3a8df87 100644 --- a/recipes/libusb/all/conandata.yml +++ b/recipes/libusb/all/conandata.yml @@ -1,13 +1,30 @@ sources: - "1.0.23": - sha256: db11c06e958a82dac52cf3c65cb4dd2c3f339c8a988665110e0d24d19312ad8d - url: https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.tar.bz2 - "1.0.24": - sha256: 7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a - url: https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.tar.bz2 + "1.0.26": + url: "https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2" + sha256: "12ce7a61fc9854d1d2a1ffe095f7b5fac19ddba095c259e6067a46500381b5a5" "1.0.25": - sha256: 8a28ef197a797ebac2702f095e81975e2b02b2eeff2774fa909c78a74ef50849 - url: https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.tar.bz2 + url: "https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.tar.bz2" + sha256: "8a28ef197a797ebac2702f095e81975e2b02b2eeff2774fa909c78a74ef50849" + "1.0.24": + url: "https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.tar.bz2" + sha256: "7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a" + "1.0.23": + url: "https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.tar.bz2" + sha256: "db11c06e958a82dac52cf3c65cb4dd2c3f339c8a988665110e0d24d19312ad8d" +patches: "1.0.26": - sha256: 12ce7a61fc9854d1d2a1ffe095f7b5fac19ddba095c259e6067a46500381b5a5 - url: https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 + - patch_file: "patches/1.0.24-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" + "1.0.25": + - patch_file: "patches/1.0.24-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" + "1.0.24": + - patch_file: "patches/1.0.24-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" + "1.0.23": + - patch_file: "patches/1.0.23-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" diff --git a/recipes/libusb/all/conanfile.py b/recipes/libusb/all/conanfile.py index 0c93d90aac203b..60d9abeb38bd01 100644 --- a/recipes/libusb/all/conanfile.py +++ b/recipes/libusb/all/conanfile.py @@ -1,13 +1,14 @@ from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.microsoft import is_msvc -from conan.tools.files import get, chdir, rmdir, rm, replace_in_file +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 Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain from conan.tools.scm import Version -from conans import AutoToolsBuildEnvironment, MSBuild, tools import os -import re -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.54.0" class LibUSBConan(ConanFile): @@ -16,8 +17,8 @@ class LibUSBConan(ConanFile): license = "LGPL-2.1" homepage = "https://github.com/libusb/libusb" url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "libusb", "usb", "device") - settings = "os", "compiler", "build_type", "arch" + topics = ("usb", "device") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,11 +29,6 @@ class LibUSBConan(ConanFile): "fPIC": True, "enable_udev": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _is_mingw(self): @@ -40,7 +36,14 @@ def _is_mingw(self): @property def _settings_build(self): - return self.settings_build if hasattr(self, "settings_build") else self.settings + return getattr(self, "settings_build", self.settings) + + @property + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,97 +56,86 @@ 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): - 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") + basic_layout(self, src_folder="src") def requirements(self): if self.settings.os == "Linux": if self.options.enable_udev: self.requires("libudev/system") + 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", check_type=str): + self.tool_requires("msys2/cci.latest") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _build_visual_studio(self): - with chdir(self, self._source_subfolder): - # Assume we're using the latest Visual Studio and default to libusb_2019.sln - # (or libusb_2017.sln for libusb < 1.0.24). - # If we're not using the latest Visual Studio, select an appropriate solution file. - solution_msvc_year = 2019 if Version(self.version) >= "1.0.24" else 2017 - - solution_msvc_year = { - "11": 2012, - "12": 2013, - "14": 2015, - "15": 2017 - }.get(str(self.settings.compiler.version), solution_msvc_year) - - solution_file = os.path.join("msvc", "libusb_{}.sln".format(solution_msvc_year)) - platforms = {"x86":"Win32"} - properties = { - # Enable LTO when CFLAGS contains -GL - "WholeProgramOptimization": "true" if any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))) else "false", - } - msbuild = MSBuild(self) - build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - msbuild.build(solution_file, platforms=platforms, upgrade_project=False, properties=properties, build_type=build_type) - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - configure_args = ["--enable-shared" if self.options.shared else "--disable-shared"] - configure_args.append("--enable-static" if not self.options.shared else "--disable-static") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + else: + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) if self.settings.os in ["Linux", "Android"]: - configure_args.append("--enable-udev" if self.options.enable_udev else "--disable-udev") - elif self._is_mingw: - if self.settings.arch == "x86_64": - configure_args.append("--host=x86_64-w64-mingw32") - elif self.settings.arch == "x86": - configure_args.append("--build=i686-w64-mingw32") - configure_args.append("--host=i686-w64-mingw32") - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return self._autotools + tc.configure_args.append("--enable-udev" if self.options.enable_udev else "--disable-udev") + tc.generate() def build(self): + apply_conandata_patches(self) if is_msvc(self): - if Version(self.version) < "1.0.24": - for vcxproj in ["fxload_2017", "getopt_2017", "hotplugtest_2017", "libusb_dll_2017", - "libusb_static_2017", "listdevs_2017", "stress_2017", "testlibusb_2017", "xusb_2017"]: - vcxproj_path = os.path.join(self._source_subfolder, "msvc", "%s.vcxproj" % vcxproj) - replace_in_file(self, vcxproj_path, "10.0.16299.0", "") - self._build_visual_studio() - else: - autotools = self._configure_autotools() - autotools.make() + solution_msvc_year = "2017" if Version(self.version) < "1.0.24" else "2019" + solution = f"libusb_{'dll' if self.options.shared else 'static'}_{solution_msvc_year}.vcxproj" + vcxproj_path = os.path.join(self.source_folder, "msvc", solution) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + replace_in_file( + self, vcxproj_path, + "true", + "", + ) + old_toolset = "v141" if Version(self.version) < "1.0.24" else "v142" + new_toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, vcxproj_path, + f"{old_toolset}", + f"{new_toolset}", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, vcxproj_path, + "", + f"", + ) + #============================== - def _package_visual_studio(self): - self.copy(pattern="libusb.h", dst=os.path.join("include", "libusb-1.0"), src=os.path.join(self._source_subfolder, "libusb"), keep_path=False) - arch = "x64" if self.settings.arch == "x86_64" else "Win32" - source_dir = os.path.join(self._source_subfolder, arch, str(self.settings.build_type), "dll" if self.options.shared else "lib") - if self.options.shared: - self.copy(pattern="libusb-1.0.dll", dst="bin", src=source_dir, keep_path=False) - self.copy(pattern="libusb-1.0.lib", dst="lib", src=source_dir, keep_path=False) - self.copy(pattern="libusb-usbdk-1.0.dll", dst="bin", src=source_dir, keep_path=False) - self.copy(pattern="libusb-usbdk-1.0.lib", dst="lib", src=source_dir, keep_path=False) + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.build(vcxproj_path) else: - self.copy(pattern="libusb-1.0.lib", dst="lib", src=source_dir, keep_path=False) - self.copy(pattern="libusb-usbdk-1.0.lib", dst="lib", src=source_dir, keep_path=False) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses", keep_path=False) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - self._package_visual_studio() + copy(self, "libusb.h", src=os.path.join(self.source_folder, "libusb"), + dst=os.path.join(self.package_folder, "include", "libusb-1.0")) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) else: - autotools = self._configure_autotools() + 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")) @@ -151,7 +143,8 @@ def package(self): def package_info(self): self.cpp_info.set_property("pkg_config_name", "libusb-1.0") - self.cpp_info.libs = tools.collect_libs(self) + prefix = "lib" if is_msvc(self) else "" + self.cpp_info.libs = [f"{prefix}usb-1.0"] self.cpp_info.includedirs.append(os.path.join("include", "libusb-1.0")) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") diff --git a/recipes/libusb/all/patches/1.0.23-0001-relax-windows-sdk-restriction.patch b/recipes/libusb/all/patches/1.0.23-0001-relax-windows-sdk-restriction.patch new file mode 100644 index 00000000000000..1c12693d1700c2 --- /dev/null +++ b/recipes/libusb/all/patches/1.0.23-0001-relax-windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/msvc/libusb_dll_2017.vcxproj ++++ b/msvc/libusb_dll_2017.vcxproj +@@ -38,7 +38,6 @@ + libusb-1.0 (dll) + {349EE8FA-7D25-4909-AAF5-FF3FADE72187} + libusbdll +- 10.0.16299.0 + true + true + +--- a/msvc/libusb_static_2017.vcxproj ++++ b/msvc/libusb_static_2017.vcxproj +@@ -38,7 +38,6 @@ + libusb-1.0 (static) + {349EE8F9-7D25-4909-AAF5-FF3FADE72187} + libusb +- 10.0.16299.0 + true + true + diff --git a/recipes/libusb/all/patches/1.0.24-0001-relax-windows-sdk-restriction.patch b/recipes/libusb/all/patches/1.0.24-0001-relax-windows-sdk-restriction.patch new file mode 100644 index 00000000000000..a45db143ab1b1e --- /dev/null +++ b/recipes/libusb/all/patches/1.0.24-0001-relax-windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/msvc/libusb_dll_2019.vcxproj ++++ b/msvc/libusb_dll_2019.vcxproj +@@ -40,7 +40,6 @@ + libusbdll + true + true +- 10.0 + + + +--- a/msvc/libusb_static_2019.vcxproj ++++ b/msvc/libusb_static_2019.vcxproj +@@ -40,7 +40,6 @@ + libusb + true + true +- 10.0 + + + diff --git a/recipes/libusb/all/test_package/CMakeLists.txt b/recipes/libusb/all/test_package/CMakeLists.txt index a5ffd526aaea76..968df07ffe10ad 100644 --- a/recipes/libusb/all/test_package/CMakeLists.txt +++ b/recipes/libusb/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(libusb REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libusb::libusb) diff --git a/recipes/libusb/all/test_package/conanfile.py b/recipes/libusb/all/test_package/conanfile.py index 3695635f5e0f5d..98ab55852ad565 100644 --- a/recipes/libusb/all/test_package/conanfile.py +++ b/recipes/libusb/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 = "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,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/libusb/all/test_package/test_package.c b/recipes/libusb/all/test_package/test_package.c index 89a9b8ba85b345..0ccc95e9223f01 100644 --- a/recipes/libusb/all/test_package/test_package.c +++ b/recipes/libusb/all/test_package/test_package.c @@ -1,21 +1,18 @@ -#include "libusb-1.0/libusb.h" - +#include int main(int argc, char *argv[]) { - libusb_device **devs; - ssize_t cnt; - int r, i; + libusb_device **devs; - r = libusb_init(NULL); - if (r < 0) - return r; + int r = libusb_init(NULL); + if (r < 0) + return r; - cnt = libusb_get_device_list(NULL, &devs); - if (cnt < 0) - return (int)cnt; + ssize_t cnt = libusb_get_device_list(NULL, &devs); + if (cnt < 0) + return (int)cnt; - libusb_free_device_list(devs, 1); - libusb_exit(NULL); + libusb_free_device_list(devs, 1); + libusb_exit(NULL); - return 0; + return 0; } diff --git a/recipes/libusb/all/test_v1_package/CMakeLists.txt b/recipes/libusb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libusb/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/libusb/all/test_v1_package/conanfile.py b/recipes/libusb/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..81f9e01d9be5d6 --- /dev/null +++ b/recipes/libusb/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/libusb/config.yml b/recipes/libusb/config.yml index 8c9d67d1012f2c..21a7ffcef562b2 100644 --- a/recipes/libusb/config.yml +++ b/recipes/libusb/config.yml @@ -1,10 +1,9 @@ ---- versions: - "1.0.23": - folder: all - "1.0.24": + "1.0.26": folder: all "1.0.25": folder: all - "1.0.26": + "1.0.24": + folder: all + "1.0.23": folder: all diff --git a/recipes/libuvc/all/CMakeLists.txt b/recipes/libuvc/all/CMakeLists.txt deleted file mode 100644 index c986d294c75479..00000000000000 --- a/recipes/libuvc/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/libuvc/all/conandata.yml b/recipes/libuvc/all/conandata.yml index 2a11d1f42776b2..080f9c58fdbad1 100644 --- a/recipes/libuvc/all/conandata.yml +++ b/recipes/libuvc/all/conandata.yml @@ -4,7 +4,9 @@ sources: sha256: "42175a53c1c704365fdc782b44233925e40c9344fbb7f942181c1090f06e2873" patches: "0.0.6": - - patch_file: "patches/0001-adjust-libusb.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-adjust-libusb-libjpeg.patch" + patch_description: "Robust discovery and injection of libusb & libjpeg" + patch_type: "conan" - patch_file: "patches/0002-adjust-install-folder.patch" - base_path: "source_subfolder" + patch_description: "Install to standard layout" + patch_type: "conan" diff --git a/recipes/libuvc/all/conanfile.py b/recipes/libuvc/all/conanfile.py index 3dc2f88c2a0c93..17b10736856bfd 100644 --- a/recipes/libuvc/all/conanfile.py +++ b/recipes/libuvc/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.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, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibuvcConan(ConanFile): name = "libuvc" description = "A cross-platform library for USB video devices" - topics = ("libuvc", "libusb", "usb", "video") + topics = ("libusb", "usb", "video") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/libuvc/libuvc" @@ -17,33 +22,18 @@ class LibuvcConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "jpeg_turbo": [True, False], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], + "jpeg_turbo": [True, False, "deprecated"], } default_options = { "shared": False, "fPIC": True, - "jpeg_turbo": False, + "with_jpeg": "libjpeg", + "jpeg_turbo": "deprecated", } - 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": @@ -51,55 +41,90 @@ 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + # TODO: to remove once deprecated jpeg_turbo option removed + if self.options.jpeg_turbo != "deprecated": + self.output.warning("jpeg_turbo option is deprecated, please use with_jpeg option instead") + if self.options.jpeg_turbo: + self.options.with_jpeg == "libjpeg-turbo" + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libusb/1.0.24") - if self.options.jpeg_turbo: - self.requires("libjpeg-turbo/2.1.2") - else: - self.requires("libjpeg/9d") + self.requires("libusb/1.0.26") + 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 package_id(self): + # TODO: to remove once deprecated jpeg_turbo option removed + del self.info.options.jpeg_turbo def validate(self): - if self._is_msvc: + if is_msvc(self): # Upstream issues, e.g.: # https://github.com/libuvc/libuvc/issues/100 # https://github.com/libuvc/libuvc/issues/105 raise ConanInvalidConfiguration("libuvc is not compatible with Visual Studio.") + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + 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 generate(self): + VirtualBuildEnv(self).generate() + + tc = CMakeToolchain(self) + tc.variables["CMAKE_BUILD_TARGET"] = "Shared" if self.options.shared else "Static" + tc.variables["LIBUVC_WITH_JPEG"] = bool(self.options.with_jpeg) + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_BUILD_TARGET"] = "Shared" if self.options.shared else "Static" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + CMakeDeps(self).generate() + PkgConfigDeps(self).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): - 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.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() - 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")) def package_info(self): cmake_target = "UVCShared" if self.options.shared else "UVCStatic" self.cpp_info.set_property("cmake_file_name", "libuvc") - self.cpp_info.set_property("cmake_target_name", "LibUVC::{}".format(cmake_target)) + self.cpp_info.set_property("cmake_target_name", f"LibUVC::{cmake_target}") self.cpp_info.set_property("pkg_config_name", "libuvc") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["_libuvc"].libs = tools.collect_libs(self) + self.cpp_info.components["_libuvc"].libs = ["uvc"] + self.cpp_info.components["_libuvc"].requires = ["libusb::libusb"] + if self.options.with_jpeg == "libjpeg": + self.cpp_info.components["_libuvc"].requires.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + self.cpp_info.components["_libuvc"].requires.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + self.cpp_info.components["_libuvc"].requires.append("mozjpeg::libjpeg") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "libuvc" @@ -108,9 +133,5 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "LibUVC" self.cpp_info.components["_libuvc"].names["cmake_find_package"] = cmake_target self.cpp_info.components["_libuvc"].names["cmake_find_package_multi"] = cmake_target - self.cpp_info.components["_libuvc"].set_property("cmake_target_name", "LibUVC::{}".format(cmake_target)) + self.cpp_info.components["_libuvc"].set_property("cmake_target_name", f"LibUVC::{cmake_target}") self.cpp_info.components["_libuvc"].set_property("pkg_config_name", "libuvc") - self.cpp_info.components["_libuvc"].requires = [ - "libusb::libusb", - "libjpeg-turbo::libjpeg-turbo" if self.options.jpeg_turbo else "libjpeg::libjpeg" - ] diff --git a/recipes/libuvc/all/patches/0001-adjust-libusb-libjpeg.patch b/recipes/libuvc/all/patches/0001-adjust-libusb-libjpeg.patch new file mode 100644 index 00000000000000..7becb18ff92a3b --- /dev/null +++ b/recipes/libuvc/all/patches/0001-adjust-libusb-libjpeg.patch @@ -0,0 +1,63 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -19,13 +19,16 @@ set(libuvc_VERSION ${libuvc_VERSION_MAJOR}.${libuvc_VERSION_MINOR}.${libuvc_VERS + set(libuvc_DESCRIPTION "A cross-platform library for USB video devices") + set(libuvc_URL "https://github.com/ktossell/libuvc") + +-find_package(PkgConfig) ++find_package(PkgConfig REQUIRED) + pkg_check_modules(LIBUSB libusb-1.0) ++link_directories(${LIBUSB_LIBRARY_DIRS}) + + # Try to find JPEG using a module or pkg-config. If that doesn't work, search for the header. +-find_package(jpeg QUIET) +-if(JPEG_FOUND) +- set(JPEG_LINK_FLAGS ${JPEG_LIBRARIES}) ++option(LIBUVC_WITH_JPEG "Support JPEG decoding" ON) ++if(LIBUVC_WITH_JPEG) ++find_package(JPEG REQUIRED) ++if(1) ++ set(JPEG_LINK_FLAGS JPEG::JPEG) + else() + pkg_check_modules(JPEG QUIET libjpeg) + if(JPEG_FOUND) +@@ -39,6 +42,7 @@ else() + endif() + endif() + endif() ++endif() + + include(GNUInstallDirs) + +@@ -57,7 +61,7 @@ include_directories( + ${LIBUSB_INCLUDE_DIRS} + ) + +-if(JPEG_FOUND) ++if(LIBUVC_WITH_JPEG) + message(STATUS "Building libuvc with JPEG support.") + include_directories(${JPEG_INCLUDE_DIR}) + SET(LIBUVC_HAS_JPEG TRUE) +@@ -84,6 +88,10 @@ endif() + + if(BUILD_UVC_STATIC) + add_library(uvc_static STATIC ${SOURCES}) ++ target_link_libraries(uvc_static ${LIBUSB_LIBRARIES}) ++ if(LIBUVC_WITH_JPEG) ++ target_link_libraries(uvc_static ${JPEG_LINK_FLAGS}) ++ endif() + set_target_properties(uvc_static PROPERTIES OUTPUT_NAME uvc) + list(APPEND UVC_TARGETS uvc_static) + endif() +@@ -97,9 +105,9 @@ foreach(target_name ${UVC_TARGETS}) + endforeach() + + if(BUILD_UVC_SHARED) +- if(JPEG_FOUND) ++ if(LIBUVC_WITH_JPEG) + target_link_libraries (uvc ${JPEG_LINK_FLAGS}) +- endif(JPEG_FOUND) ++ endif() + + target_link_libraries(uvc ${LIBUSB_LIBRARIES}) + diff --git a/recipes/libuvc/all/patches/0001-adjust-libusb.patch b/recipes/libuvc/all/patches/0001-adjust-libusb.patch deleted file mode 100644 index 24c0fe99c85a73..00000000000000 --- a/recipes/libuvc/all/patches/0001-adjust-libusb.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a19209d..581a308 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -19,26 +19,9 @@ set(libuvc_VERSION ${libuvc_VERSION_MAJOR}.${libuvc_VERSION_MINOR}.${libuvc_VERS - set(libuvc_DESCRIPTION "A cross-platform library for USB video devices") - set(libuvc_URL "https://github.com/ktossell/libuvc") - --find_package(PkgConfig) --pkg_check_modules(LIBUSB libusb-1.0) -- - # Try to find JPEG using a module or pkg-config. If that doesn't work, search for the header. --find_package(jpeg QUIET) --if(JPEG_FOUND) -- set(JPEG_LINK_FLAGS ${JPEG_LIBRARIES}) --else() -- pkg_check_modules(JPEG QUIET libjpeg) -- if(JPEG_FOUND) -- set(JPEG_INCLUDE_DIR ${JPEG_INCLUDE_DIRS}) -- set(JPEG_LINK_FLAGS ${JPEG_LDFLAGS}) -- else() -- find_path(JPEG_INCLUDE_DIR jpeglib.h) -- if(JPEG_INCLUDE_DIR) -- set(JPEG_FOUND ON) -- set(JPEG_LINK_FLAGS -ljpeg) -- endif() -- endif() --endif() -+find_package(JPEG QUIET) -+set(JPEG_LINK_FLAGS ${JPEG_LIBRARIES}) - - include(GNUInstallDirs) - -@@ -54,7 +37,7 @@ SET(SOURCES src/ctrl.c src/ctrl-gen.c src/device.c src/diag.c - include_directories( - ${libuvc_SOURCE_DIR}/include - ${libuvc_BINARY_DIR}/include -- ${LIBUSB_INCLUDE_DIRS} -+ ${CONAN_INCLUDE_DIRS_LIBUSB} - ) - - if(JPEG_FOUND) -@@ -101,7 +84,7 @@ if(BUILD_UVC_SHARED) - target_link_libraries (uvc ${JPEG_LINK_FLAGS}) - endif(JPEG_FOUND) - -- target_link_libraries(uvc ${LIBUSB_LIBRARIES}) -+ target_link_libraries(uvc ${CONAN_LIBS_LIBUSB}) - - #add_executable(test src/test.c) - #target_link_libraries(test uvc ${LIBUSB_LIBRARIES} opencv_highgui diff --git a/recipes/libuvc/all/patches/0002-adjust-install-folder.patch b/recipes/libuvc/all/patches/0002-adjust-install-folder.patch index 6f0177f681d0a4..aa773f521427f6 100644 --- a/recipes/libuvc/all/patches/0002-adjust-install-folder.patch +++ b/recipes/libuvc/all/patches/0002-adjust-install-folder.patch @@ -1,16 +1,16 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 581a308..c3ccfa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -93,8 +93,9 @@ endif() +@@ -118,9 +118,10 @@ endif() install(TARGETS ${UVC_TARGETS} EXPORT libuvcTargets - LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}" -+ LIBRARY DESTINATION "lib" -+ ARCHIVE DESTINATION "lib" -+ RUNTIME DESTINATION "bin" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libuvc" +- PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libuvc" ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libuvc ) + export(TARGETS ${UVC_TARGETS} diff --git a/recipes/libuvc/all/test_package/CMakeLists.txt b/recipes/libuvc/all/test_package/CMakeLists.txt index 014804b013c2d5..ff4548b24f2950 100644 --- a/recipes/libuvc/all/test_package/CMakeLists.txt +++ b/recipes/libuvc/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) find_package(libuvc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET LibUVC::UVCShared) - target_link_libraries(${PROJECT_NAME} LibUVC::UVCShared) + target_link_libraries(${PROJECT_NAME} PRIVATE LibUVC::UVCShared) else() - target_link_libraries(${PROJECT_NAME} LibUVC::UVCStatic) + target_link_libraries(${PROJECT_NAME} PRIVATE LibUVC::UVCStatic) endif() diff --git a/recipes/libuvc/all/test_package/conanfile.py b/recipes/libuvc/all/test_package/conanfile.py index 38f4483872d47f..98ab55852ad565 100644 --- a/recipes/libuvc/all/test_package/conanfile.py +++ b/recipes/libuvc/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 = "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,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/libuvc/all/test_v1_package/CMakeLists.txt b/recipes/libuvc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/libuvc/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/libuvc/all/test_v1_package/conanfile.py b/recipes/libuvc/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/libuvc/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/libwebp/all/conandata.yml b/recipes/libwebp/all/conandata.yml index 73b2540022f74c..ef43b815c4921d 100644 --- a/recipes/libwebp/all/conandata.yml +++ b/recipes/libwebp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.0": + url: "https://github.com/webmproject/libwebp/archive/v1.3.0.tar.gz" + sha256: "dc9860d3fe06013266c237959e1416b71c63b36f343aae1d65ea9c94832630e1" "1.2.4": url: "https://github.com/webmproject/libwebp/archive/v1.2.4.tar.gz" sha256: "dfe7bff3390cd4958da11e760b65318f0a48c32913e4d5bc5e8d55abaaa2d32e" @@ -9,7 +12,7 @@ sources: url: "https://github.com/webmproject/libwebp/archive/v1.2.2.tar.gz" sha256: "51e9297aadb7d9eb99129fe0050f53a11fcce38a0848fb2b0389e385ad93695e" "1.2.1": - url: "https://github.com/webmproject/libwebp/archive/refs/tags/v1.2.1.tar.gz" + url: "https://github.com/webmproject/libwebp/archive/v1.2.1.tar.gz" sha256: "01bcde6a40a602294994050b81df379d71c40b7e39c819c024d079b3c56307f4" "1.2.0": url: "https://github.com/webmproject/libwebp/archive/v1.2.0.tar.gz" @@ -21,21 +24,48 @@ sources: url: "https://github.com/webmproject/libwebp/archive/v1.0.3.tar.gz" sha256: "082d114bcb18a0e2aafc3148d43367c39304f86bf18ba0b2e766447e111a4a91" patches: + "1.3.0": + - patch_file: "patches/1.3.0-0001-fix-cmake.patch" + patch_description: "disable PIC, disable prefix library name on MSVC" + patch_type: "conan" "1.2.4": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.3": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.2": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.1": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.0": - - patch_file: "patches/0001-fix-dll-export.patch" - - patch_file: "patches/0003-build-libwebpmux-1.2.0.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.2.0-0003-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" "1.1.0": - - patch_file: "patches/0001-fix-dll-export.patch" - - patch_file: "patches/0002-qnx.patch" - - patch_file: "patches/0003-build-libwebpmux-1.1.0.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.1.0-0002-qnx.patch" + patch_description: "work around cmake bug on QNX" + patch_type: "conan" + patch_source: "https://chromium-review.googlesource.com/c/webm/libwebp/+/2637274" + - patch_file: "patches/1.1.0-0003-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" "1.0.3": - - patch_file: "patches/0001-fix-dll-export.patch" - - patch_file: "patches/0003-build-libwebpmux-1.0.3.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.0.3-0002-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" diff --git a/recipes/libwebp/all/patches/0001-fix-dll-export.patch b/recipes/libwebp/all/patches/1.0.3-0001-fix-dll-export.patch similarity index 100% rename from recipes/libwebp/all/patches/0001-fix-dll-export.patch rename to recipes/libwebp/all/patches/1.0.3-0001-fix-dll-export.patch diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.0.3.patch b/recipes/libwebp/all/patches/1.0.3-0002-build-libwebpmux.patch similarity index 100% rename from recipes/libwebp/all/patches/0003-build-libwebpmux-1.0.3.patch rename to recipes/libwebp/all/patches/1.0.3-0002-build-libwebpmux.patch diff --git a/recipes/libwebp/all/patches/0002-qnx.patch b/recipes/libwebp/all/patches/1.1.0-0002-qnx.patch similarity index 100% rename from recipes/libwebp/all/patches/0002-qnx.patch rename to recipes/libwebp/all/patches/1.1.0-0002-qnx.patch diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.1.0.patch b/recipes/libwebp/all/patches/1.1.0-0003-build-libwebpmux.patch similarity index 100% rename from recipes/libwebp/all/patches/0003-build-libwebpmux-1.1.0.patch rename to recipes/libwebp/all/patches/1.1.0-0003-build-libwebpmux.patch diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.2.0.patch b/recipes/libwebp/all/patches/1.2.0-0003-build-libwebpmux.patch similarity index 100% rename from recipes/libwebp/all/patches/0003-build-libwebpmux-1.2.0.patch rename to recipes/libwebp/all/patches/1.2.0-0003-build-libwebpmux.patch diff --git a/recipes/libwebp/all/patches/1.3.0-0001-fix-cmake.patch b/recipes/libwebp/all/patches/1.3.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..f9c41d4f6a5417 --- /dev/null +++ b/recipes/libwebp/all/patches/1.3.0-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 0a5af42..781f4c7 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -58,7 +58,6 @@ if(WEBP_LINK_STATIC) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # vwebp does not compile on Ubuntu with static libraries so disabling it for + # now. + set(WEBP_BUILD_VWEBP OFF) +@@ -142,7 +141,7 @@ endif() + set(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) + set(INSTALLED_LIBRARIES) + +-if(MSVC) ++if(0) + # match the naming convention used by nmake + set(webp_libname_prefix "lib") + set(CMAKE_SHARED_LIBRARY_PREFIX "${webp_libname_prefix}") diff --git a/recipes/libwebp/config.yml b/recipes/libwebp/config.yml index 2a1d6bc5117bc8..df097a6cc668fd 100644 --- a/recipes/libwebp/config.yml +++ b/recipes/libwebp/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.0": + folder: all "1.2.4": folder: all "1.2.3": diff --git a/recipes/libxlsxwriter/all/conandata.yml b/recipes/libxlsxwriter/all/conandata.yml index b6ef8ccb7684dc..44eb2bad3dada6 100644 --- a/recipes/libxlsxwriter/all/conandata.yml +++ b/recipes/libxlsxwriter/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.5": + url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.1.5.tar.gz" + sha256: "12843587d591cf679e6ec63ecc629245befec2951736804a837696cdb5d61946" "1.1.4": url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.1.4.tar.gz" sha256: "b379eb35fdd9c653ebe72485b9c992f612c7ea66f732784457997d6e782f619b" @@ -9,6 +12,11 @@ sources: url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.0.0.tar.gz" sha256: "8b353379333c323d14a9d265cd2491d3a6c0032c8d6ec2141f10b82ab66a087c" patches: + "1.1.5": + - patch_file: "patches/1.1.5-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + sha256: "54bf92c1f9423d9c7b3820122ff806679e254392d66ae72696f58e7d36e4b16f" "1.1.4": - patch_file: "patches/1.1.3-0001-fix-cmake.patch" patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" diff --git a/recipes/libxlsxwriter/all/conanfile.py b/recipes/libxlsxwriter/all/conanfile.py index 467437938757a7..0d8e6136fd0e5e 100644 --- a/recipes/libxlsxwriter/all/conanfile.py +++ b/recipes/libxlsxwriter/all/conanfile.py @@ -6,7 +6,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibxlsxwriterConan(ConanFile): @@ -46,18 +46,9 @@ def config_options(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/libxlsxwriter/all/patches/1.1.5-0001-fix-cmake.patch b/recipes/libxlsxwriter/all/patches/1.1.5-0001-fix-cmake.patch new file mode 100644 index 00000000000000..46175dd3778a65 --- /dev/null +++ b/recipes/libxlsxwriter/all/patches/1.1.5-0001-fix-cmake.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e656184..b9002e7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -178,9 +178,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\"") +@@ -219,13 +218,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 CONFIG) + 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() + +@@ -281,7 +280,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/config.yml b/recipes/libxlsxwriter/config.yml index 3e62b328f7fc78..4690b80fd5fb3a 100644 --- a/recipes/libxlsxwriter/config.yml +++ b/recipes/libxlsxwriter/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.5": + folder: "all" "1.1.4": folder: "all" "1.1.3": diff --git a/recipes/libxml2/all/conanfile.py b/recipes/libxml2/all/conanfile.py index c183f8d0d6e08a..c0b5bbc7032aa8 100644 --- a/recipes/libxml2/all/conanfile.py +++ b/recipes/libxml2/all/conanfile.py @@ -63,8 +63,9 @@ class Libxml2Conan(ConanFile): options = {name: [True, False] for name in default_options.keys()} @property - def _option_names(self): - return [name for name in self.info.options.keys() if name not in ["shared", "fPIC", "include_utils"]] + def _configure_option_names(self): + return [name for name in self.default_options.keys() if (name in self.options) + and (name not in ["shared", "fPIC", "include_utils"])] @property def _settings_build(self): @@ -139,7 +140,7 @@ def generate(self): f"--enable-shared={yes_no(self.options.shared)}", f"--enable-static={yes_no(not self.options.shared)}", ]) - for option_name in self._option_names: + for option_name in self._configure_option_names: option_value = getattr(self.options, option_name) tc.configure_args.append(f"--with-{option_name}={yes_no(option_value)}") @@ -171,7 +172,7 @@ def _build_msvc(self): args.append(f"include=\"{';'.join(incdirs)}\"") args.append(f"lib=\"{';'.join(libdirs)}\"") - for name in self._option_names: + for name in self._configure_option_names: cname = {"mem-debug": "mem_debug", "run-debug": "run_debug", "docbook": "docb"}.get(name, name) @@ -187,7 +188,8 @@ def _build_msvc(self): def fix_library(option, package, old_libname): if option: libs = [] - for lib in itertools.chain(self.dependencies[package].cpp_info.libs, self.dependencies[package].cpp_info.system_libs): + aggregated_cpp_info = self.dependencies[package].cpp_info.aggregated_components() + for lib in itertools.chain(aggregated_cpp_info.libs, aggregated_cpp_info.system_libs): libname = lib if not libname.endswith('.lib'): libname += '.lib' @@ -232,7 +234,7 @@ def _build_mingw(self): args.append(f"include=\"{' -I'.join(incdirs)}\"") args.append(f"lib=\"{' -L'.join(libdirs)}\"") - for name in self._option_names: + for name in self._configure_option_names: cname = { "mem-debug": "mem_debug", "run-debug": "run_debug", @@ -246,10 +248,11 @@ def _build_mingw(self): # build def fix_library(option, package, old_libname): if option: + aggregated_cpp_info = self.dependencies[package].cpp_info.aggregated_components() replace_in_file(self, "Makefile.mingw", f"LIBS += -l{old_libname}", - f"LIBS += -l{' -l'.join(self.dependencies[package].cpp_info.libs)}", + f"LIBS += -l{' -l'.join(aggregated_cpp_info.libs)}", ) fix_library(self.options.iconv, "libiconv", "iconv") diff --git a/recipes/libxshmfence/all/conanfile.py b/recipes/libxshmfence/all/conanfile.py index a4136cd3cae484..abd496668a102b 100644 --- a/recipes/libxshmfence/all/conanfile.py +++ b/recipes/libxshmfence/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rm, rmdir +from conans import tools, AutoToolsBuildEnvironment import contextlib import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibxshmfenceConan(ConanFile): name = "libxshmfence" @@ -38,31 +40,35 @@ def _settings_build(self): def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) + 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: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + # for plain C projects only + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("Windows is not supported by libxshmfence recipe. Contributions are welcome") def build_requirements(self): - self.build_requires("automake/1.16.4") - self.build_requires("pkgconf/1.7.4") + self.build_requires("automake/1.16.5") + 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 requirements(self): - self.requires("xorg-proto/2021.4") + self.requires("xorg-proto/2022.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) @contextlib.contextmanager @@ -91,8 +97,7 @@ def _configure_autotools(self): return self._autotools def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) with self._build_context(): autotools = self._configure_autotools() autotools.make() @@ -102,9 +107,10 @@ def package(self): with self._build_context(): autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.libs = ["xshmfence"] self.cpp_info.names["pkg_config"] = "xshmfence" + self.cpp_info.set_property("pkg_config_name", "xshmfence") diff --git a/recipes/libyuv/all/conandata.yml b/recipes/libyuv/all/conandata.yml index 0096cb0d06e2fb..e839599c0c5fc3 100644 --- a/recipes/libyuv/all/conandata.yml +++ b/recipes/libyuv/all/conandata.yml @@ -1,6 +1,8 @@ # Versions from LIBYUV_VERSION definition in include/libyuv/version.h # Pay attention to package commits incrementing this definition sources: + "1854": + url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/3abd6f36b6e4f5a2e0ce236580a8bc1da3c7cf7e.tar.gz" "1845": url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/b9adaef1133ee835efc8970d1dcdcf23a5b68eba.tar.gz" "1841": @@ -8,15 +10,19 @@ sources: "1768": url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/dfaf7534e0e536f7e5ef8ddd7326797bd09b8622.tar.gz" patches: + "1854": + - patch_file: "patches/1854-0001-fix-cmake.patch" + patch_description: "Fix CMake to be more robust & predictable" + patch_type: "conan" "1845": - - patch_file: "patches/0001-fix-cmake-1841.patch" + - patch_file: "patches/1841-0001-fix-cmake.patch" patch_description: "Fix CMake to be more robust & predictable" - patch_type: "compatibility" + patch_type: "conan" "1841": - - patch_file: "patches/0001-fix-cmake-1841.patch" + - patch_file: "patches/1841-0001-fix-cmake.patch" patch_description: "Fix CMake to be more robust & predictable" - patch_type: "compatibility" + patch_type: "conan" "1768": - - patch_file: "patches/0001-fix-cmake-1768.patch" + - patch_file: "patches/1768-0001-fix-cmake.patch" patch_description: "Fix CMake to be more robust & predictable" - patch_type: "compatibility" + patch_type: "conan" diff --git a/recipes/libyuv/all/conanfile.py b/recipes/libyuv/all/conanfile.py index 3c7a9857e98ba6..7e0ba399e3d6e1 100644 --- a/recipes/libyuv/all/conanfile.py +++ b/recipes/libyuv/all/conanfile.py @@ -1,10 +1,9 @@ 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 import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LibyuvConan(ConanFile): @@ -19,7 +18,7 @@ class LibyuvConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], } default_options = { "shared": False, @@ -36,10 +35,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -48,13 +44,9 @@ def requirements(self): if self.options.with_jpeg == "libjpeg": self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.0.5") - - def validate(self): - if self.info.options.with_jpeg == "libjpeg-turbo": - raise ConanInvalidConfiguration( - "libjpeg-turbo is an invalid option right now, as it is not supported by the cmake script.", - ) + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) @@ -80,8 +72,13 @@ def package(self): def package_info(self): self.cpp_info.libs = ["yuv"] + self.cpp_info.requires = [] + if self.options.with_jpeg == "libjpeg": + self.cpp_info.requires.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + self.cpp_info.requires.append("mozjpeg::libjpeg") # TODO: to remove in conan v2 - 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) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libyuv/all/patches/0001-fix-cmake-1768.patch b/recipes/libyuv/all/patches/1768-0001-fix-cmake.patch similarity index 100% rename from recipes/libyuv/all/patches/0001-fix-cmake-1768.patch rename to recipes/libyuv/all/patches/1768-0001-fix-cmake.patch diff --git a/recipes/libyuv/all/patches/0001-fix-cmake-1841.patch b/recipes/libyuv/all/patches/1841-0001-fix-cmake.patch similarity index 100% rename from recipes/libyuv/all/patches/0001-fix-cmake-1841.patch rename to recipes/libyuv/all/patches/1841-0001-fix-cmake.patch diff --git a/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch b/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch new file mode 100644 index 00000000000000..1a2b79c67847ce --- /dev/null +++ b/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch @@ -0,0 +1,69 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,8 +2,8 @@ + # Originally created for "roxlu build system" to compile libyuv on windows + # Run with -DTEST=ON to build unit tests + ++CMAKE_MINIMUM_REQUIRED( VERSION 3.8 ) + PROJECT ( YUV C CXX ) # "C" is required even for C++ projects +-CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) + OPTION( TEST "Built unit tests" OFF ) + + SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) +@@ -27,15 +27,11 @@ if(MSVC) + endif() + + # this creates the static library (.a) +-ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} ) ++ADD_LIBRARY ( ${ly_lib_static} ${ly_source_files} ) ++target_compile_features(${ly_lib_static} PUBLIC cxx_std_11) ++set_target_properties(${ly_lib_static} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + + # this creates the shared library (.so) +-ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) +-if(WIN32) +- SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" ) +-endif() + + # this creates the conversion tool + ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc ) +@@ -44,12 +40,18 @@ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} ) + # this creates the yuvconstants tool + ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c ) + TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} ) ++include(CheckFunctionExists) ++check_function_exists(round HAVE_MATH_SYSTEM) ++if(NOT HAVE_MATH_SYSTEM) ++ target_link_libraries(yuvconstants m) ++endif() + +-find_package ( JPEG ) +-if (JPEG_FOUND) +- include_directories( ${JPEG_INCLUDE_DIR} ) +- target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} ) +- add_definitions( -DHAVE_JPEG ) ++option(LIBYUV_WITH_JPEG "Build libyuv with jpeg" ON) ++if (LIBYUV_WITH_JPEG) ++ find_package(JPEG REQUIRED) ++ target_link_libraries(${ly_lib_static} JPEG::JPEG ) ++ target_compile_definitions(${ly_lib_static} PRIVATE HAVE_JPEG) ++ target_compile_definitions(yuvconvert PRIVATE HAVE_JPEG) + endif() + + if(TEST) +@@ -91,11 +93,9 @@ endif() + + + # install the conversion tool, .so, .a, and all the header files +-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) +-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) +-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) ++INSTALL ( TARGETS yuvconvert yuvconstants DESTINATION bin) ++INSTALL ( TARGETS ${ly_lib_static} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) + + # create the .deb and .rpm packages using cpack +-INCLUDE ( CM_linux_packages.cmake ) + diff --git a/recipes/libyuv/all/test_v1_package/CMakeLists.txt b/recipes/libyuv/all/test_v1_package/CMakeLists.txt index a044d49d31fdef..0d20897301b68b 100644 --- a/recipes/libyuv/all/test_v1_package/CMakeLists.txt +++ b/recipes/libyuv/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(libyuv REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE libyuv::libyuv) -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/libyuv/config.yml b/recipes/libyuv/config.yml index 336e0262a0b451..c1f0cfd37130fd 100644 --- a/recipes/libyuv/config.yml +++ b/recipes/libyuv/config.yml @@ -1,4 +1,6 @@ versions: + "1854": + folder: all "1845": folder: all "1841": diff --git a/recipes/libzippp/all/conandata.yml b/recipes/libzippp/all/conandata.yml index 49a240e225faf8..f31401deb346d5 100644 --- a/recipes/libzippp/all/conandata.yml +++ b/recipes/libzippp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "6.0-1.9.2": + url: "https://github.com/ctabin/libzippp/archive/libzippp-v6.0-1.9.2.tar.gz" + sha256: "f9aef9811802a18e69cd50527381d70c2e0f0d8a839f1d41914f6234f5964fc3" "5.0-1.8.0": url: "https://github.com/ctabin/libzippp/archive/libzippp-v5.0-1.8.0.tar.gz" sha256: "b70f2d0f64eb68b00a16290bac40ac1a3fd3d2896cfddc93e370a7fa28c591c5" diff --git a/recipes/libzippp/all/conanfile.py b/recipes/libzippp/all/conanfile.py index fa1cfae1a117c0..b05dfec2510118 100644 --- a/recipes/libzippp/all/conanfile.py +++ b/recipes/libzippp/all/conanfile.py @@ -1,33 +1,35 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, replace_in_file +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.36.0" +required_conan_version = ">=1.53.0" class LibZipppConan(ConanFile): name = "libzippp" description = "A simple basic C++ wrapper around the libzip library" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ctabin/libzippp" - license = "BSD-3-Clause" - topics = ("zip", "libzippp", "zip-archives", "zip-editing") - exports_sources = ["CMakeLists.txt"] - generators = "cmake", "cmake_find_package_multi" - settings = "os", "compiler", "build_type", "arch" + topics = ("zip", "zlib", "libzip", "zip-archives", "zip-editing") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_encryption": [True, False] + "with_encryption": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_encryption": False + "with_encryption": False, } - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": @@ -35,54 +37,72 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - libzippp_version = str(self.version) - if libzippp_version != "4.0" and len(libzippp_version.split("-")) != 2: - raise tools.ConanInvalidConfiguration("{}: version number must include '-'. (ex. '5.0-1.8.0')".format(self.name)) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.11") - if tools.Version(self.version) == "4.0": + self.requires("zlib/1.2.13") + if Version(self.version) == "4.0": self.requires("libzip/1.7.3") else: - libzip_version = str(self.version).split("-")[1] - self.requires("libzip/{}".format(libzip_version)) + versions = str(self.version).split("-") + if len(versions) == 2: + self.requires(f"libzip/{versions[1]}") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + libzippp_version = str(self.version) + if libzippp_version != "4.0" and len(libzippp_version.split("-")) != 2: + raise ConanInvalidConfiguration(f"{self.ref}: version number must include '-'. (ex. '5.0-1.8.0')") + + if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": + raise ConanInvalidConfiguration(f"{self.ref} does not support clang with libc++. Use libstdc++ instead.") 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["LIBZIPPP_INSTALL"] = True - self._cmake.definitions["LIBZIPPP_INSTALL_HEADERS"] = True - self._cmake.definitions["LIBZIPPP_ENABLE_ENCRYPTION"] = self.options.with_encryption - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["LIBZIPPP_INSTALL"] = True + tc.variables["LIBZIPPP_INSTALL_HEADERS"] = True + tc.variables["LIBZIPPP_ENABLE_ENCRYPTION"] = self.options.with_encryption + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_source(self): - tools.replace_in_file('source_subfolder/CMakeLists.txt', - 'find_package(LIBZIP MODULE REQUIRED)', - 'find_package(libzip REQUIRED CONFIG)') + replace_in_file(self, os.path.join(self.source_folder, 'CMakeLists.txt'), + 'find_package(LIBZIP MODULE REQUIRED)', + 'find_package(libzip REQUIRED CONFIG)') def build(self): self._patch_source() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENCE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy(pattern="LICENCE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "share")) - 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, "cmake")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + prefix = "lib" if self.settings.os == "Windows" else "" + postfix = "" if self.options.shared else "_static" + self.cpp_info.libs = [f"{prefix}zippp{postfix}"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.names["cmake_find_package"] = "libzippp" self.cpp_info.names["cmake_find_package_multi"] = "libzippp" self.cpp_info.set_property("cmake_file_name", "libzippp") diff --git a/recipes/libzippp/all/test_package/CMakeLists.txt b/recipes/libzippp/all/test_package/CMakeLists.txt index 148357d043ba66..5514f16e5d6bbb 100644 --- a/recipes/libzippp/all/test_package/CMakeLists.txt +++ b/recipes/libzippp/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(libzippp REQUIRED) +find_package(libzippp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} libzippp::libzippp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE libzippp::libzippp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libzippp/all/test_package/conanfile.py b/recipes/libzippp/all/test_package/conanfile.py index 3da371b660e0a3..a9fb96656f2039 100644 --- a/recipes/libzippp/all/test_package/conanfile.py +++ b/recipes/libzippp/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): - 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/libzippp/all/test_v1_package/CMakeLists.txt b/recipes/libzippp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/libzippp/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/libzippp/all/test_v1_package/conanfile.py b/recipes/libzippp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/libzippp/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/libzippp/config.yml b/recipes/libzippp/config.yml index a529e567c09754..4ba054a3032a99 100644 --- a/recipes/libzippp/config.yml +++ b/recipes/libzippp/config.yml @@ -1,4 +1,6 @@ versions: + "6.0-1.9.2": + folder: all "5.0-1.8.0": folder: all "4.0": diff --git a/recipes/lief/all/conanfile.py b/recipes/lief/all/conanfile.py index eed55b5ff591b7..4a9cf2b5cd9723 100644 --- a/recipes/lief/all/conanfile.py +++ b/recipes/lief/all/conanfile.py @@ -8,7 +8,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LiefConan(ConanFile): name = "lief" @@ -60,10 +60,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: @@ -82,13 +79,6 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - 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("rang/3.2") self.requires("mbedtls/3.2.1") @@ -97,9 +87,10 @@ def requirements(self): 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("utfcpp/3.2.2") + # lief doesn't supprot spdlog/1.11.0 with fmt/9.x yet. self.requires("spdlog/1.10.0") - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") self.requires("tcb-span/cci.20220616") def source(self): diff --git a/recipes/lief/all/test_v1_package/CMakeLists.txt b/recipes/lief/all/test_v1_package/CMakeLists.txt index 6b1097615e03a8..9d54a092e0a67e 100644 --- a/recipes/lief/all/test_v1_package/CMakeLists.txt +++ b/recipes/lief/all/test_v1_package/CMakeLists.txt @@ -4,11 +4,5 @@ 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) - -# It is required for gcc 5 -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/luajit/all/conandata.yml b/recipes/luajit/all/conandata.yml index b066a8d0de9646..1e7abff8db36b0 100644 --- a/recipes/luajit/all/conandata.yml +++ b/recipes/luajit/all/conandata.yml @@ -1,4 +1,12 @@ sources: + "2.1.0-beta3": + url: "https://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz" + sha256: "1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3" "2.0.5": url: "http://luajit.org/download/LuaJIT-2.0.5.tar.gz" sha256: "874b1f8297c697821f561f9b73b57ffd419ed8f4278c82e05b48806d30c1e979" +patches: + "2.1.0-beta3": + - patch_file: "patches/2.1.0-beta3-0001-remove-mac-deploy.patch" + patch_type: "conan" + patch_description: "Do not enforce default value for MACOSX_DEPLOYMENT_TARGET" diff --git a/recipes/luajit/all/conanfile.py b/recipes/luajit/all/conanfile.py index 7d70d0b565c900..5271897d749e21 100644 --- a/recipes/luajit/all/conanfile.py +++ b/recipes/luajit/all/conanfile.py @@ -1,6 +1,16 @@ +from conan import ConanFile +from conan.tools.scm import Version +from conan.tools.files import get, chdir, replace_in_file, copy, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc, MSBuildToolchain, VCVars, unix_path +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building +from conan.errors import ConanInvalidConfiguration import os -import platform -from conans import ConanFile, tools, VisualStudioBuildEnvironment, AutoToolsBuildEnvironment + + +required_conan_version = ">=1.53.0" class LuajitConan(ConanFile): @@ -9,99 +19,124 @@ class LuajitConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://luajit.org" description = "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language." - topics = ("conan", "lua", "jit") + topics = ("lua", "jit") settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False]} - default_options = {"shared": False, - "fPIC": True} - _env_build = None + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def layout(self): + basic_layout(self, src_folder="src") - def _configure_autotools(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - return self._env_build + def validate(self): + if self.settings.os == "Macos" and self.settings.arch == "armv8" and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} can not be cross-built to Mac M1. Please, try any version >=2.1") + elif Version(self.version) <= "2.1.0-beta1" and self.settings.os == "Macos" and self.settings.arch == "armv8": + raise ConanInvalidConfiguration(f"{self.ref} is not supported by Mac M1. Please, try any version >=2.1") - def build(self): - if self.settings.compiler == 'Visual Studio': - with tools.chdir(os.path.join(self._source_subfolder, 'src')): - env_build = VisualStudioBuildEnvironment(self) - with tools.environment_append(env_build.vars), tools.vcvars(self): - variant = '' if self.options.shared else 'static' - self.run("msvcbuild.bat %s" % variant) + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + tc = VCVars(self) + tc.generate() else: + tc = AutotoolsToolchain(self) + tc.generate() + + def _patch_sources(self): + if not is_msvc(self): buildmode = 'shared' if self.options.shared else 'static' - makefile = os.path.join(self._source_subfolder, 'src', 'Makefile') - tools.replace_in_file(makefile, + makefile = os.path.join(self.source_folder, 'src', 'Makefile') + replace_in_file(self, makefile, 'BUILDMODE= mixed', 'BUILDMODE= %s' % buildmode) - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)', 'TARGET_DYLIBPATH= $(TARGET_DYLIBNAME)') # adjust mixed mode defaults to build either .so or .a, but not both if not self.options.shared: - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_T= $(LUAJIT_T) $(LUAJIT_SO)', 'TARGET_T= $(LUAJIT_T) $(LUAJIT_A)') - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO)', 'TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_A)') else: - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_O= $(LUAJIT_A)', 'TARGET_O= $(LUAJIT_SO)') - env = dict() - if self.settings.os == "Macos": - # Per https://luajit.org/install.html: If MACOSX_DEPLOYMENT_TARGET - # is not set then it's forced to 10.4, which breaks compile on Mojave. - version = self.settings.get_safe("os.version") - if not version and platform.system() == "Darwin": - major, minor, _ = platform.mac_ver()[0].split(".") - version = "%s.%s" % (major, minor) - env["MACOSX_DEPLOYMENT_TARGET"] = version - with tools.chdir(self._source_subfolder), tools.environment_append(env): - env_build = self._configure_autotools() - env_build.make(args=["PREFIX=%s" % self.package_folder]) + if "clang" in str(self.settings.compiler): + replace_in_file(self, makefile, 'CC= $(DEFAULT_CC)', 'CC= clang') + + @property + def _macosx_deployment_target(self): + return self.settings.get_safe("os.version") + + @property + def _make_arguments(self): + args = [f"PREFIX={unix_path(self, self.package_folder)}"] + if is_apple_os(self) and self._macosx_deployment_target: + args.append(f"MACOSX_DEPLOYMENT_TARGET={self._macosx_deployment_target}") + return args + + @property + def _luajit_include_folder(self): + luaversion = Version(self.version) + if luaversion.major == "2": + return f"luajit-{luaversion.major}.{luaversion.minor}" + return "luajit-2.1" + + def build(self): + apply_conandata_patches(self) + self._patch_sources() + if is_msvc(self): + with chdir(self, os.path.join(self.source_folder, "src")): + variant = '' if self.options.shared else 'static' + self.run(f"msvcbuild.bat {variant}", env="conanbuild") + else: + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make(args=self._make_arguments) def package(self): - self.copy("COPYRIGHT", dst="licenses", src=self._source_subfolder) - if self.settings.compiler == 'Visual Studio': - ljs = os.path.join(self._source_subfolder, "src") - inc = os.path.join(self.package_folder, "include", "luajit-2.0") - self.copy("lua.h", dst=inc, src=ljs) - self.copy("lualib.h", dst=inc, src=ljs) - self.copy("lauxlib.h", dst=inc, src=ljs) - self.copy("luaconf.h", dst=inc, src=ljs) - self.copy("lua.hpp", dst=inc, src=ljs) - self.copy("luajit.h", dst=inc, src=ljs) - self.copy("lua51.lib", dst="lib", src=ljs) - self.copy("lua51.dll", dst="bin", src=ljs) + copy(self, "COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + src_folder = os.path.join(self.source_folder, "src") + include_folder = os.path.join(self.package_folder, "include", self._luajit_include_folder) + if is_msvc(self): + copy(self, "lua.h", src=src_folder, dst=include_folder) + copy(self, "lualib.h", src=src_folder, dst=include_folder) + copy(self, "lauxlib.h", src=src_folder, dst=include_folder) + copy(self, "luaconf.h", src=src_folder, dst=include_folder) + copy(self, "lua.hpp", src=src_folder, dst=include_folder) + copy(self, "luajit.h", src=src_folder, dst=include_folder) + copy(self, "lua51.lib", src=src_folder, dst=os.path.join(self.package_folder, "lib")) + copy(self, "lua51.dll", src=src_folder, dst=os.path.join(self.package_folder, "bin")) else: - with tools.chdir(self._source_subfolder): - env_build = self._configure_autotools() - env_build.install(args=["PREFIX=%s" % self.package_folder]) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install(args=self._make_arguments + ["DESTDIR="]) + 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 = ["lua51" if self.settings.compiler == "Visual Studio" else "luajit-5.1"] - self.cpp_info.includedirs = [os.path.join(self.package_folder, "include", "luajit-2.0")] - if self.settings.os == "Linux": + self.cpp_info.libs = ["lua51" if is_msvc(self) else "luajit-5.1"] + self.cpp_info.set_property("pkg_config_name", "luajit") + self.cpp_info.includedirs = [os.path.join("include", self._luajit_include_folder)] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "dl"]) diff --git a/recipes/luajit/all/patches/2.1.0-beta3-0001-remove-mac-deploy.patch b/recipes/luajit/all/patches/2.1.0-beta3-0001-remove-mac-deploy.patch new file mode 100644 index 00000000000000..26345dc4f02f06 --- /dev/null +++ b/recipes/luajit/all/patches/2.1.0-beta3-0001-remove-mac-deploy.patch @@ -0,0 +1,14 @@ +diff --git a/src/Makefile b/src/Makefile +index f56465d..a6838bc 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -312,9 +312,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector + TARGET_XCFLAGS+= -fno-stack-protector + endif + ifeq (Darwin,$(TARGET_SYS)) +- ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) +- export MACOSX_DEPLOYMENT_TARGET=10.4 +- endif + TARGET_STRIP+= -x + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC + TARGET_DYNXLDOPTS= diff --git a/recipes/luajit/all/patches/20230104-0001-remove-mac-deploy.patch b/recipes/luajit/all/patches/20230104-0001-remove-mac-deploy.patch new file mode 100644 index 00000000000000..42e0eca4a7fb66 --- /dev/null +++ b/recipes/luajit/all/patches/20230104-0001-remove-mac-deploy.patch @@ -0,0 +1,14 @@ +diff --git a/src/Makefile b/src/Makefile +index 30d64be..b753ea1 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -316,9 +316,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector + TARGET_XCFLAGS+= -fno-stack-protector + endif + ifeq (Darwin,$(TARGET_SYS)) +- ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) +- $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) +- endif + TARGET_STRIP+= -x + TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC diff --git a/recipes/luajit/all/test_package/CMakeLists.txt b/recipes/luajit/all/test_package/CMakeLists.txt index c4a786d6190860..c0ae2aa0ba9ba9 100644 --- a/recipes/luajit/all/test_package/CMakeLists.txt +++ b/recipes/luajit/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() +project(test_package C) find_package(luajit REQUIRED CONFIG) diff --git a/recipes/luajit/all/test_package/conanfile.py b/recipes/luajit/all/test_package/conanfile.py index 7e2dfe859bb27b..1d87f369a24da2 100644 --- a/recipes/luajit/all/test_package/conanfile.py +++ b/recipes/luajit/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan.tools.build import can_run +from conan import ConanFile +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" + 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/luajit/all/test_v1_package/CMakeLists.txt b/recipes/luajit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..2f6b1a2f7ec79d --- /dev/null +++ b/recipes/luajit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +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/luajit/all/test_v1_package/conanfile.py b/recipes/luajit/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..9d6b68dd18b5e8 --- /dev/null +++ b/recipes/luajit/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 tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/luajit/config.yml b/recipes/luajit/config.yml index 1630e08ca5f328..f13e8f0f1a9ec4 100644 --- a/recipes/luajit/config.yml +++ b/recipes/luajit/config.yml @@ -1,3 +1,5 @@ versions: + "2.1.0-beta3": + folder: "all" "2.0.5": folder: "all" diff --git a/recipes/luau/all/conandata.yml b/recipes/luau/all/conandata.yml index 4afd6c2c668c45..75a36ad5ed9102 100644 --- a/recipes/luau/all/conandata.yml +++ b/recipes/luau/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.558": + url: "https://github.com/Roblox/luau/archive/0.558.tar.gz" + sha256: "3484adddb18872700e033f5917af44d90c266f9e0fff2fac21aec1061f472a06" "0.556": url: "https://github.com/Roblox/luau/archive/0.556.tar.gz" sha256: "dc72f91f4e866a2b25f7608e062c91c84e92a2e5611026e9789f127c3caf39f6" @@ -28,6 +31,13 @@ sources: sha256: "24122d3192083b2133de47d8039fb744b8007c6667fc1b6f254a2a8d72e15d53" patches: + "0.558": + - patch_file: "patches/0.552-0001-fix-cmake.patch" + patch_description: "enable shared build" + patch_type: "portability" + - patch_file: "patches/0.536-0002-rename-lerp.patch" + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" "0.556": - patch_file: "patches/0.552-0001-fix-cmake.patch" patch_description: "enable shared build" diff --git a/recipes/luau/all/conanfile.py b/recipes/luau/all/conanfile.py index 6545f6caa610ff..7e65b178d4892d 100644 --- a/recipes/luau/all/conanfile.py +++ b/recipes/luau/all/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.microsoft import is_msvc from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, replace_in_file from conan.tools.build import check_min_cppstd from conan.tools.scm import Version @@ -8,7 +8,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class LuauConan(ConanFile): name = "luau" @@ -43,6 +43,8 @@ def _compilers_minimum_version(self): "gcc": "8" if Version(self.version) < "0.549" else "9", "clang": "7", "apple-clang": "12", + "Visual Studio": "15", + "msvc": "191", } def export_sources(self): @@ -55,10 +57,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") if Version(self.version) < "0.549": del self.options.native_code_gen @@ -68,7 +67,6 @@ def layout(self): def validate(self): if self.info.settings.compiler.cppstd: check_min_cppstd(self, self._minimum_cpp_standard) - check_min_vs(self, 191) 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( diff --git a/recipes/luau/all/test_v1_package/CMakeLists.txt b/recipes/luau/all/test_v1_package/CMakeLists.txt index cbcc5c4d883901..9d54a092e0a67e 100644 --- a/recipes/luau/all/test_v1_package/CMakeLists.txt +++ b/recipes/luau/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Luau REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Luau::Luau) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/luau/config.yml b/recipes/luau/config.yml index 2aa48d76766348..56f7f8911914b5 100644 --- a/recipes/luau/config.yml +++ b/recipes/luau/config.yml @@ -1,4 +1,6 @@ versions: + "0.558": + folder: all "0.556": folder: all "0.552": diff --git a/recipes/lz4/all/conandata.yml b/recipes/lz4/all/conandata.yml index b7956998236465..577763acfe7a6a 100644 --- a/recipes/lz4/all/conandata.yml +++ b/recipes/lz4/all/conandata.yml @@ -11,7 +11,15 @@ sources: patches: "1.9.3": - patch_file: "patches/0003-cmake-minimum-required-first-1.9.3.patch" + patch_description: "Move cmake_minimum_required to the top of CMakeFile.txt" + patch_type: conan "1.9.2": - patch_file: "patches/0001-cmake-add-shared-DEFINE_SYMBOL.patch" + patch_description: "Add LZ4_DLL_EXPORT to MSVC" + patch_type: portability - patch_file: "patches/0002-cmake-optional-cli.patch" + patch_description: "Add ability not to compile the CLI" + patch_type: conan - patch_file: "patches/0003-cmake-minimum-required-first-1.9.2.patch" + patch_description: "Move cmake_minimum_required to the top of CMakeFile.txt" + patch_type: conan diff --git a/recipes/lz4/all/conanfile.py b/recipes/lz4/all/conanfile.py index 0f12071b01ef24..00e8eb7116e692 100644 --- a/recipes/lz4/all/conanfile.py +++ b/recipes/lz4/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class LZ4Conan(ConanFile): @@ -15,7 +15,7 @@ class LZ4Conan(ConanFile): license = ("BSD-2-Clause", "BSD-3-Clause") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lz4/lz4" - topics = ("lz4", "compression") + topics = ("compression") settings = "os", "arch", "compiler", "build_type" options = { @@ -28,8 +28,7 @@ class LZ4Conan(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": @@ -37,15 +36,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/lz4/all/test_v1_package/conanfile.py b/recipes/lz4/all/test_v1_package/conanfile.py index a2c12d9cb383dd..77061a2f84fa08 100644 --- a/recipes/lz4/all/test_v1_package/conanfile.py +++ b/recipes/lz4/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake from conan.tools.build import cross_building import os diff --git a/recipes/lzham/all/conandata.yml b/recipes/lzham/all/conandata.yml new file mode 100644 index 00000000000000..17b541de9d7b8a --- /dev/null +++ b/recipes/lzham/all/conandata.yml @@ -0,0 +1,33 @@ +sources: + "cci.20220103": + sha256: "3e3ccf7a57b1e6a90099784597aa7da30de3249a5f7fe532cefb3a77db5acbfb" + url: "https://github.com/richgel999/lzham_codec/archive/d379b1f9121e2197881c61cfc4713c78848bdfe7.zip" +patches: + "cci.20220103": + - patch_file: "patches/aarch64-yield-cci.20220103.patch" + patch_description: 'Uses "yield" rather than "pause" mneumonic to fix + aarch64 build' + patch_type: portability + + - patch_file: "patches/cmake-min-req-swap-cci.20220103.patch" + patch_description: 'Puts cmake_minimum_required before project in all + CMakeLists' + patch_type: portability + + - patch_file: "patches/fix-osx-cci.20220103.patch" + patch_description: "Fixes building on OSX" + patch_type: portability + + - patch_file: "patches/use-lzham-types-cci.20220103.patch" + patch_description: 'Uses typedefs prefixed with LZHAM to fix linux build + errors' + patch_type: portability + + - patch_file: "patches/cmake-rm-tests-cci.20220103.patch" + patch_description: "Skips building of lzhamtest for CMake" + patch_type: conan + + - patch_file: "patches/msvc-conan-cci.20220103.patch" + patch_description: 'Skips building of lzhamtest and examples for MSVC, + and injects conan toolchain for MSVC' + patch_type: conan diff --git a/recipes/lzham/all/conanfile.py b/recipes/lzham/all/conanfile.py new file mode 100644 index 00000000000000..b1b9dc2a684e4f --- /dev/null +++ b/recipes/lzham/all/conanfile.py @@ -0,0 +1,158 @@ +import os + +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 +) +from conan.tools.microsoft import ( + MSBuild, MSBuildDeps, MSBuildToolchain, VCVars, is_msvc, vs_layout +) + +required_conan_version = ">=1.52.0" + +SLN_FILE = "lzham.sln" + + +class PackageConan(ConanFile): + name = "lzham" + + description = ( + "Compression algorithm similar compression ratio and faster " + "decompression than LZMA." + ) + + license = "LicenseRef-LICENSE" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/richgel999/lzham_codec" + topics = ("compression", "lz-compression") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + 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: + self.options.rm_safe("fPIC") + + def layout(self): + if is_msvc(self): + vs_layout(self) + else: + 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 is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + tc = MSBuildDeps(self) + tc.generate() + tc = VCVars(self) + tc.generate() + else: + 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): + apply_conandata_patches(self) + if is_msvc(self): + msbuild = MSBuild(self) + msbuild.build_type = ( + "Debug" if self.settings.build_type == "Debug" else "Release" + ) + msbuild.platform = ( + "Win32" if self.settings.arch == "x86" else msbuild.platform + ) + msbuild.build(sln="lzham.sln") + else: + 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 + ) + + if is_msvc(self): + suffix = "x64D" if self.settings.build_type == "Debug" else "x64" + copy( + self, + pattern=f"lzham_{suffix}.lib", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.build_folder, "lib", "x64"), + keep_path=False + ) + copy( + self, + pattern=f"lzham_{suffix}.dll", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.build_folder, "bin"), + keep_path=False + ) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + else: + 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, "res")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) + + if is_msvc(self): + lib_name = "lzham_x64" + if self.settings.build_type == "Debug": + lib_name += "D" + self.cpp_info.libs = [lib_name] + else: + self.cpp_info.libs = ["lzhamdll", "lzhamcomp", "lzhamdecomp"] + self.cpp_info.set_property("cmake_file_name", "lzham") + self.cpp_info.set_property("cmake_target_name", "lzham::lzham") + self.cpp_info.set_property("pkg_config_name", "lzham") + + # TODO: to remove in conan v2 once cmake_find_package_* generators + # removed + self.cpp_info.names["cmake_find_package"] = "lzham" + self.cpp_info.names["cmake_find_package_multi"] = "lzham" + self.cpp_info.names["pkg_config"] = "lzham" diff --git a/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch b/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch new file mode 100644 index 00000000000000..313029dda755c5 --- /dev/null +++ b/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch @@ -0,0 +1,16 @@ +diff --git a/lzhamdecomp/lzham_platform.h b/lzhamdecomp/lzham_platform.h +index 01704be..920a8f4 100644 +--- a/lzhamdecomp/lzham_platform.h ++++ b/lzhamdecomp/lzham_platform.h +@@ -24,7 +24,11 @@ void lzham_fail(const char* pExp, const char* pFile, unsigned line); + #if defined(__GNUC__) && LZHAM_PLATFORM_PC + extern __inline__ __attribute__((__always_inline__,__gnu_inline__)) void lzham_yield_processor() + { ++ #if defined(__aarch64__) ++ __asm__ __volatile__("yield"); ++ #else + __asm__ __volatile__("pause"); ++ #endif + } + #elif LZHAM_PLATFORM_X360 + #define lzham_yield_processor() \ diff --git a/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch b/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch new file mode 100644 index 00000000000000..8c598c5b49697e --- /dev/null +++ b/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch @@ -0,0 +1,55 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 428cdfc..b8980e5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-# PROJECT(lzham) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzham) + option(BUILD_X64 "build 64-bit" ON) + option(BUILD_SHARED_LIBS "build shared/static libs" ON) + +diff --git a/lzhamcomp/CMakeLists.txt b/lzhamcomp/CMakeLists.txt +index c80cc66..a3f77e7 100644 +--- a/lzhamcomp/CMakeLists.txt ++++ b/lzhamcomp/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamcomp) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamcomp) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamdecomp/CMakeLists.txt b/lzhamdecomp/CMakeLists.txt +index bf87a02..723379e 100644 +--- a/lzhamdecomp/CMakeLists.txt ++++ b/lzhamdecomp/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamdecomp) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamdecomp) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamdll/CMakeLists.txt b/lzhamdll/CMakeLists.txt +index f77f3fe..5a162b6 100644 +--- a/lzhamdll/CMakeLists.txt ++++ b/lzhamdll/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamdll) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamdll) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamtest/CMakeLists.txt b/lzhamtest/CMakeLists.txt +index 3349911..b8833b9 100644 +--- a/lzhamtest/CMakeLists.txt ++++ b/lzhamtest/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamtest) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamtest) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") diff --git a/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch b/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch new file mode 100644 index 00000000000000..7b5cf8afef5f7b --- /dev/null +++ b/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 428cdfc..1857db2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,6 @@ option(BUILD_SHARED_LIBS "build shared/static libs" ON) + add_subdirectory(lzhamdecomp) + add_subdirectory(lzhamcomp) + add_subdirectory(lzhamdll) +-add_subdirectory(lzhamtest) + + install(FILES include/lzham_dynamic_lib.h + include/lzham_exports.inc diff --git a/recipes/lzham/all/patches/fix-osx-cci.20220103.patch b/recipes/lzham/all/patches/fix-osx-cci.20220103.patch new file mode 100644 index 00000000000000..156502e3464437 --- /dev/null +++ b/recipes/lzham/all/patches/fix-osx-cci.20220103.patch @@ -0,0 +1,28 @@ +diff --git a/lzhamdecomp/lzham_platform.cpp b/lzhamdecomp/lzham_platform.cpp +index cfc85c1..599a847 100644 +--- a/lzhamdecomp/lzham_platform.cpp ++++ b/lzhamdecomp/lzham_platform.cpp +@@ -61,7 +61,7 @@ void lzham_debug_break(void) + { + #if LZHAM_USE_WIN32_API + DebugBreak(); +-#elif (TARGET_OS_MAC == 1) && (TARGET_IPHONE_SIMULATOR == 0) && (TARGET_OS_IPHONE == 0) ++#elif (TARGET_OS_MAC == 1) && (TARGET_IPHONE_SIMULATOR == 0) && (TARGET_OS_IPHONE == 0) && !defined(__clang__) + __asm {int 3} + #else + assert(0); +diff --git a/lzhamdecomp/lzham_traits.h b/lzhamdecomp/lzham_traits.h +index ea7214f..e103bad 100644 +--- a/lzhamdecomp/lzham_traits.h ++++ b/lzhamdecomp/lzham_traits.h +@@ -67,7 +67,9 @@ namespace lzham + // Defines type Q as bitwise copyable. + #define LZHAM_DEFINE_BITWISE_COPYABLE(Q) template<> struct bitwise_copyable { enum { cFlag = true }; }; + +-#if defined(__APPLE__) || defined(__NetBSD__) ++#if defined(__APPLE__) ++ #define LZHAM_IS_POD(T) std::is_pod::value ++#elif defined(__NetBSD__) + #define LZHAM_IS_POD(T) std::__is_pod::__value + #else + #define LZHAM_IS_POD(T) __is_pod(T) diff --git a/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch b/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch new file mode 100644 index 00000000000000..ca0b641855eedc --- /dev/null +++ b/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch @@ -0,0 +1,83 @@ +diff --git a/lzham.sln b/lzham.sln +index 5c0edb6..63343f3 100644 +--- a/lzham.sln ++++ b/lzham.sln +@@ -3,22 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 11.00 + # Visual Studio 2010 + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamdll", "lzhamdll\lzham.vcxproj", "{763BE79D-1280-41B7-81C5-7DC41E2BDB44}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamtest", "lzhamtest\lzhamtest.vcxproj", "{BBE16587-150E-460C-8AB4-F18B92D0B981}" +-EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamdecomp", "lzhamdecomp\lzhamdecomp.vcxproj", "{8DA0CD32-701D-48D7-AE92-728338501500}" + EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamcomp", "lzhamcomp\lzhamcomp.vcxproj", "{8DA0CD46-791D-48D7-AE92-728338501500}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example1", "example1\example1.vcxproj", "{BBE16587-150E-460C-8AB4-E18B92D0B982}" +-EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamlib", "lzhamlib\lzhamlib.vcxproj", "{83A2F0B5-1D02-4A13-B579-714F60E31774}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example2", "example2\example2.vcxproj", "{CBE16587-150E-460C-8AB4-E18B92D0B983}" +-EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example3", "example3\example3.vcxproj", "{1BE16587-150E-460C-8AB4-E18B92D0BA87}" +-EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example4", "example4\example4.vcxproj", "{1BE16587-260E-460C-8AB4-E18B92D0BA87}" +-EndProject + Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 +diff --git a/lzhamcomp/lzhamcomp.vcxproj b/lzhamcomp/lzhamcomp.vcxproj +index 5fd6155..b45f3dc 100644 +--- a/lzhamcomp/lzhamcomp.vcxproj ++++ b/lzhamcomp/lzhamcomp.vcxproj +@@ -23,6 +23,9 @@ + lzhamcomp + Win32Proj + ++ ++ ++ + + + StaticLibrary +diff --git a/lzhamdecomp/lzhamdecomp.vcxproj b/lzhamdecomp/lzhamdecomp.vcxproj +index dbaf54c..5f78ca5 100644 +--- a/lzhamdecomp/lzhamdecomp.vcxproj ++++ b/lzhamdecomp/lzhamdecomp.vcxproj +@@ -23,6 +23,9 @@ + lzhamdecomp + Win32Proj + ++ ++ ++ + + + StaticLibrary +diff --git a/lzhamdll/lzham.vcxproj b/lzhamdll/lzham.vcxproj +index ec0a280..5536234 100644 +--- a/lzhamdll/lzham.vcxproj ++++ b/lzhamdll/lzham.vcxproj +@@ -24,6 +24,9 @@ + lzham + Win32Proj + ++ ++ ++ + + + DynamicLibrary +diff --git a/lzhamlib/lzhamlib.vcxproj b/lzhamlib/lzhamlib.vcxproj +index 954dd99..cdd2c26 100644 +--- a/lzhamlib/lzhamlib.vcxproj ++++ b/lzhamlib/lzhamlib.vcxproj +@@ -23,6 +23,9 @@ + lzhamlib + Win32Proj + ++ ++ ++ + + + StaticLibrary diff --git a/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch b/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch new file mode 100644 index 00000000000000..db6f4925fa490c --- /dev/null +++ b/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch @@ -0,0 +1,142 @@ +diff --git a/lzhamcomp/lzham_win32_threading.h b/lzhamcomp/lzham_win32_threading.h +index 0e1d16b..4aaff8c 100644 +--- a/lzhamcomp/lzham_win32_threading.h ++++ b/lzhamcomp/lzham_win32_threading.h +@@ -43,9 +43,9 @@ namespace lzham + } + } + +- bool wait(uint32 milliseconds = UINT32_MAX) ++ bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) + { +- LZHAM_ASSUME(INFINITE == UINT32_MAX); ++ LZHAM_ASSUME(INFINITE == LZHAM_UINT32_MAX); + + DWORD result = WaitForSingleObject(m_handle, milliseconds); + +diff --git a/lzhamdecomp/lzham_huffman_codes.cpp b/lzhamdecomp/lzham_huffman_codes.cpp +index 11bdbd4..788414a 100644 +--- a/lzhamdecomp/lzham_huffman_codes.cpp ++++ b/lzhamdecomp/lzham_huffman_codes.cpp +@@ -224,7 +224,7 @@ namespace lzham + + sym_freq& sf = state.syms0[num_used_syms]; + sf.m_left = (uint16)i; +- sf.m_right = UINT16_MAX; ++ sf.m_right = LZHAM_UINT16_MAX; + sf.m_freq = freq; + num_used_syms++; + } +diff --git a/lzhamdecomp/lzham_prefix_coding.cpp b/lzhamdecomp/lzham_prefix_coding.cpp +index e9ada15..52377c9 100644 +--- a/lzhamdecomp/lzham_prefix_coding.cpp ++++ b/lzhamdecomp/lzham_prefix_coding.cpp +@@ -149,7 +149,7 @@ namespace lzham + { + uint c = pCodesizes[i]; + +- LZHAM_ASSERT(!c || (next_code[c] <= UINT16_MAX)); ++ LZHAM_ASSERT(!c || (next_code[c] <= LZHAM_UINT16_MAX)); + + pCodes[i] = static_cast(next_code[c]++); + +@@ -296,7 +296,7 @@ namespace lzham + + LZHAM_ASSERT(t < (1U << table_bits)); + +- LZHAM_ASSERT(pTables->m_lookup[t] == UINT32_MAX); ++ LZHAM_ASSERT(pTables->m_lookup[t] == LZHAM_UINT32_MAX); + + pTables->m_lookup[t] = sym_index | (codesize << 16U); + } +diff --git a/lzhamdecomp/lzham_symbol_codec.cpp b/lzhamdecomp/lzham_symbol_codec.cpp +index 5623584..b2ea7ee 100644 +--- a/lzhamdecomp/lzham_symbol_codec.cpp ++++ b/lzhamdecomp/lzham_symbol_codec.cpp +@@ -581,7 +581,7 @@ namespace lzham + freq++; + m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--m_symbols_until_update == 0) + { +@@ -828,7 +828,7 @@ namespace lzham + freq++; + model.m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--model.m_symbols_until_update == 0) + { +@@ -1265,8 +1265,8 @@ namespace lzham + { + uint32 t = pTables->m_lookup[m_bit_buf >> (cBitBufSize - pTables->m_table_bits)]; + +- LZHAM_ASSERT(t != UINT32_MAX); +- sym = t & UINT16_MAX; ++ LZHAM_ASSERT(t != LZHAM_UINT32_MAX); ++ sym = t & LZHAM_UINT16_MAX; + len = t >> 16; + + LZHAM_ASSERT(model.m_code_sizes[sym] == len); +@@ -1301,7 +1301,7 @@ namespace lzham + freq++; + model.m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--model.m_symbols_until_update == 0) + { +diff --git a/lzhamdecomp/lzham_symbol_codec.h b/lzhamdecomp/lzham_symbol_codec.h +index 306d59b..b231530 100644 +--- a/lzhamdecomp/lzham_symbol_codec.h ++++ b/lzhamdecomp/lzham_symbol_codec.h +@@ -19,7 +19,7 @@ namespace lzham + typedef uint64 bit_cost_t; + const uint32 cBitCostScaleShift = 24; + const uint32 cBitCostScale = (1U << cBitCostScaleShift); +- const bit_cost_t cBitCostMax = UINT64_MAX; ++ const bit_cost_t cBitCostMax = LZHAM_UINT64_MAX; + + inline bit_cost_t convert_to_scaled_bitcost(uint bits) { LZHAM_ASSERT(bits <= 255); uint32 scaled_bits = bits << cBitCostScaleShift; return static_cast(scaled_bits); } + +@@ -444,7 +444,7 @@ namespace lzham + if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ + { \ + uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ +- result = t & UINT16_MAX; \ ++ result = t & LZHAM_UINT16_MAX; \ + len = t >> 16; \ + } \ + else \ +@@ -465,7 +465,7 @@ namespace lzham + uint freq = pModel->m_sym_freq[result]; \ + freq++; \ + pModel->m_sym_freq[result] = static_cast(freq); \ +- LZHAM_ASSERT(freq <= UINT16_MAX); \ ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ + if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ + { \ + pModel->update_tables(); \ +@@ -501,7 +501,7 @@ namespace lzham + if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ + { \ + uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ +- result = t & UINT16_MAX; \ ++ result = t & LZHAM_UINT16_MAX; \ + len = t >> 16; \ + } \ + else \ +@@ -522,7 +522,7 @@ namespace lzham + uint freq = pModel->m_sym_freq[result]; \ + freq++; \ + pModel->m_sym_freq[result] = static_cast(freq); \ +- LZHAM_ASSERT(freq <= UINT16_MAX); \ ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ + if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ + { \ + pModel->update_tables(); \ diff --git a/recipes/lzham/all/test_package/CMakeLists.txt b/recipes/lzham/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..c4780ae45756cc --- /dev/null +++ b/recipes/lzham/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +find_package(lzham REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC lzham::lzham) diff --git a/recipes/lzham/all/test_package/conanfile.py b/recipes/lzham/all/test_package/conanfile.py new file mode 100644 index 00000000000000..eea09bfb32ab12 --- /dev/null +++ b/recipes/lzham/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + + +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/lzham/all/test_package/test_package.cpp b/recipes/lzham/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..c588215577f5f2 --- /dev/null +++ b/recipes/lzham/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include +#include + +#include + +int main() { + unsigned char in[] = "Hello Conan Center!"; + unsigned char out[sizeof(in)]; + + lzham_z_stream stream; + std::memset(&stream, 0, sizeof(stream)); + stream.next_in = in; + stream.avail_in = sizeof(in); + stream.next_out = out; + stream.avail_out = sizeof(out); + if (lzham_z_deflateInit(&stream, LZHAM_Z_BEST_COMPRESSION) != LZHAM_Z_OK) + return EXIT_FAILURE; + + if (lzham_z_deflate(&stream, LZHAM_Z_FULL_FLUSH) != LZHAM_Z_OK) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} diff --git a/recipes/lzham/all/test_v1_package/CMakeLists.txt b/recipes/lzham/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..231cec51e4ab95 --- /dev/null +++ b/recipes/lzham/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(lzham REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC lzham::lzham) diff --git a/recipes/lzham/all/test_v1_package/conanfile.py b/recipes/lzham/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..0f735b51a26422 --- /dev/null +++ b/recipes/lzham/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +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.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/lzham/config.yml b/recipes/lzham/config.yml new file mode 100644 index 00000000000000..d334d7a80bf723 --- /dev/null +++ b/recipes/lzham/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20220103": + folder: all diff --git a/recipes/m4/all/conanfile.py b/recipes/m4/all/conanfile.py index ceb7e83548ca84..0420d3bb0e6418 100644 --- a/recipes/m4/all/conanfile.py +++ b/recipes/m4/all/conanfile.py @@ -12,6 +12,7 @@ class M4Conan(ConanFile): name = "m4" + package_type = "application" description = "GNU M4 is an implementation of the traditional Unix macro processor" topics = ("macro", "preprocessor") homepage = "https://www.gnu.org/software/m4/" diff --git a/recipes/m4/all/test_package/conanfile.py b/recipes/m4/all/test_package/conanfile.py index 22e16b15f81187..b665b86aad8f3a 100644 --- a/recipes/m4/all/test_package/conanfile.py +++ b/recipes/m4/all/test_package/conanfile.py @@ -32,5 +32,5 @@ def test(self): self.run(f"m4 -R {self.source_folder}/frozen.m4f {self.source_folder}/test.m4") output = StringIO() - self.run(f"m4 -P {self._m4_input_path}", output=output) + self.run(f"m4 -P {self._m4_input_path}", output) assert "Harry, Jr. met Sally" in output.getvalue() diff --git a/recipes/mailio/all/CMakeLists.txt b/recipes/mailio/all/CMakeLists.txt deleted file mode 100644 index 8977c3f43d6f8d..00000000000000 --- a/recipes/mailio/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_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/mailio/all/conandata.yml b/recipes/mailio/all/conandata.yml index a365e3a29f7a84..068f2f54981f16 100644 --- a/recipes/mailio/all/conandata.yml +++ b/recipes/mailio/all/conandata.yml @@ -8,7 +8,9 @@ sources: patches: "0.21.0": - patch_file: "patches/0.21.0-adapt-cmakelists.patch" - base_path: "source_subfolder" + patch_description: "fix install path" + patch_type: "conan" "0.20.0": - patch_file: "patches/0.20.0-adapt-cmakelists.patch" - base_path: "source_subfolder" + patch_description: "fix install path" + patch_type: "conan" diff --git a/recipes/mailio/all/conanfile.py b/recipes/mailio/all/conanfile.py index a0a2c6874d4a74..8024179a3697b6 100644 --- a/recipes/mailio/all/conanfile.py +++ b/recipes/mailio/all/conanfile.py @@ -1,17 +1,23 @@ -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 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.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class mailioConan(ConanFile): name = "mailio" + description = "mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols." license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/karastojko/mailio" - description = "mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols." topics = ("smtp", "imap", "email", "mail", "libraries", "cpp") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], "shared": [True, False] @@ -20,38 +26,24 @@ class mailioConan(ConanFile): "fPIC": True, "shared": False } - generators = "cmake", "cmake_find_package" short_paths = True - _cmake = None - - _compiler_required_cpp17 = { - "gcc": "8.3", - "clang": "6", - "Visual Studio": "15", - "apple-clang": "10", - } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _build_subfolder(self): - return "build_subfolder" - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["MAILIO_BUILD_SHARED_LIBRARY"] = self.options.shared - self._cmake.definitions["MAILIO_BUILD_DOCUMENTATION"] = False - self._cmake.definitions["MAILIO_BUILD_EXAMPLES"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _compiler_required_cpp(self): + return { + "gcc": "8.3", + "clang": "6", + "Visual Studio": "15", + "msvc": "191", + "apple-clang": "10", + } 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": @@ -59,42 +51,57 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.79.0") - self.requires("openssl/1.1.1q") + self.requires("boost/1.81.0") + self.requires("openssl/1.1.1s") def validate(self): if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") + check_min_cppstd(self, self._min_cppstd) try: - minimum_required_compiler_version = self._compiler_required_cpp17[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.") + minimum_required_compiler_version = self._compiler_required_cpp[str(self.settings.compiler)] + if Version(self.settings.compiler.version) < minimum_required_compiler_version: + raise ConanInvalidConfiguration(f"{self.ref} requires c++{self._min_cppstd} 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.") + self.output.warn(f"{self.ref} has no support for the current compiler. Please consider adding it.") def build_requirements(self): # mailio requires cmake >= 3.16.3 - self.build_requires("cmake/3.23.2") + self.tool_requires("cmake/3.25.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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MAILIO_BUILD_SHARED_LIBRARY"] = self.options.shared + tc.variables["MAILIO_BUILD_DOCUMENTATION"] = False + tc.variables["MAILIO_BUILD_EXAMPLES"] = False + tc.generate() + + dpes = CMakeDeps(self) + dpes.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() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - 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.libs = ["mailio"] self.cpp_info.requires = ["boost::system", "boost::date_time", "boost::regex", "openssl::openssl"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/mailio/all/test_package/CMakeLists.txt b/recipes/mailio/all/test_package/CMakeLists.txt index 6a193e3e9907d5..efd57b8a24474a 100644 --- a/recipes/mailio/all/test_package/CMakeLists.txt +++ b/recipes/mailio/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(mailio REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} mailio::mailio) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +target_link_libraries(${PROJECT_NAME} PRIVATE mailio::mailio) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mailio/all/test_package/conanfile.py b/recipes/mailio/all/test_package/conanfile.py index 0d81e955db7e7c..1111583fea732f 100644 --- a/recipes/mailio/all/test_package/conanfile.py +++ b/recipes/mailio/all/test_package/conanfile.py @@ -1,28 +1,27 @@ +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 +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class mailioTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + 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 build_requirements(self): - if hasattr(self, "settings_build") and tools.cross_building(self) and \ - 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 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/mailio/all/test_v1_package/CMakeLists.txt b/recipes/mailio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/mailio/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/mailio/all/test_v1_package/conanfile.py b/recipes/mailio/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/mailio/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/mbits-args/all/CMakeLists.txt b/recipes/mbits-args/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb93..00000000000000 --- a/recipes/mbits-args/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/mbits-args/all/conandata.yml b/recipes/mbits-args/all/conandata.yml index 9396e3b4afe52f..c5ec46f3c1e273 100644 --- a/recipes/mbits-args/all/conandata.yml +++ b/recipes/mbits-args/all/conandata.yml @@ -1,4 +1,10 @@ sources: - 0.12.3: + "0.12.3": url: "https://github.com/mbits-libs/args/archive/v0.12.3.tar.gz" sha256: "1a1dc5793e927a7f8c34b77c776b4d4a88f7ce9557657d8e806fca2922bd07a0" +patches: + "0.12.3": + - patch_file: "patches/0.12.3-0001-export-cmake-config.patch" + patch_description: "conan v2: drop the unneeded dependency, export cmake config" + patch_source: "https://github.com/mbits-libs/args/commit/f0593ed24d8edc33bcef5acaad5a2d27bf566ede" + patch_type: "conan" diff --git a/recipes/mbits-args/all/conanfile.py b/recipes/mbits-args/all/conanfile.py index 67fd62d66485dd..061c5b3a891b0b 100644 --- a/recipes/mbits-args/all/conanfile.py +++ b/recipes/mbits-args/all/conanfile.py @@ -1,103 +1,122 @@ -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 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, CMakeToolchain, cmake_layout import os +required_conan_version = ">=1.53.0" + + class MBitsArgsConan(ConanFile): name = "mbits-args" - description = "Small open-source library for program argument parser, inspired by Python's `argparse`, " \ - "depending only on the standard library, with C++17 as minimum requirement." - homepage = "https://github.com/mbits-libs/args" + description = ( + "Small open-source library for program argument parser, inspired by Python's `argparse`, " + "depending only on the standard library, with C++17 as minimum requirement." + ) license = "MIT" - topics = ("command-line", "commandline", "commandline-interface", - "program-arguments", "argparse", "argparser", "argument-parsing") - url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/args" + topics = ( + "command-line", + "commandline", + "commandline-interface", + "program-arguments", + "argparse", + "argparser", + "argument-parsing", + ) settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake" - exports_sources = "CMakeLists.txt" - - _cmake = None + options = {"fPIC": [True, False]} + default_options = {"fPIC": True} - _compilers_minimum_version = { - "gcc": "8", - "clang": "7.0", - "Visual Studio": "16", - "apple-clang": "10.0", - } + @property + def _min_cppstd(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "12", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "10.0", + } + + 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: - del self.options.fPIC - - if self.settings.compiler == "Visual Studio" and "MT" in str(self.settings.compiler.runtime): + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + 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( - "mbits-args: combining shared library with private C++ " - "library (MT/MTd) is not supported.") - - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - - minimum_version = self._compilers_minimum_version.get( - str(self.settings.compiler), False) - if not minimum_version: - self.output.warn( - "mbits-args requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("mbits-args: Unsupported compiler: {} {}; " - "minimal version known to work is {}." - .format(self.settings.compiler, self.settings.compiler.version, minimum_version)) - elif str(self.settings.compiler) == "clang" and tools.Version(self.settings.compiler.version) < "8": - libcxx = self.settings.compiler.get_safe("libcxx") - if libcxx and str(libcxx) == "libc++": - raise ConanInvalidConfiguration("mbits-args: Unsupported compiler: clang {} with libc++;\n" - "minimal version known to work is either clang 8 with " - "libc++ or clang {} with libstdc++/libstdc++11." - .format(self.settings.compiler.version, minimum_version)) + 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]) - os.rename("args-{}".format(self.version), - self._source_subfolder) - - def _configure_cmake(self): - if self._cmake is not None: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIBARGS_TESTING"] = False - self._cmake.definitions["LIBARGS_INSTALL"] = True - self._cmake.definitions["LIBARGS_SHARED"] = self.options.shared - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBARGS_TESTING"] = False + tc.variables["LIBARGS_INSTALL"] = 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() + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", - "licenses", keep_path=False, src=self._source_subfolder) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "args" - self.cpp_info.filenames["cmake_find_package_multi"] = "args" + self.cpp_info.libs = ["args"] + + self.cpp_info.set_property("cmake_file_name", "mbits-args") + self.cpp_info.set_property("cmake_target_name", "mbits::args") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-args" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-args" self.cpp_info.names["cmake_find_package"] = "mbits" self.cpp_info.names["cmake_find_package_multi"] = "mbits" - 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"].libs = tools.collect_libs(self) - - # FIXME: CMake imported target shouldn't be namespaced (requires https://github.com/conan-io/conan/issues/7615) - # https://github.com/mbits-libs/args/blob/72f5f2b87ae39f26638a585fa4ad0b96b4152ae6/CMakeLists.txt#L152 + self.cpp_info.components["args"].set_property( + "cmake_target_name", "mbits::args" + ) + self.cpp_info.components["args"].libs = ["args"] diff --git a/recipes/mbits-args/all/patches/0.12.3-0001-export-cmake-config.patch b/recipes/mbits-args/all/patches/0.12.3-0001-export-cmake-config.patch new file mode 100644 index 00000000000000..b14f33f3a470e2 --- /dev/null +++ b/recipes/mbits-args/all/patches/0.12.3-0001-export-cmake-config.patch @@ -0,0 +1,36 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3d9271c..28c176f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,9 +9,6 @@ set(PROJECT_VERSION_STABILITY "") # or "-alpha", or "-beta", or "-rc.5" + if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + message(STATUS "Libargs: Standalone") + +- include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +- conan_basic_setup(TARGETS) +- + set(LIBARG_TESTING_DEFAULT ON) + set(LIBARG_INSTALL_DEFAULT ON) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +@@ -123,8 +120,9 @@ target_compile_definitions(args PRIVATE LIBARGS_EXPORTING) + target_compile_features(args PRIVATE cxx_std_17) + target_include_directories(args + PUBLIC +- ${CMAKE_CURRENT_SOURCE_DIR}/include +- ${CMAKE_CURRENT_BINARY_DIR}/include ++ $ ++ $ ++ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) + + if (LIBARGS_SHARED) +@@ -149,7 +147,8 @@ endif() + ################################################################## + + if (LIBARGS_INSTALL) +- install(TARGETS args) ++ install(TARGETS args EXPORT mbits) ++ install(EXPORT mbits NAMESPACE "mbits::" DESTINATION lib/cmake) + install(DIRECTORY include/args DESTINATION include) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/args/version.hpp" DESTINATION include/args) + endif() diff --git a/recipes/mbits-args/all/test_package/CMakeLists.txt b/recipes/mbits-args/all/test_package/CMakeLists.txt index edca4cb0bfe7f4..6048bc9a7928f9 100644 --- a/recipes/mbits-args/all/test_package/CMakeLists.txt +++ b/recipes/mbits-args/all/test_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.12) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mbits-args REQUIRED CONFIG) -find_package(args REQUIRED CONFIG) - -add_executable(example example.cpp) -# FIXME: CMake imported target shouldn't be namespaced (requires https://github.com/conan-io/conan/issues/7615) -target_link_libraries(example mbits::args) -set_target_properties(example PROPERTIES - CXX_STANDARD 20 - CXX_STANDARD_REQUIRED OFF) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::args) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-args/all/test_package/conanfile.py b/recipes/mbits-args/all/test_package/conanfile.py index 9ded35e45e703c..3202cf875bb921 100644 --- a/recipes/mbits-args/all/test_package/conanfile.py +++ b/recipes/mbits-args/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_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class LibargsTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,7 +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("{} --sum 1000 700 1".format(bin_path), - run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run("{} --sum 1000 700 1".format(bin_path), env="conanrun") diff --git a/recipes/mbits-args/all/test_package/example.cpp b/recipes/mbits-args/all/test_package/test_package.cpp similarity index 100% rename from recipes/mbits-args/all/test_package/example.cpp rename to recipes/mbits-args/all/test_package/test_package.cpp diff --git a/recipes/mbits-args/all/test_v1_package/CMakeLists.txt b/recipes/mbits-args/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/mbits-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/mbits-args/all/test_v1_package/conanfile.py b/recipes/mbits-args/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..897d76acb188aa --- /dev/null +++ b/recipes/mbits-args/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("{} --sum 1000 700 1".format(bin_path), run_environment=True) diff --git a/recipes/mbits-args/config.yml b/recipes/mbits-args/config.yml index 0ea23cbe62531a..fba0b105d56efa 100644 --- a/recipes/mbits-args/config.yml +++ b/recipes/mbits-args/config.yml @@ -1,3 +1,3 @@ versions: - 0.12.3: + "0.12.3": folder: all diff --git a/recipes/mbits-mstch/all/conandata.yml b/recipes/mbits-mstch/all/conandata.yml new file mode 100644 index 00000000000000..252a49a795bd6a --- /dev/null +++ b/recipes/mbits-mstch/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + # Newer versions at the top + "1.0.4": + url: "https://github.com/mbits-libs/libmstch/archive/v1.0.4.tar.gz" + sha256: "ee3052b9c2321b46fffabb5db5d5659e5f963070cdfd0004701b515867ed6857" diff --git a/recipes/mbits-mstch/all/conanfile.py b/recipes/mbits-mstch/all/conanfile.py new file mode 100644 index 00000000000000..a06f83e964b39b --- /dev/null +++ b/recipes/mbits-mstch/all/conanfile.py @@ -0,0 +1,105 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import 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, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class MBitsMstchConan(ConanFile): + name = "mbits-mstch" + description = "libmstch implemented in terms of C++17 variant." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/libmstch" + topics = ("parser", "mstch", "mustache", "libmstch", "libmstch-parser") + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "msvc": "192", + "apple-clang": "11.0.3", + } + + 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 validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(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() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["mstch"] + + self.cpp_info.set_property("cmake_file_name", "mbits-mstch") + self.cpp_info.set_property("cmake_target_name", "mbits::mstch") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-mstch" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-mstch" + self.cpp_info.names["cmake_find_package"] = "mbits" + self.cpp_info.names["cmake_find_package_multi"] = "mbits" + self.cpp_info.components["mstch"].set_property( + "cmake_target_name", "mbits::mstch" + ) + self.cpp_info.components["mstch"].libs = ["mstch"] diff --git a/recipes/mbits-mstch/all/test_package/CMakeLists.txt b/recipes/mbits-mstch/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..b7067fa3ea38e6 --- /dev/null +++ b/recipes/mbits-mstch/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(mbits-mstch REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::mstch) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-mstch/all/test_package/conanfile.py b/recipes/mbits-mstch/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/mbits-mstch/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/mbits-mstch/all/test_package/test_package.cpp b/recipes/mbits-mstch/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..dee76b9b4ce2e1 --- /dev/null +++ b/recipes/mbits-mstch/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#include +#include + +int main() { + mstch::map root{ + {"it", "works"}, + {"happy", true}, + {"various", + mstch::array{ + mstch::map{{"value", nullptr}}, + mstch::map{{"value", 0ll}}, + mstch::map{{"value", 3.14}}, + mstch::map{{"value", false}}, + }}, + }; + + puts(mstch::render(R"(>>> It {{it}} + I'm {{^happy}}not {{/happy}}happy about it. + Various: +{{#various}} + - {{value}}; +{{/various}} +)", + root) + .c_str()); +} diff --git a/recipes/mbits-mstch/all/test_v1_package/CMakeLists.txt b/recipes/mbits-mstch/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/mbits-mstch/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/mbits-mstch/all/test_v1_package/conanfile.py b/recipes/mbits-mstch/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/mbits-mstch/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/mbits-mstch/config.yml b/recipes/mbits-mstch/config.yml new file mode 100644 index 00000000000000..a7562f7a5313ac --- /dev/null +++ b/recipes/mbits-mstch/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "1.0.4": + folder: all diff --git a/recipes/mbits-semver/all/conandata.yml b/recipes/mbits-semver/all/conandata.yml new file mode 100644 index 00000000000000..dfbd10562ef662 --- /dev/null +++ b/recipes/mbits-semver/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + 0.1.1: + url: "https://github.com/mbits-libs/semver/archive/v0.1.1.tar.gz" + sha256: "edfa9b04bdffd8efbdea31c9cfd7064801483d8cab0b2de5734018bdb318cf18" diff --git a/recipes/mbits-semver/all/conanfile.py b/recipes/mbits-semver/all/conanfile.py new file mode 100644 index 00000000000000..f0cda9dbb4ea72 --- /dev/null +++ b/recipes/mbits-semver/all/conanfile.py @@ -0,0 +1,103 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import 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, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class MBitsSemverConan(ConanFile): + name = "mbits-semver" + description = "Semantic Version type for C++17" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/semver" + topics = ("semver", "semantic-versioning") + settings = "os", "compiler", "build_type", "arch" + options = {"fPIC": [True, False]} + default_options = {"fPIC": True} + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "11.0.3", + } + + 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 validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + 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." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SEMVER_TESTING"] = False + tc.generate() + + def build(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() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["semver"] + + self.cpp_info.set_property("cmake_file_name", "mbits-semver") + self.cpp_info.set_property("cmake_target_name", "mbits::semver") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-semver" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-semver" + self.cpp_info.names["cmake_find_package"] = "mbits" + self.cpp_info.names["cmake_find_package_multi"] = "mbits" + self.cpp_info.components["semver"].set_property( + "cmake_target_name", "mbits::semver" + ) + self.cpp_info.components["semver"].libs = ["semver"] diff --git a/recipes/mbits-semver/all/test_package/CMakeLists.txt b/recipes/mbits-semver/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..4d8d4734ef1558 --- /dev/null +++ b/recipes/mbits-semver/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(mbits-semver REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::semver) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-semver/all/test_package/conanfile.py b/recipes/mbits-semver/all/test_package/conanfile.py new file mode 100644 index 00000000000000..1111583fea732f --- /dev/null +++ b/recipes/mbits-semver/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +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 = "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/mbits-semver/all/test_package/test_package.cpp b/recipes/mbits-semver/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..fa9dbd47eb8373 --- /dev/null +++ b/recipes/mbits-semver/all/test_package/test_package.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +int main() { + auto const ver_data = std::string{"1.3.0-beta.5+something.mixed.5"}; + semver::project_version beta5{ver_data}; + + auto const ver_data_rc = std::string{"1.3.0-rc"}; + semver::project_version rc{ver_data_rc}; + + char const *verdict = semver::version.compatible_with(beta5) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + semver::version.to_string().c_str(), verdict, + beta5.to_string().c_str()); + + verdict = semver::version.compatible_with(semver::get_version()) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + semver::version.to_string().c_str(), verdict, + semver::get_version().to_string().c_str()); + + verdict = beta5.compatible_with(rc) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + beta5.to_string().c_str(), verdict, rc.to_string().c_str()); + + verdict = rc.compatible_with(beta5) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + rc.to_string().c_str(), verdict, beta5.to_string().c_str()); +} diff --git a/recipes/mbits-semver/all/test_v1_package/CMakeLists.txt b/recipes/mbits-semver/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/mbits-semver/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/mbits-semver/all/test_v1_package/conanfile.py b/recipes/mbits-semver/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..c492184eec19c2 --- /dev/null +++ b/recipes/mbits-semver/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/mbits-semver/config.yml b/recipes/mbits-semver/config.yml new file mode 100644 index 00000000000000..931f26d75751d6 --- /dev/null +++ b/recipes/mbits-semver/config.yml @@ -0,0 +1,3 @@ +versions: + 0.1.1: + folder: all diff --git a/recipes/md4qt/all/conandata.yml b/recipes/md4qt/all/conandata.yml index 3e89e46b3e63ac..3d8d45af50a233 100644 --- a/recipes/md4qt/all/conandata.yml +++ b/recipes/md4qt/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.4": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.0.4.tar.gz" + sha256: "2980a0d0b5d3539a5a1402942a1345e97c8ab36acfc8e00d932df157d2e6edc2" "2.0.3": url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.0.3.tar.gz" sha256: "374bfc74aa6ebb1ea7d2332b96f8b2f6001118793bbe4e55109a13d0ffe7ce55" diff --git a/recipes/md4qt/config.yml b/recipes/md4qt/config.yml index 7529da0511999f..e588fe3f46fb3f 100644 --- a/recipes/md4qt/config.yml +++ b/recipes/md4qt/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.4": + folder: all "2.0.3": folder: all "2.0.2": diff --git a/recipes/meson/all/conandata.yml b/recipes/meson/all/conandata.yml index 0195431f991641..1f58656822bf2f 100644 --- a/recipes/meson/all/conandata.yml +++ b/recipes/meson/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.0": + url: "https://github.com/mesonbuild/meson/releases/download/1.0.0/meson-1.0.0.tar.gz" + sha256: "aa50a4ba4557c25e7d48446abfde857957dcdf58385fffbe670ba0e8efacce05" "0.64.1": url: "https://github.com/mesonbuild/meson/archive/0.64.1.tar.gz" sha256: "1d12a4bc1cf3ab18946d12cf0b6452e5254ada1ad50aacc97f87e2cccd7da315" diff --git a/recipes/meson/all/conanfile.py b/recipes/meson/all/conanfile.py index a39345f1cb657f..e2d65a1b60825c 100644 --- a/recipes/meson/all/conanfile.py +++ b/recipes/meson/all/conanfile.py @@ -11,6 +11,7 @@ class MesonConan(ConanFile): name = "meson" + package_type = "application" description = "Meson is a project to create the best possible next-generation build system" topics = ("meson", "mesonbuild", "build-system") url = "https://github.com/conan-io/conan-center-index" diff --git a/recipes/meson/config.yml b/recipes/meson/config.yml index 3c331d990af963..b08dc9001574f4 100644 --- a/recipes/meson/config.yml +++ b/recipes/meson/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.0": + folder: all "0.64.1": folder: all "0.64.0": diff --git a/recipes/mikelankamp-fpm/all/conandata.yml b/recipes/mikelankamp-fpm/all/conandata.yml new file mode 100644 index 00000000000000..360fcf6413abcf --- /dev/null +++ b/recipes/mikelankamp-fpm/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.0": + url: "https://github.com/MikeLankamp/fpm/archive/refs/tags/v1.1.0.tar.gz" + sha256: "e34941b4cd1d1f1fbe9ecf39b740cb20b9c272a832f63be27fa24eddf400e51b" diff --git a/recipes/mikelankamp-fpm/all/conanfile.py b/recipes/mikelankamp-fpm/all/conanfile.py new file mode 100644 index 00000000000000..4f1037ea6348fd --- /dev/null +++ b/recipes/mikelankamp-fpm/all/conanfile.py @@ -0,0 +1,56 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.52.0" + +class MikeLankampFpmConan(ConanFile): + name = "mikelankamp-fpm" + description = "C++ header-only fixed-point math library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/MikeLankamp/fpm" + topics = ("fixed-point", "math", "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], 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="*.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 = [] + + self.cpp_info.set_property("cmake_file_name", "fpm") + self.cpp_info.set_property("cmake_target_name", "fpm::fpm") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "fpm" + self.cpp_info.filenames["cmake_find_package_multi"] = "fpm" + self.cpp_info.names["cmake_find_package"] = "fpm" + self.cpp_info.names["cmake_find_package_multi"] = "fpm" diff --git a/recipes/mikelankamp-fpm/all/test_package/CMakeLists.txt b/recipes/mikelankamp-fpm/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..4b78d3f578ec0a --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(fpm REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fpm::fpm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/mikelankamp-fpm/all/test_package/conanfile.py b/recipes/mikelankamp-fpm/all/test_package/conanfile.py new file mode 100644 index 00000000000000..48499fa0989d9c --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +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 = "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/mikelankamp-fpm/all/test_package/test_package.cpp b/recipes/mikelankamp-fpm/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..f57e54c2093e5a --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include +#include + +#include + +int main() { + std::cout << "Please input a number: "; + fpm::fixed_16_16 x; + std::cin >> x; + std::cout << "The cosine of " << x << " radians is: " << cos(x) << std::endl; + + return 0; +} diff --git a/recipes/mikelankamp-fpm/all/test_v1_package/CMakeLists.txt b/recipes/mikelankamp-fpm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..9d54a092e0a67e --- /dev/null +++ b/recipes/mikelankamp-fpm/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/mikelankamp-fpm/all/test_v1_package/conanfile.py b/recipes/mikelankamp-fpm/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..20d4d2e28d57e0 --- /dev/null +++ b/recipes/mikelankamp-fpm/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/mikelankamp-fpm/config.yml b/recipes/mikelankamp-fpm/config.yml new file mode 100644 index 00000000000000..b5c0d3cb2d4091 --- /dev/null +++ b/recipes/mikelankamp-fpm/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.0": + folder: all diff --git a/recipes/minizip-ng/all/conandata.yml b/recipes/minizip-ng/all/conandata.yml index 3c2038ac4c0872..4e96dfa1d6b279 100644 --- a/recipes/minizip-ng/all/conandata.yml +++ b/recipes/minizip-ng/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.0.8": + url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.8.tar.gz" + sha256: "27cc2f62cd02d79b71b346fc6ace02728385f8ba9c6b5f124062b0790a04629a" "3.0.7": url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.7.tar.gz" sha256: "39981a0db1bb6da504909bce63d7493286c5e50825c056564544c990d15c55cf" @@ -21,6 +24,14 @@ sources: url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.1.tar.gz" sha256: "96c95b274dd535984ce0e87691691388f2b976106e8cf8d527b15da552ac94e4" patches: + "3.0.8": + - patch_file: "patches/3.0.8-0001-fix-cmake-project.patch" + patch_description: "CMake: declare project() sooner" + patch_type: "conan" + - patch_file: "patches/3.0.6-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" "3.0.7": - patch_file: "patches/3.0.7-0001-fix-cmake-project.patch" patch_description: "CMake: declare project() sooner" diff --git a/recipes/minizip-ng/all/conanfile.py b/recipes/minizip-ng/all/conanfile.py index 5b4369c3f4103f..a40841850695a3 100644 --- a/recipes/minizip-ng/all/conanfile.py +++ b/recipes/minizip-ng/all/conanfile.py @@ -85,7 +85,7 @@ def requirements(self): if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.with_lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.0") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.with_openssl: diff --git a/recipes/minizip-ng/all/patches/3.0.8-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.8-0001-fix-cmake-project.patch new file mode 100644 index 00000000000000..608ac1f98c9c7c --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.8-0001-fix-cmake-project.patch @@ -0,0 +1,20 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index a073919..7ff2b58 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -70,6 +70,7 @@ enable_language(C) + + # Library version + set(VERSION "3.0.8") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3") +@@ -663,7 +664,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} LANGUAGES C VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/config.yml b/recipes/minizip-ng/config.yml index 60ae0e8c451f87..7802f2e3e4d7f7 100644 --- a/recipes/minizip-ng/config.yml +++ b/recipes/minizip-ng/config.yml @@ -1,4 +1,6 @@ versions: + "3.0.8": + folder: all "3.0.7": folder: all "3.0.6": diff --git a/recipes/minizip/all/conanfile.py b/recipes/minizip/all/conanfile.py index 8786a7f6a46e76..f775fd9f5b9155 100644 --- a/recipes/minizip/all/conanfile.py +++ b/recipes/minizip/all/conanfile.py @@ -55,9 +55,9 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.13") + self.requires("zlib/1.2.13", transitive_headers=True) if self.options.bzip2: - self.requires("bzip2/1.0.8") + self.requires("bzip2/1.0.8", transitive_headers=True) def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/mold/all/conandata.yml b/recipes/mold/all/conandata.yml index b90f73007307fe..1a021caadcd5c8 100644 --- a/recipes/mold/all/conandata.yml +++ b/recipes/mold/all/conandata.yml @@ -5,3 +5,9 @@ sources: "1.5.1": url: "https://github.com/rui314/mold/archive/refs/tags/v1.5.1.tar.gz" sha256: "ec94aa74758f1bc199a732af95c6304ec98292b87f2f4548ce8436a7c5b054a1" + "1.7.1": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.7.1.tar.gz" + sha256: "fa2558664db79a1e20f09162578632fa856b3cde966fbcb23084c352b827dfa9" + "1.8.0": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.8.0.tar.gz" + sha256: "7210225478796c2528aae30320232a5a3b93a640292575a8c55aa2b140041b5c" diff --git a/recipes/mold/all/conanfile.py b/recipes/mold/all/conanfile.py index fde5b3dec32935..7a48206ed37826 100644 --- a/recipes/mold/all/conanfile.py +++ b/recipes/mold/all/conanfile.py @@ -23,6 +23,8 @@ class MoldConan(ConanFile): } def validate(self): + #TODO most of these checks should run on validate_build, but the conan-center hooks are broken and fail the PR because they + # think we're raising on the build() method if self.settings.build_type == "Debug": raise ConanInvalidConfiguration('Mold is a build tool, specify mold:build_type=Release in your build profile, see https://github.com/conan-io/conan-center-index/pull/11536#issuecomment-1195607330') if self.settings.compiler in ["gcc", "clang", "intel-cc"] and self.settings.compiler.libcxx != "libstdc++11": @@ -42,11 +44,8 @@ def layout(self): def package_id(self): del self.info.settings.compiler - def build_requirements(self): - self.tool_requires("cmake/3.24.1") - def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") self.requires("openssl/1.1.1q") self.requires("xxhash/0.8.1") self.requires("onetbb/2021.3.0") @@ -62,12 +61,14 @@ def generate(self): tc.variables["MOLD_USE_MIMALLOC"] = self.options.with_mimalloc tc.variables["MOLD_USE_SYSTEM_MIMALLOC"] = True tc.variables["MOLD_USE_SYSTEM_TBB"] = True + tc.variables["CMAKE_INSTALL_LIBEXECDIR"] = "libexec" tc.generate() cd = CMakeDeps(self) cd.generate() - tc = VirtualBuildEnv(self) - tc.generate() + + vbe = VirtualBuildEnv(self) + vbe.generate() def build(self): cmake = CMake(self) @@ -81,10 +82,10 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "share")) - + def package_info(self): bindir = os.path.join(self.package_folder, "bin") - mold_location = os.path.join(bindir, "bindir") + mold_location = os.path.join(bindir, "mold") self.output.info('Appending PATH environment variable: {}'.format(bindir)) self.env_info.PATH.append(bindir) diff --git a/recipes/mold/config.yml b/recipes/mold/config.yml index 73995b17f00b1c..7461d58f360be9 100644 --- a/recipes/mold/config.yml +++ b/recipes/mold/config.yml @@ -5,3 +5,7 @@ versions: folder: all "1.5.1": folder: all + "1.7.1": + folder: all + "1.8.0": + folder: all diff --git a/recipes/moltenvk/all/conandata.yml b/recipes/moltenvk/all/conandata.yml index 2f8e73cdf66130..f9cb951dc30544 100644 --- a/recipes/moltenvk/all/conandata.yml +++ b/recipes/moltenvk/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.1": + url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.1.tar.gz" + sha256: "4742df8f35473c5a737f2b120ae06aa6b9e8a7a3753b88932e501b06b1d17ea8" "1.2.0": url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.0.tar.gz" sha256: "6e7af2dad0530b2b404480dbe437ca4670c6615cc2ec6cf6a20ed04d9d75e0bd" @@ -33,9 +36,8 @@ patches: "1.2.0": - patch_file: "patches/1.2.0-0001-fix-version-number-icd-json.patch" patch_description: "Fix api_version in MoltenVK_icd.json" - patch_type: "backport" + patch_type: "portability" patch_source: "https://github.com/KhronosGroup/MoltenVK/pull/1747" - sha256: "80387a47d24c12b538bdcb60d6aa7c402af0800519ce55385abdfbf3d304ee07" "1.1.11": - patch_file: "patches/1.1.11-0001-vulkan-alias-private-extern.patch" patch_description: "Fix vulkan alias symbols when vulkan symbols are hidden" diff --git a/recipes/moltenvk/all/conanfile.py b/recipes/moltenvk/all/conanfile.py index 1bdfb7c033f013..cc911daf940adc 100644 --- a/recipes/moltenvk/all/conanfile.py +++ b/recipes/moltenvk/all/conanfile.py @@ -103,14 +103,14 @@ def package_id(self): self.compatible_packages.append(compatible_pkg) def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - if self.info.settings.os not in ["Macos", "iOS", "tvOS"]: + if self.settings.os not in ["Macos", "iOS", "tvOS"]: raise ConanInvalidConfiguration(f"{self.ref} only supported on MacOS, iOS and tvOS") - if self.info.settings.compiler != "apple-clang": + if self.settings.compiler != "apple-clang": raise ConanInvalidConfiguration(f"{self.ref} requires apple-clang") if Version(self.version) >= "1.0.42": - if Version(self.info.settings.compiler.version) < "12.0": + if Version(self.settings.compiler.version) < "12.0": raise ConanInvalidConfiguration(f"{self.ref} requires XCode 12.0 or higher at build time") def validate_build(self): @@ -162,8 +162,10 @@ def package_info(self): if self.options.shared: moltenvk_icd_path = os.path.join(self.package_folder, "lib", "MoltenVK_icd.json") + self.runenv_info.prepend_path("VK_DRIVER_FILES", moltenvk_icd_path) self.runenv_info.prepend_path("VK_ICD_FILENAMES", moltenvk_icd_path) # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator + self.env_info.VK_DRIVER_FILES.append(moltenvk_icd_path) self.env_info.VK_ICD_FILENAMES.append(moltenvk_icd_path) if self.options.tools: diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml b/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml new file mode 100644 index 00000000000000..ba333592e01993 --- /dev/null +++ b/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml @@ -0,0 +1,4 @@ +glslang: "1.3.236.0" +spirv-cross: "1.3.236.0" +spirv-tools: "1.3.236.0" +vulkan-headers: "1.3.236.0" diff --git a/recipes/moltenvk/config.yml b/recipes/moltenvk/config.yml index df5b0f8614cc4e..2199e02c929060 100644 --- a/recipes/moltenvk/config.yml +++ b/recipes/moltenvk/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.1": + folder: all "1.2.0": folder: all "1.1.11": diff --git a/recipes/mongo-c-driver/all/conandata.yml b/recipes/mongo-c-driver/all/conandata.yml index 2546c26f4700e2..be9c59fe3dc4da 100644 --- a/recipes/mongo-c-driver/all/conandata.yml +++ b/recipes/mongo-c-driver/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.23.2": + url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.23.2/mongo-c-driver-1.23.2.tar.gz" + sha256: "123c358827eea07cd76a31c40281bb1c81b6744f6587c96d0cf217be8b1234e3" + "1.22.2": + url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.22.2/mongo-c-driver-1.22.2.tar.gz" + sha256: "2e59b9d38d600bd63ccc0b215dd44c6254a66eeb8085a5ac513748cd6220532e" "1.22.0": url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.22.0/mongo-c-driver-1.22.0.tar.gz" sha256: "272067f75e7e57c98f90a6f0c42500ef818b4b085539343676b6ce6831655eaf" @@ -15,15 +21,49 @@ sources: url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.17.2/mongo-c-driver-1.17.2.tar.gz" sha256: "bc53d5f72ab628a1ae549db6888325d6dc34db3ca31c5e16e550c1bb4266d864" patches: + "1.23.2": + - patch_file: "patches/1.23.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" + - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" + - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" + patch_description: "disable compiler flags to make warnings into errors" + patch_type: "conan" + "1.22.2": + - patch_file: "patches/1.22.0-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" + - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" + - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" + patch_description: "disable compiler flags to make warnings into errors" + patch_type: "conan" "1.22.0": - patch_file: "patches/1.22.0-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" + patch_description: "disable compiler flags to make warnings into errors" + patch_type: "conan" "1.17.6": - patch_file: "patches/1.17.6-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" "1.17.4": - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" "1.17.3": - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" "1.17.2": - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" diff --git a/recipes/mongo-c-driver/all/conanfile.py b/recipes/mongo-c-driver/all/conanfile.py index e77d7e3ce949cf..71ed6d84f36274 100644 --- a/recipes/mongo-c-driver/all/conanfile.py +++ b/recipes/mongo-c-driver/all/conanfile.py @@ -77,7 +77,7 @@ def requirements(self): if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.with_icu: - self.requires("icu/71.1") + self.requires("icu/72.1") def validate(self): if self.info.options.with_ssl == "darwin" and not is_apple_os(self.settings.os): diff --git a/recipes/mongo-c-driver/all/patches/1.23.2-0001-disable-shared-when-static.patch b/recipes/mongo-c-driver/all/patches/1.23.2-0001-disable-shared-when-static.patch new file mode 100644 index 00000000000000..1b39914f6b9213 --- /dev/null +++ b/recipes/mongo-c-driver/all/patches/1.23.2-0001-disable-shared-when-static.patch @@ -0,0 +1,82 @@ +diff --git a/src/libbson/CMakeLists.txt b/src/libbson/CMakeLists.txt +index d6df66f..dccdfee 100644 +--- a/src/libbson/CMakeLists.txt ++++ b/src/libbson/CMakeLists.txt +@@ -209,6 +209,7 @@ set (HEADERS_FORWARDING + ${PROJECT_SOURCE_DIR}/src/bson/forwarding/bson.h + ) + ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + add_library (bson_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) + set (CMAKE_CXX_VISIBILITY_PRESET hidden) + target_compile_definitions (bson_shared +@@ -275,6 +276,7 @@ if (WIN32) + # must be handled specially since we can't resolve them + set (BSON_SYSTEM_LIBRARIES ${BSON_SYSTEM_LIBRARIES} ws2_32) + endif () ++endif() + + if (MONGOC_ENABLE_STATIC_BUILD) + add_library (bson_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) +@@ -349,7 +351,7 @@ set (BSON_HEADER_INSTALL_DIR + ) + + if (MONGOC_ENABLE_STATIC_INSTALL) +- set (TARGETS_TO_INSTALL bson_shared bson_static) ++ set (TARGETS_TO_INSTALL bson_static) + else () + set (TARGETS_TO_INSTALL bson_shared) + endif () +diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt +index 39f66ac..3f4eefc 100644 +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -758,6 +758,7 @@ if (MONGOC_ENABLE_MONGODB_AWS_AUTH) + endif() + endif () + ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) + set_target_properties (mongoc_shared PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden) + target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC ${BSON_LIBRARIES}) +@@ -795,6 +796,7 @@ target_include_directories ( + + set_target_properties (mongoc_shared PROPERTIES VERSION 0.0.0 SOVERSION 0) + set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-${MONGOC_API_VERSION}") ++endif() + + if (MONGOC_ENABLE_STATIC_BUILD) + add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) +@@ -835,6 +837,7 @@ if (MONGOC_ENABLE_STATIC_BUILD) + set_target_properties (mongoc_static PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-static-${MONGOC_API_VERSION}") + endif () + ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + if (ENABLE_APPLE_FRAMEWORK) + set_target_properties (mongoc_shared PROPERTIES + FRAMEWORK TRUE +@@ -845,9 +848,15 @@ if (ENABLE_APPLE_FRAMEWORK) + PUBLIC_HEADER "${HEADERS}" + ) + endif () ++endif() + + add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c) ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES}) ++else () ++target_link_libraries (mongoc-stat mongoc_static ${STATIC_LIBRARIES}) ++endif () ++ + + # mongoc-stat works if shared memory performance counters are enabled. + if (ENABLE_SHM_COUNTERS STREQUAL "ON") +@@ -1128,7 +1137,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR} + file (COPY ${PROJECT_SOURCE_DIR}/tests/release_files DESTINATION ${PROJECT_BINARY_DIR}/tests) + + if (MONGOC_ENABLE_STATIC_INSTALL) +- set (TARGETS_TO_INSTALL mongoc_shared mongoc_static) ++ set (TARGETS_TO_INSTALL mongoc_static) + else () + set (TARGETS_TO_INSTALL mongoc_shared) + endif () diff --git a/recipes/mongo-c-driver/config.yml b/recipes/mongo-c-driver/config.yml index 59ca0a1a54b123..1b2d5cda4e3948 100644 --- a/recipes/mongo-c-driver/config.yml +++ b/recipes/mongo-c-driver/config.yml @@ -1,4 +1,8 @@ versions: + "1.23.2": + folder: all + "1.22.2": + folder: all "1.22.0": folder: all "1.17.6": diff --git a/recipes/mppp/all/conanfile.py b/recipes/mppp/all/conanfile.py index b81c5b84c795ca..f6d828ae44a497 100644 --- a/recipes/mppp/all/conanfile.py +++ b/recipes/mppp/all/conanfile.py @@ -4,10 +4,11 @@ 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 -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class MpppConan(ConanFile): name = "mppp" @@ -25,6 +26,7 @@ class MpppConan(ConanFile): "with_mpc": [True, False], "with_quadmath": [True, False], "with_boost": [True, False], + "with_fmt": [True, False], } default_options = { "shared": False, @@ -34,6 +36,7 @@ class MpppConan(ConanFile): "with_mpc": False, "with_quadmath": False, "with_boost": False, + "with_fmt": False, } @property @@ -49,10 +52,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") + if Version(self.version) < "0.27": + del self.options.with_fmt def layout(self): cmake_layout(self, src_folder="src") @@ -64,7 +66,9 @@ def requirements(self): if self.options.with_mpc == True: self.requires("mpc/1.2.0") if self.options.with_boost == True: - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") + if self.options.get_safe("with_fmt"): + self.requires("fmt/9.1.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -88,10 +92,11 @@ def generate(self): tc.variables["MPPP_WITH_MPC"] = self.options.with_mpc tc.variables["MPPP_WITH_QUADMATH"] = self.options.with_quadmath tc.variables["MPPP_WITH_BOOST_S11N"] = self.options.with_boost + if Version(self.version) >= "0.27": + tc.variables["MPPP_WITH_FMT"] = self.options.with_fmt if not self.options.shared: tc.variables["MPPP_BUILD_STATIC_LIBRARY_WITH_DYNAMIC_MSVC_RUNTIME"] = not is_msvc_static_runtime(self) tc.generate() - deps = CMakeDeps(self) deps.generate() @@ -115,6 +120,9 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") + if self.options.get_safe("with_fmt"): + self.cpp_info.defines.append("MPPP_WITH_FMT") + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "mp++" self.cpp_info.filenames["cmake_find_package_multi"] = "mp++" diff --git a/recipes/nanobench/all/conandata.yml b/recipes/nanobench/all/conandata.yml index b2980ea2da2118..35db0353ebb57f 100644 --- a/recipes/nanobench/all/conandata.yml +++ b/recipes/nanobench/all/conandata.yml @@ -1,16 +1,26 @@ sources: - "4.0.0": - url: "https://github.com/martinus/nanobench/archive/v4.0.0.tar.gz" - sha256: 34b9bbfc7bf3bc30599f3b7cb398455539edb8ea67930aaef22b707f1ad3824f - "4.3.0": - url: "https://github.com/martinus/nanobench/archive/v4.3.0.tar.gz" - sha256: 6cf97e940eca42394f64d4e9d341e72804c92575247269695beb24f7e2539e82 - "4.3.5": - url: "https://github.com/martinus/nanobench/archive/v4.3.5.tar.gz" - sha256: "205e6cf0ea901f64af971335bfe8011c1f6bd66f6ae678c616da0eddfbe70437" - "4.3.6": - url: "https://github.com/martinus/nanobench/archive/v4.3.6.tar.gz" - sha256: "cfa223fefca8752c0c96416f3440a9b02219f4695a8307db7e8c7054aaed7f01" + "4.3.9": + url: "https://github.com/martinus/nanobench/archive/v4.3.9.tar.gz" + sha256: "4a7fd8fdd5819e4d1c34ae558df010a0ccf36db0508c41c51cd0181bc04c6356" "4.3.7": url: "https://github.com/martinus/nanobench/archive/v4.3.7.tar.gz" sha256: "6a2dadb8230370c7fb7a9362be1c3677e44d8e06193a4ecb489a4748ef9483d7" + "4.3.6": + url: "https://github.com/martinus/nanobench/archive/v4.3.6.tar.gz" + sha256: "cfa223fefca8752c0c96416f3440a9b02219f4695a8307db7e8c7054aaed7f01" + "4.3.5": + url: "https://github.com/martinus/nanobench/archive/v4.3.5.tar.gz" + sha256: "205e6cf0ea901f64af971335bfe8011c1f6bd66f6ae678c616da0eddfbe70437" + "4.3.0": + url: "https://github.com/martinus/nanobench/archive/v4.3.0.tar.gz" + sha256: "6cf97e940eca42394f64d4e9d341e72804c92575247269695beb24f7e2539e82" + "4.0.0": + url: "https://github.com/martinus/nanobench/archive/v4.0.0.tar.gz" + sha256: "34b9bbfc7bf3bc30599f3b7cb398455539edb8ea67930aaef22b707f1ad3824f" + +patches: + "4.3.9": + - patch_file: "patches/4.3.9-0001-support-older-msvc.patch" + patch_description: "fix compilation error on msvc < 1928" + patch_type: "portability" + patch_source: "https://github.com/martinus/nanobench/pull/82" diff --git a/recipes/nanobench/all/conanfile.py b/recipes/nanobench/all/conanfile.py index 19c1a77a013b1f..67a58bc871cff0 100644 --- a/recipes/nanobench/all/conanfile.py +++ b/recipes/nanobench/all/conanfile.py @@ -1,33 +1,53 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches +from conan.tools.layout import basic_layout import os -import glob -from conans import ConanFile, tools +required_conan_version = ">=1.52.0" class NanobenchConan(ConanFile): name = "nanobench" description = """ankerl::nanobench is a platform independent microbenchmarking library for C++11/14/17/20.""" - topics = ("conan", "nanobench", "benchmark", "microbenchmark") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinus/nanobench" - license = "MIT" - no_copy_source = True + topics = ("benchmark", "microbenchmark", "header-only") + settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + 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.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob(self.name + "-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + apply_conandata_patches(self) def package(self): - include_folder = os.path.join( - self._source_subfolder, os.path.join("src", "include")) - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=include_folder) + 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=os.path.join(self.source_folder, "src", "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/nanobench/all/patches/4.3.9-0001-support-older-msvc.patch b/recipes/nanobench/all/patches/4.3.9-0001-support-older-msvc.patch new file mode 100644 index 00000000000000..f7d7dccdcefd75 --- /dev/null +++ b/recipes/nanobench/all/patches/4.3.9-0001-support-older-msvc.patch @@ -0,0 +1,51 @@ +diff --git a/src/include/nanobench.h b/src/include/nanobench.h +index c03d9ad..30f7353 100644 +--- a/src/include/nanobench.h ++++ b/src/include/nanobench.h +@@ -405,7 +405,11 @@ struct Config { + Config& operator=(Config const&); + Config& operator=(Config&&); + Config(Config const&); ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++ Config(Config&&); ++#else + Config(Config&&) noexcept; ++#endif + }; + ANKERL_NANOBENCH(IGNORE_PADDED_POP) + +@@ -431,7 +435,11 @@ public: + Result& operator=(Result const&); + Result& operator=(Result&&); + Result(Result const&); ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++ Result(Result&&); ++#else + Result(Result&&) noexcept; ++#endif + + // adds new measurement results + // all values are scaled by iters (except iters...) +@@ -2854,14 +2862,22 @@ Config::~Config() = default; + Config& Config::operator=(Config const&) = default; + Config& Config::operator=(Config&&) = default; + Config::Config(Config const&) = default; ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++Config::Config(Config&&) = default; ++#else + Config::Config(Config&&) noexcept = default; ++#endif + + // provide implementation here so it's only generated once + Result::~Result() = default; + Result& Result::operator=(Result const&) = default; + Result& Result::operator=(Result&&) = default; + Result::Result(Result const&) = default; ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++Result::Result(Result&&) = default; ++#else + Result::Result(Result&&) noexcept = default; ++#endif + + namespace detail { + template diff --git a/recipes/nanobench/all/test_package/CMakeLists.txt b/recipes/nanobench/all/test_package/CMakeLists.txt index 829b5ca81b9ceb..39d04ec4c71041 100644 --- a/recipes/nanobench/all/test_package/CMakeLists.txt +++ b/recipes/nanobench/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(nanobench REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE nanobench::nanobench) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/nanobench/all/test_package/conanfile.py b/recipes/nanobench/all/test_package/conanfile.py index bd7165a553cf41..e845ae751a3017 100644 --- a/recipes/nanobench/all/test_package/conanfile.py +++ b/recipes/nanobench/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 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/nanobench/all/test_v1_package/CMakeLists.txt b/recipes/nanobench/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/nanobench/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/nanobench/all/test_v1_package/conanfile.py b/recipes/nanobench/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/nanobench/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/nanobench/config.yml b/recipes/nanobench/config.yml index a48eba85edbb2c..e4f35b37cfb39a 100644 --- a/recipes/nanobench/config.yml +++ b/recipes/nanobench/config.yml @@ -1,11 +1,13 @@ versions: - "4.0.0": + "4.3.9": folder: "all" - "4.3.0": + "4.3.7": + folder: "all" + "4.3.6": folder: "all" "4.3.5": folder: "all" - "4.3.6": + "4.3.0": folder: "all" - "4.3.7": + "4.0.0": folder: "all" diff --git a/recipes/nss/all/conandata.yml b/recipes/nss/all/conandata.yml index 923df56524bb21..ba9a629c0dc743 100644 --- a/recipes/nss/all/conandata.yml +++ b/recipes/nss/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.87": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_87_RTM/src/nss-3.87.tar.gz" + sha256: "68a1894496d3d158babc75f8a5dda3f55b7c1560573936e3b101a10fa4ac152d" "3.86": url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_86_RTM/src/nss-3.86.tar.gz" sha256: "3f385fc686476bbba811035fa6821b542475d55747b18c20c221d4d66573b975" diff --git a/recipes/nss/config.yml b/recipes/nss/config.yml index c0aec8621018b1..3a207829091408 100644 --- a/recipes/nss/config.yml +++ b/recipes/nss/config.yml @@ -1,4 +1,6 @@ versions: + "3.87": + folder: all "3.86": folder: all "3.85": diff --git a/recipes/oboe/all/conandata.yml b/recipes/oboe/all/conandata.yml new file mode 100644 index 00000000000000..93bb5ba9ec0896 --- /dev/null +++ b/recipes/oboe/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.7.0": + url: "https://github.com/google/oboe/archive/refs/tags/1.7.0.tar.gz" + sha256: "b01896f9180f725a38806cfef73a29b36b2ea37f91389ed4e69d664ce83b79b6" +patches: + "1.7.0": + - patch_file: "patches/1.7.0-0001-fix-cmake.patch" + patch_description: "Fix CMakeLists" + patch_type: "conan" diff --git a/recipes/oboe/all/conanfile.py b/recipes/oboe/all/conanfile.py new file mode 100644 index 00000000000000..a70215ca04760d --- /dev/null +++ b/recipes/oboe/all/conanfile.py @@ -0,0 +1,65 @@ +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 +import os + +required_conan_version = ">=1.53.0" + + +class OboeConan(ConanFile): + name = "oboe" + description = "Oboe is a C++ library which makes it easy to build high-performance audio apps on Android." + license = "Apache-2.0" + topics = ("android", "audio") + homepage = "https://github.com/google/oboe" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type", + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + if self.settings.os != "Android": + raise ConanInvalidConfiguration("oboe supports Android only") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 17) + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + 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() + + def package_info(self): + self.cpp_info.libs = ["oboe"] + self.cpp_info.system_libs.extend(["log", "OpenSLES"]) diff --git a/recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch b/recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..452cd94a1c2bbf --- /dev/null +++ b/recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -79,13 +79,13 @@ target_include_directories(oboe + # Enable -Ofast + target_compile_options(oboe + PRIVATE +- -std=c++17 + -Wall + -Wextra-semi + -Wshadow + -Wshadow-field + -Ofast +- "$<$:-Werror>") ++) ++target_compile_features(oboe PUBLIC cxx_std_17) + + # Enable logging of D,V for debug builds + target_compile_definitions(oboe PUBLIC $<$:OBOE_ENABLE_LOGGING=1>) +@@ -94,8 +94,8 @@ target_link_libraries(oboe PRIVATE log OpenSLES) + + # When installing oboe put the libraries in the lib/ folder e.g. lib/arm64-v8a + install(TARGETS oboe +- LIBRARY DESTINATION lib/${ANDROID_ABI} +- ARCHIVE DESTINATION lib/${ANDROID_ABI}) ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + + # Also install the headers + install(DIRECTORY include/oboe DESTINATION include) +\ No newline at end of file diff --git a/recipes/oboe/all/test_package/CMakeLists.txt b/recipes/oboe/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..9f44285ca4f5d1 --- /dev/null +++ b/recipes/oboe/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(oboe REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oboe::oboe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/oboe/all/test_package/conanfile.py b/recipes/oboe/all/test_package/conanfile.py new file mode 100644 index 00000000000000..0a6bc68712d901 --- /dev/null +++ b/recipes/oboe/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/oboe/all/test_package/test_package.cpp b/recipes/oboe/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..2fda5758397707 --- /dev/null +++ b/recipes/oboe/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + +int main() { + oboe::AudioStreamBuilder builder; + builder.setDirection(oboe::Direction::Output); + builder.setPerformanceMode(oboe::PerformanceMode::LowLatency); + builder.setSharingMode(oboe::SharingMode::Exclusive); + builder.setFormat(oboe::AudioFormat::Float); + builder.setChannelCount(oboe::ChannelCount::Mono); + return 0; +} diff --git a/recipes/oboe/all/test_v1_package/CMakeLists.txt b/recipes/oboe/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/oboe/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/oboe/all/test_v1_package/conanfile.py b/recipes/oboe/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/oboe/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/oboe/config.yml b/recipes/oboe/config.yml new file mode 100644 index 00000000000000..0f57b11de8fb0a --- /dev/null +++ b/recipes/oboe/config.yml @@ -0,0 +1,3 @@ +versions: + "1.7.0": + folder: all diff --git a/recipes/odbc/all/conanfile.py b/recipes/odbc/all/conanfile.py index 929c7ac4a289fe..9bd75ab0988ca4 100644 --- a/recipes/odbc/all/conanfile.py +++ b/recipes/odbc/all/conanfile.py @@ -10,6 +10,7 @@ class OdbcConan(ConanFile): name = "odbc" + package_type = "library" description = "Package providing unixODBC" topics = ("odbc", "database", "dbms", "data-access") url = "https://github.com/conan-io/conan-center-index" diff --git a/recipes/odbc/all/test_package/conanfile.py b/recipes/odbc/all/test_package/conanfile.py index 1278841f612987..a0bef6bd96975d 100644 --- a/recipes/odbc/all/test_package/conanfile.py +++ b/recipes/odbc/all/test_package/conanfile.py @@ -13,7 +13,7 @@ def layout(self): cmake_layout(self) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str, run=True) def build(self): cmake = CMake(self) diff --git a/recipes/opencv/4.x/CMakeLists.txt b/recipes/opencv/4.x/CMakeLists.txt deleted file mode 100644 index a401f82668b0c2..00000000000000 --- a/recipes/opencv/4.x/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -if (WITH_OPENEXR) - set(CMAKE_CXX_STANDARD 11) -endif() - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_OPENCV_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/opencv/4.x/conandata.yml b/recipes/opencv/4.x/conandata.yml index 88bdca68c62a1a..8eacd70bbab688 100644 --- a/recipes/opencv/4.x/conandata.yml +++ b/recipes/opencv/4.x/conandata.yml @@ -30,8 +30,66 @@ sources: - url: "https://github.com/opencv/opencv_contrib/archive/4.1.2.tar.gz" sha256: "0f6c3d30baa39e3e7611afb481ee86dea45dafb182cac87d570c95dccd83eb8b" patches: + "4.5.5": + - patch_file: "patches/4.5.5-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + "4.5.3": + - patch_file: "patches/4.5.3-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + "4.5.2": + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + "4.5.1": + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + "4.5.0": + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" "4.1.2": - - patch_file: "patches/0001-jasper.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-openexr.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.1.2-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.1.2-0004-jasper.patch" + patch_description: "Compatibility with recent jasper versions" + patch_type: "portability" diff --git a/recipes/opencv/4.x/conanfile.py b/recipes/opencv/4.x/conanfile.py index dc6c82ea44df3d..442154091f09dc 100644 --- a/recipes/opencv/4.x/conanfile.py +++ b/recipes/opencv/4.x/conanfile.py @@ -1,10 +1,16 @@ -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.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rename, replace_in_file, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version +from conans.tools import to_android_abi import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class OpenCVConan(ConanFile): @@ -25,7 +31,7 @@ class OpenCVConan(ConanFile): "parallel": [False, "tbb", "openmp"], "with_ipp": [False, "intel-ipp", "opencv-icv"], "with_ade": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "with_png": [True, False], "with_tiff": [True, False], "with_jpeg2000": [False, "jasper", "openjpeg"], @@ -47,9 +53,9 @@ class OpenCVConan(ConanFile): "neon": [True, False], "dnn": [True, False], "dnn_cuda": [True, False], - "cuda_arch_bin": "ANY", - "cpu_baseline": "ANY", - "cpu_dispatch": "ANY", + "cuda_arch_bin": [None, "ANY"], + "cpu_baseline": [None, "ANY"], + "cpu_dispatch": [None, "ANY"], "nonfree": [True, False], } default_options = { @@ -90,24 +96,10 @@ class OpenCVConan(ConanFile): } short_paths = True - 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 _contrib_folder(self): - return "contrib" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + return os.path.join(self.source_folder, "contrib") @property def _has_with_jpeg2000_option(self): @@ -123,12 +115,10 @@ def _has_with_ffmpeg_option(self): @property def _protobuf_version(self): - return "protobuf/3.17.1" + return "3.17.1" 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": @@ -154,7 +144,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.contrib: del self.options.contrib_freetype del self.options.contrib_sfm @@ -175,356 +165,339 @@ def configure(self): if self.settings.os == "Android": self.options.with_openexr = False # disabled because this forces linkage to libc++_shared.so + 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.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.get_safe("with_jpeg2000") == "jasper": - self.requires("jasper/2.0.33") + self.requires("jasper/4.0.0") elif self.options.get_safe("with_jpeg2000") == "openjpeg": - self.requires("openjpeg/2.4.0") + self.requires("openjpeg/2.5.0") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_openexr: - self.requires("openexr/2.5.7") + if Version(self.version) < "4.5.3": + # opencv < 4.5.3 doesn't support openexr >= 3 + self.requires("openexr/2.5.7") + else: + self.requires("openexr/3.1.5") if self.options.get_safe("with_tiff"): - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.with_eigen: self.requires("eigen/3.3.9") if self.options.get_safe("with_ffmpeg"): + # opencv doesn't support ffmpeg >= 5.0.0 for the moment (until 4.5.5 at least) self.requires("ffmpeg/4.4") if self.options.parallel == "tbb": - self.requires("onetbb/2020.3") + self.requires("onetbb/2021.7.0") if self.options.with_ipp == "intel-ipp": self.requires("intel-ipp/2020") if self.options.with_webp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.2.4") if self.options.get_safe("contrib_freetype"): - self.requires("freetype/2.11.1") - self.requires("harfbuzz/3.2.0") + self.requires("freetype/2.12.1") + self.requires("harfbuzz/6.0.0") if self.options.get_safe("contrib_sfm"): self.requires("gflags/2.2.2") - self.requires("glog/0.5.0") + self.requires("glog/0.6.0") if self.options.with_quirc: self.requires("quirc/1.1") if self.options.get_safe("with_gtk"): self.requires("gtk/system") if self.options.dnn: - self.requires(self._protobuf_version) + self.requires(f"protobuf/{self._protobuf_version}") if self.options.with_ade: - self.requires("ade/0.1.1f") + self.requires("ade/0.1.2a") def validate(self): - if self.options.shared and self._is_msvc and "MT" in msvc_runtime_flag(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Visual Studio with static runtime is not supported for shared library.") - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) < "4": + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "4": raise ConanInvalidConfiguration("Clang 3.x can't build OpenCV 4.x due to an internal bug.") if self.options.with_cuda and not self.options.contrib: raise ConanInvalidConfiguration("contrib must be enabled for cuda") - if self.options.get_safe("dnn_cuda", False) and \ + if self.options.get_safe("dnn_cuda") and \ (not self.options.with_cuda or not self.options.contrib or not self.options.with_cublas or not self.options.with_cudnn): raise ConanInvalidConfiguration("with_cublas, with_cudnn and contrib must be enabled for dnn_cuda") if self.options.with_ipp == "opencv-icv" and \ (not str(self.settings.arch) in ["x86", "x86_64"] or \ not str(self.settings.os) in ["Linux", "Macos", "Windows"]): - raise ConanInvalidConfiguration("opencv-icv is not available for %s/%s" % \ - (str(self.settings.os), str(self.settings.arch))) + raise ConanInvalidConfiguration(f"opencv-icv is not available for {self.settings.os}/{self.settings.arch}") def build_requirements(self): - if self.options.dnn and hasattr(self, "settings_build"): - self.build_requires(self._protobuf_version) + if self.options.dnn: + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires(f"protobuf/{self._protobuf_version}") def source(self): - tools.get(**self.conan_data["sources"][self.version][0], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][0], + destination=self.source_folder, strip_root=True) - tools.get(**self.conan_data["sources"][self.version][1], - destination=self._contrib_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][1], + destination=self._contrib_folder, strip_root=True) - def _patch_opencv(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - for directory in ['libjasper', 'libjpeg-turbo', 'libjpeg', 'libpng', 'libtiff', 'libwebp', 'openexr', 'protobuf', 'zlib', 'quirc']: - tools.rmdir(os.path.join(self._source_subfolder, '3rdparty', directory)) - if self.options.with_openexr: - find_openexr = os.path.join(self._source_subfolder, "cmake", "OpenCVFindOpenEXR.cmake") - tools.replace_in_file(find_openexr, - r'SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder")', - "") - tools.replace_in_file(find_openexr, "SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug)", "") - tools.replace_in_file(find_openexr, "SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)", "") + def _patch_sources(self): + apply_conandata_patches(self) + for directory in ["libjasper", "libjpeg-turbo", "libjpeg", "libpng", "libtiff", "libwebp", "openexr", "protobuf", "zlib", "quirc"]: + rmdir(self, os.path.join(self.source_folder, "3rdparty", directory)) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "ANDROID OR NOT UNIX", "FALSE") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "elseif(EMSCRIPTEN)", "elseif(QNXNTO)\nelseif(EMSCRIPTEN)") - tools.replace_in_file(os.path.join(self._source_subfolder, "modules", "imgcodecs", "CMakeLists.txt"), "JASPER_", "Jasper_") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "ANDROID OR NOT UNIX", "FALSE") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "elseif(EMSCRIPTEN)", "elseif(QNXNTO)\nelseif(EMSCRIPTEN)") + replace_in_file(self, os.path.join(self.source_folder, "modules", "imgcodecs", "CMakeLists.txt"), "JASPER_", "Jasper_") + + # Fix detection of ffmpeg + replace_in_file(self, os.path.join(self.source_folder, "modules", "videoio", "cmake", "detect_ffmpeg.cmake"), + "FFMPEG_FOUND", "ffmpeg_FOUND") # Cleanup RPATH - if tools.Version(self.version) < "4.1.2": - install_layout_file = os.path.join(self._source_subfolder, "CMakeLists.txt") + if Version(self.version) < "4.1.2": + install_layout_file = os.path.join(self.source_folder, "CMakeLists.txt") else: - install_layout_file = os.path.join(self._source_subfolder, "cmake", "OpenCVInstallLayout.cmake") - tools.replace_in_file(install_layout_file, + install_layout_file = os.path.join(self.source_folder, "cmake", "OpenCVInstallLayout.cmake") + replace_in_file(self, install_layout_file, "ocv_update(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}\")", "") - tools.replace_in_file(install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") + replace_in_file(self, install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") if self.options.dnn: - find_protobuf = os.path.join(self._source_subfolder, "cmake", "OpenCVFindProtobuf.cmake") - # variables generated by protobuf recipe have all lowercase prefixes - tools.replace_in_file(find_protobuf, - 'find_package(Protobuf QUIET)', - '''find_package(Protobuf QUIET) - if(NOT DEFINED Protobuf_LIBRARIES) - set(Protobuf_LIBRARIES ${protobuf_LIBRARIES}) - endif() - if(NOT DEFINED Protobuf_LIBRARY) - set(Protobuf_LIBRARY ${protobuf_LIBS}) - endif() - if(NOT DEFINED Protobuf_INCLUDE_DIR) - set(Protobuf_INCLUDE_DIR ${protobuf_INCLUDE_DIR}) - endif()''') + find_protobuf = os.path.join(self.source_folder, "cmake", "OpenCVFindProtobuf.cmake") + # OpenCV expects to find FindProtobuf.cmake, not the config file + replace_in_file(self, find_protobuf, + "find_package(Protobuf QUIET)", + "find_package(Protobuf REQUIRED MODULE)") # in 'if' block, get_target_property() produces an error - if tools.Version(self.version) >= "4.4.0": - tools.replace_in_file(find_protobuf, + if Version(self.version) >= "4.4.0": + replace_in_file(self, find_protobuf, 'if(TARGET "${Protobuf_LIBRARIES}")', 'if(FALSE) # patch: disable if(TARGET "${Protobuf_LIBRARIES}")') - if self.options.with_ade: - ade_cmake = os.path.join(self._source_subfolder, "modules", "gapi", - "cmake", "init.cmake") - replacement = '''find_package(ade REQUIRED) - if(ade_DIR)''' - tools.replace_in_file(ade_cmake, 'if(ade_DIR)', replacement, strict=False) - tools.replace_in_file(ade_cmake, 'if (ade_DIR)', replacement, strict=False) - tools.replace_in_file(ade_cmake, "TARGET ade", "TARGET ade::ade") - gapi_cmake = os.path.join(self._source_subfolder, "modules", "gapi", "CMakeLists.txt") - tools.replace_in_file(gapi_cmake, " ade)", " ade::ade)") - - if self.options.contrib and self.options.contrib_sfm and tools.Version(self.version) <= "4.5.2": + + if self.options.get_safe("contrib_freetype"): + freetype_cmake = os.path.join(self._contrib_folder, "modules", "freetype", "CMakeLists.txt") + replace_in_file(self, freetype_cmake, "ocv_check_modules(FREETYPE freetype2)", "find_package(Freetype REQUIRED MODULE)") + replace_in_file(self, freetype_cmake, "FREETYPE_", "Freetype_") + + replace_in_file(self, freetype_cmake, "ocv_check_modules(HARFBUZZ harfbuzz)", "find_package(harfbuzz REQUIRED)") + replace_in_file(self, freetype_cmake, "HARFBUZZ_", "harfbuzz_") + + if self.options.get_safe("contrib_sfm") and Version(self.version) <= "4.5.2": sfm_cmake = os.path.join(self._contrib_folder, "modules", "sfm", "CMakeLists.txt") - ver = tools.Version(self.version) + ver = Version(self.version) if ver <= "4.5.0": - search = ' find_package(Glog QUIET)\nendif()' + search = " find_package(Glog QUIET)\nendif()" else: search = ' set(GLOG_INCLUDE_DIRS "${GLOG_INCLUDE_DIR}")\nendif()' - tools.replace_in_file(sfm_cmake, search, """{} + replace_in_file(self, sfm_cmake, search, f"""{search} if(NOT GFLAGS_LIBRARIES AND TARGET gflags::gflags) set(GFLAGS_LIBRARIES gflags::gflags) endif() if(NOT GLOG_LIBRARIES AND TARGET glog::glog) set(GLOG_LIBRARIES glog::glog) - endif()""".format(search)) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OPENCV_CONFIG_INSTALL_PATH"] = "cmake" - self._cmake.definitions["OPENCV_BIN_INSTALL_PATH"] = "bin" - self._cmake.definitions["OPENCV_LIB_INSTALL_PATH"] = "lib" - self._cmake.definitions["OPENCV_3P_LIB_INSTALL_PATH"] = "lib" - self._cmake.definitions["OPENCV_OTHER_INSTALL_PATH"] = "res" - self._cmake.definitions["OPENCV_LICENSES_INSTALL_PATH"] = "licenses" - - self._cmake.definitions["BUILD_CUDA_STUBS"] = False - self._cmake.definitions["BUILD_DOCS"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_FAT_JAVA_LIB"] = False - self._cmake.definitions["BUILD_IPP_IW"] = False - self._cmake.definitions["BUILD_ITT"] = False - self._cmake.definitions["BUILD_JASPER"] = False - self._cmake.definitions["BUILD_JAVA"] = False - self._cmake.definitions["BUILD_JPEG"] = False - self._cmake.definitions["BUILD_OPENEXR"] = False - self._cmake.definitions["BUILD_OPENJPEG"] = False - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_PROTOBUF"] = False - self._cmake.definitions["BUILD_PACKAGE"] = False - self._cmake.definitions["BUILD_PERF_TESTS"] = False - self._cmake.definitions["BUILD_USE_SYMLINKS"] = False - self._cmake.definitions["BUILD_opencv_apps"] = False - self._cmake.definitions["BUILD_opencv_java"] = False - self._cmake.definitions["BUILD_opencv_java_bindings_gen"] = False - self._cmake.definitions["BUILD_opencv_js"] = False - self._cmake.definitions["BUILD_ZLIB"] = False - self._cmake.definitions["BUILD_PNG"] = False - self._cmake.definitions["BUILD_TIFF"] = False - self._cmake.definitions["BUILD_WEBP"] = False - self._cmake.definitions["BUILD_TBB"] = False - self._cmake.definitions["OPENCV_FORCE_3RDPARTY_BUILD"] = False - self._cmake.definitions["OPENCV_PYTHON_SKIP_DETECTION"] = True - self._cmake.definitions["BUILD_opencv_python2"] = False - self._cmake.definitions["BUILD_opencv_python3"] = False - self._cmake.definitions["BUILD_opencv_python_bindings_g"] = False - self._cmake.definitions["BUILD_opencv_python_tests"] = False - self._cmake.definitions["BUILD_opencv_ts"] = False - - self._cmake.definitions["WITH_1394"] = False - self._cmake.definitions["WITH_ADE"] = False - self._cmake.definitions["WITH_ARAVIS"] = False - self._cmake.definitions["WITH_CLP"] = False - self._cmake.definitions["WITH_NVCUVID"] = False - - self._cmake.definitions["WITH_FFMPEG"] = self.options.get_safe("with_ffmpeg") + endif()""") + + def generate(self): + if self.options.dnn: + if hasattr(self, "settings_build") and cross_building(self): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["OPENCV_CONFIG_INSTALL_PATH"] = "cmake" + tc.variables["OPENCV_BIN_INSTALL_PATH"] = "bin" + tc.variables["OPENCV_LIB_INSTALL_PATH"] = "lib" + tc.variables["OPENCV_3P_LIB_INSTALL_PATH"] = "lib" + tc.variables["OPENCV_OTHER_INSTALL_PATH"] = "res" + tc.variables["OPENCV_LICENSES_INSTALL_PATH"] = "licenses" + + tc.variables["BUILD_CUDA_STUBS"] = False + tc.variables["BUILD_DOCS"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_FAT_JAVA_LIB"] = False + tc.variables["BUILD_IPP_IW"] = False + tc.variables["BUILD_ITT"] = False + tc.variables["BUILD_JASPER"] = False + tc.variables["BUILD_JAVA"] = False + tc.variables["BUILD_JPEG"] = False + tc.variables["BUILD_OPENEXR"] = False + tc.variables["BUILD_OPENJPEG"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_PROTOBUF"] = False + tc.variables["BUILD_PACKAGE"] = False + tc.variables["BUILD_PERF_TESTS"] = False + tc.variables["BUILD_USE_SYMLINKS"] = False + tc.variables["BUILD_opencv_apps"] = False + tc.variables["BUILD_opencv_java"] = False + tc.variables["BUILD_opencv_java_bindings_gen"] = False + tc.variables["BUILD_opencv_js"] = False + tc.variables["BUILD_ZLIB"] = False + tc.variables["BUILD_PNG"] = False + tc.variables["BUILD_TIFF"] = False + tc.variables["BUILD_WEBP"] = False + tc.variables["BUILD_TBB"] = False + tc.variables["OPENCV_FORCE_3RDPARTY_BUILD"] = False + tc.variables["OPENCV_PYTHON_SKIP_DETECTION"] = True + tc.variables["BUILD_opencv_python2"] = False + tc.variables["BUILD_opencv_python3"] = False + tc.variables["BUILD_opencv_python_bindings_g"] = False + tc.variables["BUILD_opencv_python_tests"] = False + tc.variables["BUILD_opencv_ts"] = False + + tc.variables["WITH_1394"] = False + tc.variables["WITH_ADE"] = False + tc.variables["WITH_ARAVIS"] = False + tc.variables["WITH_CLP"] = False + tc.variables["WITH_NVCUVID"] = False + + tc.variables["WITH_FFMPEG"] = self.options.get_safe("with_ffmpeg") if self.options.get_safe("with_ffmpeg"): - self._cmake.definitions["OPENCV_FFMPEG_SKIP_BUILD_CHECK"] = True - self._cmake.definitions["OPENCV_FFMPEG_SKIP_DOWNLOAD"] = True + tc.variables["OPENCV_FFMPEG_SKIP_BUILD_CHECK"] = True + tc.variables["OPENCV_FFMPEG_SKIP_DOWNLOAD"] = True # opencv will not search for ffmpeg package, but for # libavcodec;libavformat;libavutil;libswscale modules - self._cmake.definitions["OPENCV_FFMPEG_USE_FIND_PACKAGE"] = "ffmpeg" - self._cmake.definitions["OPENCV_INSTALL_FFMPEG_DOWNLOAD_SCRIPT"] = False - self._cmake.definitions["FFMPEG_LIBRARIES"] = "ffmpeg::avcodec;ffmpeg::avformat;ffmpeg::avutil;ffmpeg::swscale" + tc.variables["OPENCV_FFMPEG_USE_FIND_PACKAGE"] = "ffmpeg" + tc.variables["OPENCV_INSTALL_FFMPEG_DOWNLOAD_SCRIPT"] = False + tc.variables["FFMPEG_LIBRARIES"] = "ffmpeg::avcodec;ffmpeg::avformat;ffmpeg::avutil;ffmpeg::swscale" for component in ["avcodec", "avformat", "avutil", "swscale", "avresample"]: - self._cmake.definitions["FFMPEG_lib%s_VERSION" % component] = self.deps_cpp_info["ffmpeg"].components[component].version - - self._cmake.definitions["WITH_GSTREAMER"] = False - self._cmake.definitions["WITH_HALIDE"] = False - self._cmake.definitions["WITH_HPX"] = False - self._cmake.definitions["WITH_IMGCODEC_HDR"] = self.options.with_imgcodec_hdr - self._cmake.definitions["WITH_IMGCODEC_PFM"] = self.options.with_imgcodec_pfm - self._cmake.definitions["WITH_IMGCODEC_PXM"] = self.options.with_imgcodec_pxm - self._cmake.definitions["WITH_IMGCODEC_SUNRASTER"] = self.options.with_imgcodec_sunraster - self._cmake.definitions["WITH_INF_ENGINE"] = False - self._cmake.definitions["WITH_IPP"] = False + # TODO: use self.dependencies once https://github.com/conan-io/conan/issues/12728 fixed + ffmpeg_component_version = self.deps_cpp_info["ffmpeg"].components[component].version + tc.variables[f"FFMPEG_lib{component}_VERSION"] = ffmpeg_component_version + + tc.variables["WITH_GSTREAMER"] = False + tc.variables["WITH_HALIDE"] = False + tc.variables["WITH_HPX"] = False + tc.variables["WITH_IMGCODEC_HDR"] = self.options.with_imgcodec_hdr + tc.variables["WITH_IMGCODEC_PFM"] = self.options.with_imgcodec_pfm + tc.variables["WITH_IMGCODEC_PXM"] = self.options.with_imgcodec_pxm + tc.variables["WITH_IMGCODEC_SUNRASTER"] = self.options.with_imgcodec_sunraster + tc.variables["WITH_INF_ENGINE"] = False + tc.variables["WITH_IPP"] = False if self.options.with_ipp: - self._cmake.definitions["WITH_IPP"] = True + tc.variables["WITH_IPP"] = True if self.options.with_ipp == "intel-ipp": - ipp_root = self.deps_cpp_info["intel-ipp"].rootpath + ipp_root = self.dependencies["intel-ipp"].package_folder.replace("\\", "/") if self.settings.os == "Windows": ipp_root = ipp_root.replace("\\", "/") - self._cmake.definitions["IPPROOT"] = ipp_root - self._cmake.definitions["IPPIWROOT"] = ipp_root + tc.variables["IPPROOT"] = ipp_root + tc.variables["IPPIWROOT"] = ipp_root else: - self._cmake.definitions["BUILD_IPP_IW"] = True - self._cmake.definitions["WITH_ITT"] = False - self._cmake.definitions["WITH_LIBREALSENSE"] = False - self._cmake.definitions["WITH_MFX"] = False - self._cmake.definitions["WITH_NGRAPH"] = False - self._cmake.definitions["WITH_OPENCL"] = False - self._cmake.definitions["WITH_OPENCLAMDBLAS"] = False - self._cmake.definitions["WITH_OPENCLAMDFFT"] = False - self._cmake.definitions["WITH_OPENCL_SVM"] = False - self._cmake.definitions["WITH_OPENGL"] = False - self._cmake.definitions["WITH_OPENMP"] = False - self._cmake.definitions["WITH_OPENNI"] = False - self._cmake.definitions["WITH_OPENNI2"] = False - self._cmake.definitions["WITH_OPENVX"] = False - self._cmake.definitions["WITH_PLAIDML"] = False - self._cmake.definitions["WITH_PVAPI"] = False - self._cmake.definitions["WITH_QT"] = False - self._cmake.definitions["WITH_QUIRC"] = False - self._cmake.definitions["WITH_V4L"] = self.options.get_safe("with_v4l", False) - self._cmake.definitions["WITH_VA"] = False - self._cmake.definitions["WITH_VA_INTEL"] = False - self._cmake.definitions["WITH_VTK"] = False - self._cmake.definitions["WITH_VULKAN"] = False - self._cmake.definitions["WITH_XIMEA"] = False - self._cmake.definitions["WITH_XINE"] = False - self._cmake.definitions["WITH_LAPACK"] = False - - self._cmake.definitions["WITH_GTK"] = self.options.get_safe("with_gtk", False) - self._cmake.definitions["WITH_GTK_2_X"] = self._is_gtk_version2 - self._cmake.definitions["WITH_WEBP"] = self.options.with_webp - self._cmake.definitions["WITH_JPEG"] = self.options.with_jpeg != False - self._cmake.definitions["WITH_PNG"] = self.options.with_png + tc.variables["BUILD_IPP_IW"] = True + tc.variables["WITH_ITT"] = False + tc.variables["WITH_LIBREALSENSE"] = False + tc.variables["WITH_MFX"] = False + tc.variables["WITH_NGRAPH"] = False + tc.variables["WITH_OPENCL"] = False + tc.variables["WITH_OPENCLAMDBLAS"] = False + tc.variables["WITH_OPENCLAMDFFT"] = False + tc.variables["WITH_OPENCL_SVM"] = False + tc.variables["WITH_OPENGL"] = False + tc.variables["WITH_OPENMP"] = False + tc.variables["WITH_OPENNI"] = False + tc.variables["WITH_OPENNI2"] = False + tc.variables["WITH_OPENVX"] = False + tc.variables["WITH_PLAIDML"] = False + tc.variables["WITH_PVAPI"] = False + tc.variables["WITH_QT"] = False + tc.variables["WITH_QUIRC"] = False + tc.variables["WITH_V4L"] = self.options.get_safe("with_v4l", False) + tc.variables["WITH_VA"] = False + tc.variables["WITH_VA_INTEL"] = False + tc.variables["WITH_VTK"] = False + tc.variables["WITH_VULKAN"] = False + tc.variables["WITH_XIMEA"] = False + tc.variables["WITH_XINE"] = False + tc.variables["WITH_LAPACK"] = False + + tc.variables["WITH_GTK"] = self.options.get_safe("with_gtk", False) + tc.variables["WITH_GTK_2_X"] = self._is_gtk_version2 + tc.variables["WITH_WEBP"] = self.options.with_webp + tc.variables["WITH_JPEG"] = bool(self.options.with_jpeg) + tc.variables["WITH_PNG"] = self.options.with_png if self._has_with_tiff_option: - self._cmake.definitions["WITH_TIFF"] = self.options.with_tiff + tc.variables["WITH_TIFF"] = self.options.with_tiff if self._has_with_jpeg2000_option: - self._cmake.definitions["WITH_JASPER"] = self.options.with_jpeg2000 == "jasper" - self._cmake.definitions["WITH_OPENJPEG"] = self.options.with_jpeg2000 == "openjpeg" - self._cmake.definitions["WITH_OPENEXR"] = self.options.with_openexr - self._cmake.definitions["WITH_EIGEN"] = self.options.with_eigen - self._cmake.definitions["HAVE_QUIRC"] = self.options.with_quirc # force usage of quirc requirement - self._cmake.definitions["WITH_DSHOW"] = self._is_msvc - self._cmake.definitions["WITH_MSMF"] = self._is_msvc - self._cmake.definitions["WITH_MSMF_DXVA"] = self._is_msvc - self._cmake.definitions["OPENCV_MODULES_PUBLIC"] = "opencv" - self._cmake.definitions["OPENCV_ENABLE_NONFREE"] = self.options.nonfree + tc.variables["WITH_JASPER"] = self.options.with_jpeg2000 == "jasper" + tc.variables["WITH_OPENJPEG"] = self.options.with_jpeg2000 == "openjpeg" + tc.variables["WITH_OPENEXR"] = self.options.with_openexr + if self.options.with_openexr: + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["WITH_EIGEN"] = self.options.with_eigen + tc.variables["HAVE_QUIRC"] = self.options.with_quirc # force usage of quirc requirement + tc.variables["WITH_DSHOW"] = is_msvc(self) + tc.variables["WITH_MSMF"] = is_msvc(self) + tc.variables["WITH_MSMF_DXVA"] = is_msvc(self) + tc.variables["OPENCV_MODULES_PUBLIC"] = "opencv" + tc.variables["OPENCV_ENABLE_NONFREE"] = self.options.nonfree if self.options.cpu_baseline: - self._cmake.definitions["CPU_BASELINE"] = self.options.cpu_baseline + tc.variables["CPU_BASELINE"] = self.options.cpu_baseline if self.options.cpu_dispatch: - self._cmake.definitions["CPU_DISPATCH"] = self.options.cpu_dispatch + tc.variables["CPU_DISPATCH"] = self.options.cpu_dispatch if self.options.get_safe("neon") is not None: - self._cmake.definitions["ENABLE_NEON"] = self.options.get_safe("neon") + tc.variables["ENABLE_NEON"] = self.options.get_safe("neon") - self._cmake.definitions["WITH_PROTOBUF"] = self.options.dnn + tc.variables["WITH_PROTOBUF"] = self.options.dnn if self.options.dnn: - self._cmake.definitions["PROTOBUF_UPDATE_FILES"] = True - self._cmake.definitions["BUILD_opencv_dnn"] = True - self._cmake.definitions["OPENCV_DNN_CUDA"] = self.options.get_safe("dnn_cuda", False) + tc.variables["PROTOBUF_UPDATE_FILES"] = True + tc.variables["BUILD_opencv_dnn"] = True + tc.variables["OPENCV_DNN_CUDA"] = self.options.get_safe("dnn_cuda", False) if self.options.contrib: - self._cmake.definitions['OPENCV_EXTRA_MODULES_PATH'] = os.path.join(self.build_folder, self._contrib_folder, 'modules') - self._cmake.definitions['BUILD_opencv_freetype'] = self.options.get_safe("contrib_freetype", False) - self._cmake.definitions['BUILD_opencv_sfm'] = self.options.get_safe("contrib_sfm", False) + tc.variables["OPENCV_EXTRA_MODULES_PATH"] = os.path.join(self._contrib_folder, "modules").replace("\\", "/") + tc.variables["BUILD_opencv_freetype"] = self.options.get_safe("contrib_freetype", False) + tc.variables["BUILD_opencv_sfm"] = self.options.get_safe("contrib_sfm", False) - if self.options.with_openexr: - self._cmake.definitions["OPENEXR_ROOT"] = self.deps_cpp_info["openexr"].rootpath if self.options.get_safe("with_jpeg2000") == "openjpeg": - openjpeg_version = tools.Version(self.deps_cpp_info["openjpeg"].version) - self._cmake.definitions["OPENJPEG_MAJOR_VERSION"] = openjpeg_version.major - self._cmake.definitions["OPENJPEG_MINOR_VERSION"] = openjpeg_version.minor - self._cmake.definitions["OPENJPEG_BUILD_VERSION"] = openjpeg_version.patch + openjpeg_version = Version(self.dependencies["openjpeg"].ref.version) + tc.variables["OPENJPEG_MAJOR_VERSION"] = openjpeg_version.major + tc.variables["OPENJPEG_MINOR_VERSION"] = openjpeg_version.minor + tc.variables["OPENJPEG_BUILD_VERSION"] = openjpeg_version.patch if self.options.parallel: - self._cmake.definitions["WITH_TBB"] = self.options.parallel == "tbb" - self._cmake.definitions["WITH_OPENMP"] = self.options.parallel == "openmp" + tc.variables["WITH_TBB"] = self.options.parallel == "tbb" + tc.variables["WITH_OPENMP"] = self.options.parallel == "openmp" - self._cmake.definitions["WITH_CUDA"] = self.options.with_cuda - self._cmake.definitions["WITH_ADE"] = self.options.with_ade + tc.variables["WITH_CUDA"] = self.options.with_cuda + tc.variables["WITH_ADE"] = self.options.with_ade if self.options.with_cuda: # This allows compilation on older GCC/NVCC, otherwise build errors. - self._cmake.definitions["CUDA_NVCC_FLAGS"] = "--expt-relaxed-constexpr" + tc.variables["CUDA_NVCC_FLAGS"] = "--expt-relaxed-constexpr" if self.options.cuda_arch_bin: - self._cmake.definitions["CUDA_ARCH_BIN"] = self.options.cuda_arch_bin - self._cmake.definitions["WITH_CUBLAS"] = self.options.get_safe("with_cublas", False) - self._cmake.definitions["WITH_CUFFT"] = self.options.get_safe("with_cufft", False) - self._cmake.definitions["WITH_CUDNN"] = self.options.get_safe("with_cudnn", False) + tc.variables["CUDA_ARCH_BIN"] = self.options.cuda_arch_bin + tc.variables["WITH_CUBLAS"] = self.options.get_safe("with_cublas", False) + tc.variables["WITH_CUFFT"] = self.options.get_safe("with_cufft", False) + tc.variables["WITH_CUDNN"] = self.options.get_safe("with_cudnn", False) - self._cmake.definitions["ENABLE_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["ENABLE_CCACHE"] = False + tc.variables["ENABLE_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["ENABLE_CCACHE"] = False - if self._is_msvc: - self._cmake.definitions["BUILD_WITH_STATIC_CRT"] = "MT" in msvc_runtime_flag(self) + if is_msvc(self): + tc.variables["BUILD_WITH_STATIC_CRT"] = is_msvc_static_runtime(self) - if self.settings.os == "Android": - self._cmake.definitions["ANDROID_STL"] = "c++_static" - self._cmake.definitions["ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level - self._cmake.definitions["ANDROID_ABI"] = tools.to_android_abi(str(self.settings.arch)) - self._cmake.definitions["BUILD_ANDROID_EXAMPLES"] = False - if "ANDROID_NDK_HOME" in os.environ: - self._cmake.definitions["ANDROID_NDK"] = os.environ.get("ANDROID_NDK_HOME") - - if tools.cross_building(self): - # FIXME: too specific and error prone, should be delegated to CMake helper - cmake_system_processor = { - "armv8": "aarch64", - "armv8.3": "aarch64", - }.get(str(self.settings.arch), str(self.settings.arch)) - self._cmake.definitions["CONAN_OPENCV_SYSTEM_PROCESSOR"] = cmake_system_processor - # Workaround for cross-build to at least iOS/tvOS/watchOS, - # when dependencies are found with find_path() and find_library() - self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_INCLUDE"] = "BOTH" - self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_LIBRARY"] = "BOTH" - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.generate() + + CMakeDeps(self).generate() def build(self): - self._patch_opencv() - cmake = self._configure_cmake() + self._patch_sources() + 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, "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) if os.path.isfile(os.path.join(self.package_folder, "setup_vars_opencv4.cmd")): - tools.rename(os.path.join(self.package_folder, "setup_vars_opencv4.cmd"), + rename(self, os.path.join(self.package_folder, "setup_vars_opencv4.cmd"), os.path.join(self.package_folder, "res", "setup_vars_opencv4.cmd")) # TODO: to remove in conan v2 once cmake_find_package* generators removed @@ -533,21 +506,20 @@ def package(self): {component["target"]:"opencv::{}".format(component["target"]) for component in self._opencv_components} ) - @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") # returns true if GTK2 is selected. To do this, the version option # of the gtk/system package is checked or the conan package version @@ -556,11 +528,11 @@ def _module_file_rel_path(self): def _is_gtk_version2(self): if not self.options.get_safe("with_gtk", False): return False - gtk_version = self.deps_cpp_info["gtk"].version + gtk_version = self.dependencies["gtk"].ref.version if gtk_version == "system": return self.options["gtk"].version == 2 else: - return tools.Version(gtk_version) < "3.0.0" + return Version(gtk_version) < "3.0.0" @property def _opencv_components(self): @@ -570,8 +542,12 @@ def imageformats_deps(): components.append("{0}::{0}".format(self.options.with_jpeg2000)) if self.options.with_png: components.append("libpng::libpng") - if self.options.with_jpeg: - components.append("{0}::{0}".format(self.options.with_jpeg)) + if self.options.with_jpeg == "libjpeg": + components.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + components.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + components.append("mozjpeg::libjpeg") if self.options.get_safe("with_tiff"): components.append("libtiff::libtiff") if self.options.with_openexr: @@ -737,11 +713,11 @@ def package_info(self): def get_lib_name(module): if module == "ippiw": - return "%s%s" % (module, debug) + return f"{module}{debug}" elif module in ("correspondence", "multiview", "numeric"): return module else: - return "opencv_%s%s%s" % (module, version, debug) + return f"opencv_{module}{version}{debug}" def add_components(components): for component in components: @@ -770,15 +746,15 @@ def add_components(components): self.cpp_info.components[conan_component].system_libs.append("mediandk") if not self.options.shared: self.cpp_info.components[conan_component].libdirs.append( - os.path.join("sdk", "native", "staticlibs", tools.to_android_abi(str(self.settings.arch)))) + os.path.join("sdk", "native", "staticlibs", to_android_abi(str(self.settings.arch)))) if conan_component == "opencv_core": self.cpp_info.components[conan_component].libdirs.append("lib") - self.cpp_info.components[conan_component].libs += tools.collect_libs(self) + self.cpp_info.components[conan_component].libs += collect_libs(self) if self.settings.os in ["iOS", "Macos", "Linux", "Neutrino"]: if not self.options.shared: if conan_component == "opencv_core": - libs = list(filter(lambda x: not x.startswith("opencv"), tools.collect_libs(self))) + libs = list(filter(lambda x: not x.startswith("opencv"), collect_libs(self))) self.cpp_info.components[conan_component].libs += libs # TODO: to remove in conan v2 once cmake_find_package* generators removed @@ -791,11 +767,9 @@ def add_components(components): self.cpp_info.components[conan_component_alias].names["cmake_find_package"] = cmake_component self.cpp_info.components[conan_component_alias].names["cmake_find_package_multi"] = cmake_component self.cpp_info.components[conan_component_alias].requires = [conan_component] + self.cpp_info.components[conan_component_alias].bindirs = [] self.cpp_info.components[conan_component_alias].includedirs = [] self.cpp_info.components[conan_component_alias].libdirs = [] - self.cpp_info.components[conan_component_alias].resdirs = [] - self.cpp_info.components[conan_component_alias].bindirs = [] - self.cpp_info.components[conan_component_alias].frameworkdirs = [] self.cpp_info.set_property("cmake_file_name", "OpenCV") diff --git a/recipes/opencv/4.x/patches/0002-openexr.patch b/recipes/opencv/4.x/patches/0002-openexr.patch deleted file mode 100644 index f0a2e1826d2a16..00000000000000 --- a/recipes/opencv/4.x/patches/0002-openexr.patch +++ /dev/null @@ -1,143 +0,0 @@ -diff --git a/cmake/OpenCVFindOpenEXR.cmake b/cmake/OpenCVFindOpenEXR.cmake -index c0a46806e1..ef633e853a 100644 ---- a/cmake/OpenCVFindOpenEXR.cmake -+++ b/cmake/OpenCVFindOpenEXR.cmake -@@ -15,60 +15,97 @@ file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) - - if(WIN32) - SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder") -- if(CMAKE_CL_64) -+ if(X86_64) - SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug) - elseif(MSVC) - SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug) - endif() --else() -- set(OPENEXR_ROOT "") -+elseif(UNIX) -+ SET(OPENEXR_LIBSEARCH_SUFFIXES ${CMAKE_LIBRARY_ARCHITECTURE}) - endif() - --SET(LIBRARY_PATHS -- /usr/lib -- /usr/local/lib -- /sw/lib -- /opt/local/lib -- "${ProgramFiles_ENV_PATH}/OpenEXR/lib/static" -- "${OPENEXR_ROOT}/lib") -+SET(SEARCH_PATHS -+ "${OPENEXR_ROOT}" -+ /usr -+ /usr/local -+ /sw -+ /opt -+ "${ProgramFiles_ENV_PATH}/OpenEXR") - --FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h -- PATH_SUFFIXES OpenEXR -- PATHS -- /usr/include -- /usr/local/include -- /sw/include -- /opt/local/include -- "${ProgramFiles_ENV_PATH}/OpenEXR/include" -- "${OPENEXR_ROOT}/include") -+MACRO(FIND_OPENEXR_LIBRARY LIBRARY_NAME LIBRARY_SUFFIX) -+ string(TOUPPER "${LIBRARY_NAME}" LIBRARY_NAME_UPPER) -+ FIND_LIBRARY(OPENEXR_${LIBRARY_NAME_UPPER}_LIBRARY -+ NAMES ${LIBRARY_NAME}${LIBRARY_SUFFIX} -+ PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -+ NO_DEFAULT_PATH -+ PATHS "${SEARCH_PATH}/lib" "${SEARCH_PATH}/lib/static") -+ENDMACRO() - --FIND_LIBRARY(OPENEXR_HALF_LIBRARY -- NAMES Half -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+MACRO(ocv_find_openexr LIBRARY_SUFFIX) -+ IF(NOT OPENEXR_FOUND) -+ FIND_OPENEXR_LIBRARY("Half" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("Iex" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("Imath" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("IlmImf" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("IlmThread" "${LIBRARY_SUFFIX}") -+ IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY AND OPENEXR_ILMTHREAD_LIBRARY) -+ SET(OPENEXR_FOUND TRUE) -+ ELSE() -+ UNSET(OPENEXR_IMATH_LIBRARY) -+ UNSET(OPENEXR_ILMIMF_LIBRARY) -+ UNSET(OPENEXR_IEX_LIBRARY) -+ UNSET(OPENEXR_ILMTHREAD_LIBRARY) -+ UNSET(OPENEXR_HALF_LIBRARY) -+ ENDIF() -+ ENDIF() -+ENDMACRO() - --FIND_LIBRARY(OPENEXR_IEX_LIBRARY -- NAMES Iex -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+FOREACH(SEARCH_PATH ${SEARCH_PATHS}) -+ FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h -+ PATH_SUFFIXES OpenEXR -+ NO_DEFAULT_PATH -+ PATHS -+ "${SEARCH_PATH}/include") - --FIND_LIBRARY(OPENEXR_IMATH_LIBRARY -- NAMES Imath -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+ IF (OPENEXR_INCLUDE_PATH) -+ SET(OPENEXR_VERSION_FILE "${OPENEXR_INCLUDE_PATH}/OpenEXRConfig.h") -+ IF (EXISTS ${OPENEXR_VERSION_FILE}) -+ FILE (STRINGS ${OPENEXR_VERSION_FILE} contents REGEX "#define OPENEXR_VERSION_MAJOR ") -+ IF (${contents} MATCHES "#define OPENEXR_VERSION_MAJOR ([0-9]+)") -+ SET(OPENEXR_VERSION_MAJOR "${CMAKE_MATCH_1}") -+ ENDIF () -+ FILE (STRINGS ${OPENEXR_VERSION_FILE} contents REGEX "#define OPENEXR_VERSION_MINOR ") -+ IF (${contents} MATCHES "#define OPENEXR_VERSION_MINOR ([0-9]+)") -+ SET(OPENEXR_VERSION_MINOR "${CMAKE_MATCH_1}") -+ ENDIF () -+ ENDIF () -+ ENDIF () - --FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY -- NAMES IlmImf -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+ IF (OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR) -+ set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}") -+ ENDIF () - --FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY -- NAMES IlmThread -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+ ocv_find_openexr("-${OPENEXR_VERSION}") -+ ocv_find_openexr("-${OPENEXR_VERSION}_s") -+ ocv_find_openexr("-${OPENEXR_VERSION}_d") -+ ocv_find_openexr("-${OPENEXR_VERSION}_s_d") -+ ocv_find_openexr("") -+ ocv_find_openexr("_s") -+ ocv_find_openexr("_d") -+ ocv_find_openexr("_s_d") - --IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) -- SET(OPENEXR_FOUND TRUE) -+ IF (OPENEXR_FOUND) -+ BREAK() -+ ENDIF() -+ -+ UNSET(OPENEXR_INCLUDE_PATH) -+ UNSET(OPENEXR_VERSION_FILE) -+ UNSET(OPENEXR_VERSION_MAJOR) -+ UNSET(OPENEXR_VERSION_MINOR) -+ UNSET(OPENEXR_VERSION) -+ENDFOREACH() -+ -+IF (OPENEXR_FOUND) - SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE PATH "The include paths needed to use OpenEXR") - SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR" FORCE) - ENDIF () diff --git a/recipes/opencv/4.x/patches/4.1.2-0001-find-openexr.patch b/recipes/opencv/4.x/patches/4.1.2-0001-find-openexr.patch new file mode 100644 index 00000000000000..5fb088fdf08884 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0001-find-openexr.patch @@ -0,0 +1,18 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -9,6 +9,15 @@ + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # + ++find_package(OpenEXR REQUIRED) ++if(TARGET OpenEXR::OpenEXR) ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) ++endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) diff --git a/recipes/opencv/4.x/patches/4.1.2-0002-find-ade.patch b/recipes/opencv/4.x/patches/4.1.2-0002-find-ade.patch new file mode 100644 index 00000000000000..98f88b7c0ec2d8 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0002-find-ade.patch @@ -0,0 +1,11 @@ +--- a/modules/gapi/cmake/init.cmake ++++ b/modules/gapi/cmake/init.cmake +@@ -4,7 +4,7 @@ if(NOT WITH_ADE) + return() + endif() + +-if (ade_DIR) ++if (1) + # if ade_DIR is set, use ADE-supplied CMake script + # to set up variables to the prebuilt ADE + find_package(ade 0.1.0) diff --git a/recipes/opencv/4.x/patches/4.1.2-0003-find-quirc.patch b/recipes/opencv/4.x/patches/4.1.2-0003-find-quirc.patch new file mode 100644 index 00000000000000..acfad3e91a1e03 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0003-find-quirc.patch @@ -0,0 +1,8 @@ +--- a/modules/objdetect/CMakeLists.txt ++++ b/modules/objdetect/CMakeLists.txt +@@ -5,3 +5,2 @@ if(HAVE_QUIRC) +- get_property(QUIRC_INCLUDE GLOBAL PROPERTY QUIRC_INCLUDE_DIR) +- ocv_include_directories(${QUIRC_INCLUDE}) +- ocv_target_link_libraries(${the_module} quirc) ++ find_package(quirc REQUIRED CONFIG) ++ ocv_target_link_libraries(${the_module} quirc::quirc) diff --git a/recipes/opencv/4.x/patches/0001-jasper.patch b/recipes/opencv/4.x/patches/4.1.2-0004-jasper.patch similarity index 100% rename from recipes/opencv/4.x/patches/0001-jasper.patch rename to recipes/opencv/4.x/patches/4.1.2-0004-jasper.patch diff --git a/recipes/opencv/4.x/patches/4.5.0-0002-find-ade.patch b/recipes/opencv/4.x/patches/4.5.0-0002-find-ade.patch new file mode 100644 index 00000000000000..cf954ad2c04e8a --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.0-0002-find-ade.patch @@ -0,0 +1,11 @@ +--- a/modules/gapi/cmake/init.cmake ++++ b/modules/gapi/cmake/init.cmake +@@ -7,7 +7,7 @@ if(NOT WITH_ADE) + return() + endif() + +-if(ade_DIR) ++if(1) + # if ade_DIR is set, use ADE-supplied CMake script + # to set up variables to the prebuilt ADE + find_package(ade 0.1.0) diff --git a/recipes/opencv/4.x/patches/4.5.3-0001-find-openexr.patch b/recipes/opencv/4.x/patches/4.5.3-0001-find-openexr.patch new file mode 100644 index 00000000000000..d78a290b65ab09 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.3-0001-find-openexr.patch @@ -0,0 +1,23 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -9,13 +9,15 @@ + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # + +-find_package(OpenEXR 3.0 CONFIG QUIET) ++find_package(OpenEXR REQUIRED) + if(TARGET OpenEXR::OpenEXR) +- SET(OPENEXR_FOUND TRUE) +- SET(OPENEXR_LIBRARIES OpenEXR::OpenEXR) +- SET(OPENEXR_VERSION ${OpenEXR_VERSION}) +- return() ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) + endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") diff --git a/recipes/opencv/4.x/patches/4.5.5-0001-find-openexr.patch b/recipes/opencv/4.x/patches/4.5.5-0001-find-openexr.patch new file mode 100644 index 00000000000000..67e0aad7b74307 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.5-0001-find-openexr.patch @@ -0,0 +1,32 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -9,21 +9,15 @@ + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # + +-if(NOT OPENCV_SKIP_OPENEXR_FIND_PACKAGE) +- find_package(OpenEXR 3 QUIET) +- #ocv_cmake_dump_vars(EXR) +- if(OpenEXR_FOUND) +- if(TARGET OpenEXR::OpenEXR) # OpenEXR 3+ +- set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) +- set(OPENEXR_INCLUDE_PATHS "") +- set(OPENEXR_VERSION "${OpenEXR_VERSION}") +- set(OPENEXR_FOUND 1) +- return() +- else() +- message(STATUS "Unsupported find_package(OpenEXR) - missing OpenEXR::OpenEXR target (version ${OpenEXR_VERSION})") +- endif() +- endif() ++find_package(OpenEXR REQUIRED) ++if(TARGET OpenEXR::OpenEXR) ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) + endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") diff --git a/recipes/opencv/4.x/test_package/CMakeLists.txt b/recipes/opencv/4.x/test_package/CMakeLists.txt index 3361bc4c26e1f3..590e6c1b43a32a 100644 --- a/recipes/opencv/4.x/test_package/CMakeLists.txt +++ b/recipes/opencv/4.x/test_package/CMakeLists.txt @@ -1,28 +1,14 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(OpenCV REQUIRED imgcodecs highgui objdetect CONFIG) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) option(built_with_ade "Enabled if opencv is built with ade" OFF) -if(built_with_ade) - add_definitions(-DBUILT_WITH_ADE) -endif() - option(built_with_ffmpeg "Enabled if opencv is built with ffmpeg" OFF) -if(built_with_ffmpeg) - add_definitions(-DBUILT_WITH_FFMPEG) -endif() - option(built_contrib_sfm "Enabled if opencv is built contrib sfm" OFF) -if(built_contrib_sfm) - add_definitions(-DBUILT_CONTRIB_SFM) -endif() + +find_package(OpenCV REQUIRED imgcodecs highgui objdetect CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} +target_link_libraries(${PROJECT_NAME} PRIVATE opencv_imgcodecs opencv_highgui opencv_objdetect @@ -30,4 +16,13 @@ target_link_libraries(${PROJECT_NAME} $ $ ) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(built_with_ade) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_WITH_ADE) +endif() +if(built_with_ffmpeg) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_WITH_FFMPEG) +endif() +if(built_contrib_sfm) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_CONTRIB_SFM) +endif() diff --git a/recipes/opencv/4.x/test_package/conanfile.py b/recipes/opencv/4.x/test_package/conanfile.py index 1c034b84e089a1..8cbff65ecd5a3a 100644 --- a/recipes/opencv/4.x/test_package/conanfile.py +++ b/recipes/opencv/4.x/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", "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["built_with_ade"] = self.dependencies["opencv"].options.with_ade + tc.variables["built_with_ffmpeg"] = self.dependencies["opencv"].options.with_ffmpeg + tc.variables["built_contrib_sfm"] = self.dependencies["opencv"].options.contrib and self.dependencies["opencv"].options.contrib_sfm + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["built_with_ade"] = self.options["opencv"].with_ade - cmake.definitions["built_with_ffmpeg"] = self.options["opencv"].with_ffmpeg - cmake.definitions["built_contrib_sfm"] = self.options["opencv"].contrib and self.options["opencv"].contrib_sfm 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/opencv/4.x/test_package/test_package.cpp b/recipes/opencv/4.x/test_package/test_package.cpp index 046f0f961f9b27..220a68d7c84b1b 100644 --- a/recipes/opencv/4.x/test_package/test_package.cpp +++ b/recipes/opencv/4.x/test_package/test_package.cpp @@ -12,8 +12,9 @@ #include #include #endif -#ifdef BUILD_WITH_FFMPEF +#ifdef BUILT_WITH_FFMPEG #include +#include #endif #ifdef BUILT_CONTRIB_SFM #include @@ -218,7 +219,7 @@ void TestGAPI() void TestVideo() { -#ifdef BUILD_WITH_FFMPEG +#ifdef BUILT_WITH_FFMPEG if (!videoio_registry::hasBackend(CAP_FFMPEG)) throw std::runtime_error("FFmpeg backend was not found"); #endif diff --git a/recipes/opencv/4.x/test_v1_package/CMakeLists.txt b/recipes/opencv/4.x/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/opencv/4.x/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/opencv/4.x/test_v1_package/conanfile.py b/recipes/opencv/4.x/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..1c034b84e089a1 --- /dev/null +++ b/recipes/opencv/4.x/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["built_with_ade"] = self.options["opencv"].with_ade + cmake.definitions["built_with_ffmpeg"] = self.options["opencv"].with_ffmpeg + cmake.definitions["built_contrib_sfm"] = self.options["opencv"].contrib and self.options["opencv"].contrib_sfm + 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/openexr/2.x/conanfile.py b/recipes/openexr/2.x/conanfile.py index e6fecd0261780b..9665a746c28dfd 100644 --- a/recipes/openexr/2.x/conanfile.py +++ b/recipes/openexr/2.x/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import cross_building +from conan.tools.build import cross_building, stdcpp_library from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, replace_in_file, rmdir, save from conan.tools.scm import Version -from conans import tools as tools_legacy import os import textwrap -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.54.0" class OpenEXRConan(ConanFile): @@ -36,7 +35,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): self.requires("zlib/1.2.13") @@ -217,7 +216,7 @@ def package_info(self): self.cpp_info.components["ilmbase_ilmbaseconfig"].defines.append("OPENEXR_DLL") if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["openexr_ilmimfconfig"].system_libs.append(libcxx) self.cpp_info.components["ilmbase_ilmbaseconfig"].system_libs.append(libcxx) diff --git a/recipes/openexr/3.x/conanfile.py b/recipes/openexr/3.x/conanfile.py index 8f95edf1a7078d..83b40c8cc3b063 100644 --- a/recipes/openexr/3.x/conanfile.py +++ b/recipes/openexr/3.x/conanfile.py @@ -37,13 +37,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): self.requires("zlib/1.2.13") # Note: OpenEXR and Imath are versioned independently. - self.requires("imath/3.1.5") + self.requires("imath/3.1.5", transitive_headers=True) def validate(self): if self.info.settings.compiler.cppstd: diff --git a/recipes/opengl/all/conanfile.py b/recipes/opengl/all/conanfile.py index bff45b47153335..a7f52cf28c574e 100644 --- a/recipes/opengl/all/conanfile.py +++ b/recipes/opengl/all/conanfile.py @@ -1,9 +1,8 @@ from conan import ConanFile -from conan.errors import ConanException from conan.tools.system import package_manager -from conans import tools +from conan.tools.gnu import PkgConfig -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class SysConfigOpenGLConan(ConanFile): @@ -16,47 +15,21 @@ class SysConfigOpenGLConan(ConanFile): license = "MIT" settings = "os", "arch", "compiler", "build_type" - def package_id(self): - self.info.header_only() - - def _fill_cppinfo_from_pkgconfig(self, name): - pkg_config = tools.PkgConfig(name) - if not pkg_config.provides: - raise ConanException("OpenGL 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] - include_dirs = [include[2:] for include in pkg_config.cflags_only_I] - cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")] - defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")] + def layout(self): + pass - self.cpp_info.system_libs.extend(libs) - self.cpp_info.libdirs.extend(lib_dirs) - self.cpp_info.sharedlinkflags.extend(ldflags) - self.cpp_info.exelinkflags.extend(ldflags) - self.cpp_info.defines.extend(defines) - self.cpp_info.includedirs.extend(include_dirs) - self.cpp_info.cflags.extend(cflags) - self.cpp_info.cxxflags.extend(cflags) + def package_id(self): + self.info.clear() def system_requirements(self): 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) + dnf.install_substitutes(["libglvnd-devel"], ["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) + apt.install_substitutes(["libgl-dev"], ["libgl1-mesa-dev"], update=True, check=True) pacman = package_manager.PacMan(self) pacman.install(["libglvnd"], update=True, check=True) @@ -74,6 +47,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "opengl_system") + self.cpp_info.bindirs = [] self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] if self.settings.os == "Macos": @@ -82,4 +56,5 @@ def package_info(self): elif self.settings.os == "Windows": self.cpp_info.system_libs = ["opengl32"] elif self.settings.os in ["Linux", "FreeBSD"]: - self._fill_cppinfo_from_pkgconfig('gl') + pkg_config = PkgConfig(self, 'gl') + pkg_config.fill_cpp_info(self.cpp_info, is_system=self.settings.os != "FreeBSD") diff --git a/recipes/opengl/all/test_cmake_module_package/CMakeLists.txt b/recipes/opengl/all/test_cmake_module_package/CMakeLists.txt new file mode 100644 index 00000000000000..9c1b23a3582d3c --- /dev/null +++ b/recipes/opengl/all/test_cmake_module_package/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.10) +project(test_package) + +find_package(OpenGL REQUIRED) + +set(SOURCES ../test_package/test_package.cpp) + +if(WIN32) + list(APPEND SOURCES ../test_package/win.cpp) +endif() + +if(APPLE) + list(APPEND SOURCES ../test_package/osx.mm) + set_source_files_properties(../test_package/osx.mm PROPERTIES COMPILE_FLAGS "-x objective-c++") + + list(APPEND PLATFORM_LIBS "objc") + + find_library(APPKIT_LIBRARY AppKit) + find_library(FOUNDATION_LIBRARY Foundation) + + if(APPKIT_LIBRARY) + list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) + endif() + + if(FOUNDATION_LIBRARY) + list(APPEND PLATFORM_LIBS ${FOUNDATION_LIBRARY}) + endif() +endif() + +add_executable(${PROJECT_NAME} ${SOURCES}) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL ${PLATFORM_LIBS}) diff --git a/recipes/opengl/all/test_cmake_module_package/conanfile.py b/recipes/opengl/all/test_cmake_module_package/conanfile.py new file mode 100644 index 00000000000000..3a91c9439218e3 --- /dev/null +++ b/recipes/opengl/all/test_cmake_module_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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opengl/all/test_package/CMakeLists.txt b/recipes/opengl/all/test_package/CMakeLists.txt index 9bda7d9ae1dc31..cedabff6c4ea6a 100644 --- a/recipes/opengl/all/test_package/CMakeLists.txt +++ b/recipes/opengl/all/test_package/CMakeLists.txt @@ -1,34 +1,31 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(opengl_system REQUIRED CONFIG) set(SOURCES test_package.cpp) if(WIN32) -list(APPEND SOURCES win.cpp) + list(APPEND SOURCES win.cpp) endif() if(APPLE) + list(APPEND SOURCES osx.mm) + set_source_files_properties(osx.mm PROPERTIES COMPILE_FLAGS "-x objective-c++") -list(APPEND SOURCES osx.mm) -set_source_files_properties(osx.mm PROPERTIES COMPILE_FLAGS "-x objective-c++") + list(APPEND PLATFORM_LIBS "objc") -list(APPEND PLATFORM_LIBS "objc") + find_library(APPKIT_LIBRARY AppKit) + find_library(FOUNDATION_LIBRARY Foundation) -find_library(APPKIT_LIBRARY AppKit) -find_library(FOUNDATION_LIBRARY Foundation) - -if(APPKIT_LIBRARY) -list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) -endif() - -if(FOUNDATION_LIBRARY) -list(APPEND PLATFORM_LIBS ${FOUNDATION_LIBRARY}) -endif() + if(APPKIT_LIBRARY) + list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) + endif() + if(FOUNDATION_LIBRARY) + list(APPEND PLATFORM_LIBS ${FOUNDATION_LIBRARY}) + endif() endif() add_executable(${PROJECT_NAME} ${SOURCES}) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} ${PLATFORM_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE opengl::opengl ${PLATFORM_LIBS}) diff --git a/recipes/opengl/all/test_package/conanfile.py b/recipes/opengl/all/test_package/conanfile.py index d4128b04507778..3a91c9439218e3 100644 --- a/recipes/opengl/all/test_package/conanfile.py +++ b/recipes/opengl/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 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.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opengl/all/test_v1_cmake_module_package/CMakeLists.txt b/recipes/opengl/all/test_v1_cmake_module_package/CMakeLists.txt new file mode 100644 index 00000000000000..1de7a7ee473fdc --- /dev/null +++ b/recipes/opengl/all/test_v1_cmake_module_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_cmake_module_package + ${CMAKE_CURRENT_BINARY_DIR}/test_cmake_module_package) diff --git a/recipes/opengl/all/test_v1_cmake_module_package/conanfile.py b/recipes/opengl/all/test_v1_cmake_module_package/conanfile.py new file mode 100644 index 00000000000000..19e6a0c06e3d81 --- /dev/null +++ b/recipes/opengl/all/test_v1_cmake_module_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) diff --git a/recipes/opengl/all/test_v1_package/CMakeLists.txt b/recipes/opengl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/opengl/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/opengl/all/test_v1_package/conanfile.py b/recipes/opengl/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/opengl/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/openh264/all/conanfile.py b/recipes/openh264/all/conanfile.py index 43796c374b53dd..a281705e13bc9f 100644 --- a/recipes/openh264/all/conanfile.py +++ b/recipes/openh264/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conans import tools +from conan.tools.build import stdcpp_library from conan.tools.env import VirtualBuildEnv from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, replace_in_file, chdir from conan.tools.gnu import Autotools, AutotoolsToolchain @@ -11,7 +11,7 @@ import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class OpenH264Conan(ConanFile): @@ -185,7 +185,6 @@ def package_info(self): self.cpp_info.system_libs.extend(["m", "pthread"]) if self.settings.os == "Android": self.cpp_info.system_libs.append("m") - # TODO: switch to conan.tools.build.stdcpp_library in conan 1.54 - libcxx = tools.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/openssl/1.x.x/conandata.yml b/recipes/openssl/1.x.x/conandata.yml index 87f7543e6bbd64..bf78950f0ec358 100644 --- a/recipes/openssl/1.x.x/conandata.yml +++ b/recipes/openssl/1.x.x/conandata.yml @@ -27,13 +27,17 @@ sources: patches: 1.0.2u: - patch_file: patches/1.0.2u-darwin-arm64.patch - base_path: source_subfolder + patch_description: "Darwin ARM64 support" + patch_type: "portability" 1.1.1p: - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder + patch_description: "TVOS and WatchOS don't like fork()" + patch_type: "portability" 1.1.1q: - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder + patch_description: "TVOS and WatchOS don't like fork()" + patch_type: "portability" 1.1.1s: - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder + patch_description: "TVOS and WatchOS don't like fork()" + patch_type: "portability" diff --git a/recipes/openssl/1.x.x/conanfile.py b/recipes/openssl/1.x.x/conanfile.py index 33409d111d88cd..9dafdd8695067b 100644 --- a/recipes/openssl/1.x.x/conanfile.py +++ b/recipes/openssl/1.x.x/conanfile.py @@ -1,22 +1,30 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, XCRun from conan.tools.build import cross_building -from conan.tools.files import rename, get, rmdir -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conans import AutoToolsBuildEnvironment, tools +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, chdir, copy, export_conandata_patches, + get, load, rename, replace_in_file, rm, rmdir, save +) +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path +from conan.tools.scm import Version from contextlib import contextmanager from functools import total_ordering import fnmatch +import json import os import textwrap -required_conan_version = ">=1.47.0" - +required_conan_version = ">=1.53.0" @total_ordering class OpenSSLVersion(object): - def __init__(self, version_str): + def __init__(self, version): self._pre = "" + version_str = str(version) tokens = version_str.split("-") if len(tokens) > 1: @@ -59,7 +67,7 @@ def compare(self, other): other = OpenSSLVersion(other) if self.as_list == other.as_list: return 0 - elif self.as_list < other.as_list: + if self.as_list < other.as_list: return -1 else: return 1 @@ -67,6 +75,7 @@ def compare(self, other): class OpenSSLConan(ConanFile): name = "openssl" + package_type = "library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/openssl/openssl" license = "OpenSSL" @@ -136,19 +145,13 @@ class OpenSSLConan(ConanFile): "no_tls1": [True, False], "capieng_dialog": [True, False], "enable_capieng": [True, False], - "openssldir": "ANY", + "openssldir": ["ANY", None] } default_options = {key: False for key in options.keys()} default_options["fPIC"] = True default_options["no_md2"] = True default_options["openssldir"] = None - _env_build = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _is_clangcl(self): return self.settings.compiler == "clang" and self.settings.os == "Windows" @@ -169,15 +172,8 @@ def _settings_build(self): def _full_version(self): return OpenSSLVersion(self.version) - @property - def _win_bash(self): - return self._settings_build.os == "Windows" and \ - not self._use_nmake and \ - (self._is_mingw or cross_building(self, skip_x64_x86=True)) - 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._full_version >= "1.1.0": @@ -223,16 +219,16 @@ 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): - pass + basic_layout(self, src_folder="src") def requirements(self): - if self._full_version < "1.1.0" and self.options.get_safe("no_zlib") == False: - self.requires("zlib/1.2.12") + if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"): + self.requires("zlib/1.2.13") def validate(self): if self.settings.os == "Emscripten": @@ -241,16 +237,54 @@ def validate(self): def build_requirements(self): if self._settings_build.os == "Windows": - if not self._win_bash: - self.build_requires("strawberryperl/5.30.0.1") - if not self.options.no_asm and not tools.which("nasm"): - self.build_requires("nasm/2.15.05") - if self._win_bash and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not self.options.no_asm: + self.tool_requires("nasm/2.15.05") + if self._use_nmake: + self.tool_requires("strawberryperl/5.32.1.1") + else: + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + destination=self.source_folder, strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + tc = AutotoolsToolchain(self) + # workaround for random error: size too large (archive member extends past the end of the file) + # /Library/Developer/CommandLineTools/usr/bin/ar: internal ranlib command failed + if self.settings.os == "Macos" and self._full_version < "1.1.0": + tc.make_args = ["-j1"] + # 1.1.0 era Makefiles don't do well with parallel installs + if not self._use_nmake and self._full_version >= "1.1.0" and self._full_version < "1.1.1": + tc.make_args = ["-j1"] + if self.settings.os == "Macos" and not cross_building(self): + tc.extra_cflags = [f"-isysroot {XCRun(self).sdk_path}"] + tc.extra_cxxflags = [f"-isysroot {XCRun(self).sdk_path}"] + tc.extra_ldflags = [f"-isysroot {XCRun(self).sdk_path}"] + env = tc.environment() + env.define("PERL", self._perl) + tc.generate(env) + gen_info = {} + gen_info["CFLAGS"] = tc.cflags + gen_info["CXXFLAGS"] = tc.cxxflags + gen_info["DEFINES"] = tc.defines + gen_info["LDFLAGS"] = tc.ldflags + # Support for self.dependencies in build() method is currently restricted to `generate()` and `validate()` + # See https://github.com/conan-io/conan/issues/12411 for more details + if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"): + zlib_cpp_info = self.dependencies["zlib"].cpp_info + gen_info["zlib_include_path"] = zlib_cpp_info.includedirs[0] + if self.settings.os == "Windows": + gen_info["zlib_lib_path"] = f"{zlib_cpp_info.libdirs[0]}/{zlib_cpp_info.libs[0]}.lib" + else: + gen_info["zlib_lib_path"] = zlib_cpp_info.libdirs[0] # Just path, linux will find the right file + save(self, "gen_info.conf", json.dumps(gen_info)) + tc = AutotoolsDeps(self) + tc.generate() @property def _target_prefix(self): @@ -283,7 +317,7 @@ def _perlasm_scheme(self): "armv8_32": "ios64", "armv8.3": "ios64", "armv7k": "ios32"}.get(the_arch, None) - elif the_os == "Android": + if the_os == "Android": return {"armv7": "void", "armv8": "linux64", "mips": "o32", @@ -447,14 +481,14 @@ def _tool(self, env_name, apple_name): if env_name in os.environ: return os.environ[env_name] if self.settings.compiler == "apple-clang": - return getattr(tools.XCRun(self.settings), apple_name) + return getattr(XCRun(self), apple_name) return None def _patch_configure(self): # since _patch_makefile_org will replace binutils variables # use a more restricted regular expresion to prevent that Configure script trying to do it again - configure = os.path.join(self._source_subfolder, "Configure") - tools.replace_in_file(configure, r"s/^AR=\s*ar/AR= $ar/;", r"s/^AR=\s*ar\b/AR= $ar/;") + configure = os.path.join(self.source_folder, "Configure") + replace_in_file(self, configure, r"s/^AR=\s*ar/AR= $ar/;", r"s/^AR=\s*ar\b/AR= $ar/;",encoding="latin_1") def _adjust_path(self, path): return path.replace("\\", "/") if self._settings_build.os == "Windows" else path @@ -462,43 +496,36 @@ def _adjust_path(self, path): def _patch_makefile_org(self): # https://wiki.openssl.org/index.php/Compilation_and_Installation#Modifying_Build_Settings # its often easier to modify Configure and Makefile.org rather than trying to add targets to the configure scripts - makefile_org = os.path.join(self._source_subfolder, "Makefile.org") - env_build = self._get_env_build() - with tools.environment_append(env_build.vars): - if not "CROSS_COMPILE" in os.environ: - cc = os.environ.get("CC", "cc") - tools.replace_in_file(makefile_org, "CC= cc\n", "CC= %s %s\n" % (self._adjust_path(cc), os.environ["CFLAGS"])) - if "AR" in os.environ: - tools.replace_in_file(makefile_org, "AR=ar $(ARFLAGS) r\n", "AR=%s $(ARFLAGS) r\n" % self._adjust_path(os.environ["AR"])) - if "RANLIB" in os.environ: - tools.replace_in_file(makefile_org, "RANLIB= ranlib\n", "RANLIB= %s\n" % self._adjust_path(os.environ["RANLIB"])) - rc = os.environ.get("WINDRES", os.environ.get("RC")) - if rc: - tools.replace_in_file(makefile_org, "RC= windres\n", "RC= %s\n" % self._adjust_path(rc)) - if "NM" in os.environ: - tools.replace_in_file(makefile_org, "NM= nm\n", "NM= %s\n" % self._adjust_path(os.environ["NM"])) - if "AS" in os.environ: - tools.replace_in_file(makefile_org, "AS=$(CC) -c\n", "AS=%s\n" % self._adjust_path(os.environ["AS"])) - - def _get_env_build(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - return self._env_build + makefile_org = os.path.join(self.source_folder, "Makefile.org") + if not "CROSS_COMPILE" in os.environ: + cc = os.environ.get("CC", "cc") + gen_info = json.loads(load(self, os.path.join(self.generators_folder, "gen_info.conf"))) + replace_in_file(self, makefile_org, "CC= cc\n", "CC= %s %s\n" % (self._adjust_path(cc), gen_info["CFLAGS"])) + if "AR" in os.environ: + replace_in_file(self, makefile_org, "AR=ar $(ARFLAGS) r\n", "AR=%s $(ARFLAGS) r\n" % self._adjust_path(os.environ["AR"])) + if "RANLIB" in os.environ: + replace_in_file(self, makefile_org, "RANLIB= ranlib\n", "RANLIB= %s\n" % self._adjust_path(os.environ["RANLIB"])) + rc = os.environ.get("WINDRES", os.environ.get("RC")) + if rc: + replace_in_file(self, makefile_org, "RC= windres\n", "RC= %s\n" % self._adjust_path(rc)) + if "NM" in os.environ: + replace_in_file(self, makefile_org, "NM= nm\n", "NM= %s\n" % self._adjust_path(os.environ["NM"])) + if "AS" in os.environ: + replace_in_file(self, makefile_org, "AS=$(CC) -c\n", "AS=%s\n" % self._adjust_path(os.environ["AS"])) def _get_default_openssl_dir(self): if self.settings.os == "Linux" and self._full_version >= "1.1.0": return "/etc/ssl" - return os.path.join(self.package_folder, "res") + return "res" @property def _configure_args(self): openssldir = self.options.openssldir or self._get_default_openssl_dir() - prefix = tools.unix_path(self.package_folder) if self._win_bash else self.package_folder - openssldir = tools.unix_path(openssldir) if self._win_bash else openssldir + openssldir = unix_path(self, openssldir) if self.win_bash else openssldir args = [ '"%s"' % (self._target if self._full_version >= "1.1.0" else self._ancestor_target), "shared" if self.options.shared else "no-shared", - "--prefix=\"%s\"" % prefix, + "--prefix=/", "--openssldir=\"%s\"" % openssldir, "no-unit-test", "no-threads" if self.options.no_threads else "threads" @@ -510,6 +537,9 @@ def _configure_args(self): if self._full_version >= "1.1.0": args.append("--debug" if self.settings.build_type == "Debug" else "--release") + if self.settings.os == "Linux" and self.settings.arch == "x86_64": + args.append("--libdir=lib") # See https://github.com/openssl/openssl/blob/master/INSTALL.md#libdir + if self.settings.os in ["tvOS", "watchOS"]: args.append(" -DNO_FORK") # fork is not available on tvOS and watchOS if self.settings.os == "Android": @@ -535,27 +565,33 @@ def _configure_args(self): if self.options.get_safe("no_zlib"): args.append("no-zlib") else: - zlib_info = self.deps_cpp_info["zlib"] - include_path = zlib_info.include_paths[0] - if self.settings.os == "Windows": - lib_path = "%s/%s.lib" % (zlib_info.lib_paths[0], zlib_info.libs[0]) - else: - lib_path = zlib_info.lib_paths[0] # Just path, linux will find the right file + gen_info = json.loads(load(self, os.path.join(self.generators_folder, "gen_info.conf"))) + include_path = gen_info["zlib_include_path"] + lib_path = gen_info["zlib_lib_path"] # clang-cl doesn't like backslashes in #define CFLAGS (builldinf.h -> cversion.c) include_path = self._adjust_path(include_path) - lib_path = self._adjust_path(lib_path) + lib_path = self._adjust_path(lib_path) - if self.options["zlib"].shared: - args.append("zlib-dynamic") + if Version(conan_version).major <2 : + if self.options["zlib"].shared: + args.append("zlib-dynamic") + else: + args.append("zlib") else: - args.append("zlib") + if self.dependencies["zlib"].options.shared: + args.append("zlib-dynamic") + else: + args.append("zlib") args.extend(['--with-zlib-include="%s"' % include_path, '--with-zlib-lib="%s"' % lib_path]) - - for option_name in self.options.values.fields: - activated = getattr(self.options, option_name) + if Version(conan_version).major < 2: + possible_values = self.options.values.fields + else: + possible_values = self.options.possible_values + for option_name in possible_values: + activated = self.options.get_safe(option_name) if activated and option_name not in ["fPIC", "openssldir", "capieng_dialog", "enable_capieng", "no_md2"]: self.output.info("activated option: %s" % option_name) args.append(option_name.replace("_", "-")) @@ -581,11 +617,12 @@ def _create_targets(self): }}, ); """ + gen_info = json.loads(load(self, os.path.join(self.generators_folder, "gen_info.conf"))) + self.output.info(f"gen_info = {gen_info}") cflags = [] cxxflags = [] - env_build = self._get_env_build() - cflags.extend(env_build.vars_dict["CFLAGS"]) - cxxflags.extend(env_build.vars_dict["CXXFLAGS"]) + cflags.extend(gen_info["CFLAGS"]) + cxxflags.extend(gen_info["CXXFLAGS"]) cc = self._tool("CC", "cc") cxx = self._tool("CXX", "cxx") @@ -599,13 +636,11 @@ def _create_targets(self): cc = 'cc => "%s",' % cc if cc else "" cxx = 'cxx => "%s",' % cxx if cxx else "" ar = 'ar => "%s",' % ar if ar else "" - defines = " ".join(env_build.defines) - defines = 'defines => add("%s"),' % defines if defines else "" + defines = ", ".join(f'"{d}"' for d in gen_info["DEFINES"]) + defines = 'defines => add([%s]),' % defines if defines else "" ranlib = 'ranlib => "%s",' % ranlib if ranlib else "" targets = "my %targets" if self._full_version >= "1.1.1" else "%targets" - includes = ", ".join(['"%s"' % include for include in env_build.include_paths]) - if self.settings.os == "Windows": - includes = includes.replace('\\', '/') # OpenSSL doesn't like backslashes + includes = "" if self._asm_target: ancestor = '[ "%s", asm("%s") ]' % (self._ancestor_target, self._asm_target) @@ -616,7 +651,7 @@ def _create_targets(self): shared_target = '' if self.settings.os == 'Neutrino': if self.options.shared: - shared_extension = 'shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",' + shared_extension = r'shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",' shared_target = 'shared_target => "gnu-shared",' if self.options.get_safe("fPIC", True): shared_cflag='shared_cflag => "-fPIC",' @@ -636,38 +671,20 @@ def _create_targets(self): shared_target=shared_target, shared_extension=shared_extension, shared_cflag=shared_cflag, - lflags=" ".join(env_build.link_flags)) + lflags=" ".join(gen_info["LDFLAGS"])) self.output.info("using target: %s -> %s" % (self._target, self._ancestor_target)) self.output.info(config) - tools.save(os.path.join(self._source_subfolder, "Configurations", "20-conan.conf"), config) - - def _run_make(self, targets=None, makefile=None, parallel=True): - command = [self._make_program] - if makefile: - command.extend(["-f", makefile]) - if targets: - command.extend(targets) - if not self._use_nmake: - # workaround for random error: size too large (archive member extends past the end of the file) - # /Library/Developer/CommandLineTools/usr/bin/ar: internal ranlib command failed - if self.settings.os == "Macos" and self._full_version < "1.1.0": - parallel = False - - # Building in parallel for versions less than 1.0.2d causes errors - # See https://github.com/openssl/openssl/issues/298 - if self._full_version < "1.0.2d": - parallel = False - command.append(("-j%s" % tools.cpu_count()) if parallel else "-j1") - self.run(" ".join(command), win_bash=self._win_bash) + save(self, os.path.join(self.source_folder, "Configurations", "20-conan.conf"), config) @property def _perl(self): - if self._settings_build.os == "Windows" and not self._win_bash: + if self._use_nmake: # enforce strawberry perl, otherwise wrong perl could be used (from Git bash, MSYS, etc.) - if "strawberryperl" in self.deps_cpp_info.deps: - return os.path.join(self.deps_cpp_info["strawberryperl"].rootpath, "bin", "perl.exe") - elif hasattr(self, "user_info_build") and "strawberryperl" in self.user_info_build: + build_deps = (dependency.ref.name for require, dependency in self.dependencies.build.items()) + if "strawberryperl" in build_deps: + return os.path.join(self.dependencies.build["strawberryperl"].package_folder, "bin", "perl.exe") + if hasattr(self, "user_info_build") and "strawberryperl" in self.user_info_build: return self.user_info_build["strawberryperl"].perl return "perl" @@ -675,62 +692,6 @@ def _perl(self): def _nmake_makefile(self): return r"ms\ntdll.mak" if self.options.shared else r"ms\nt.mak" - def _make(self): - with tools.chdir(self._source_subfolder): - # workaround for clang-cl not producing .pdb files - if self._is_clangcl: - tools.save("ossl_static.pdb", "") - args = " ".join(self._configure_args) - self.output.info(self._configure_args) - - if self._use_nmake and self._full_version >= "1.1.0": - self._replace_runtime_in_file(os.path.join("Configurations", "10-main.conf")) - - self.run('{perl} ./Configure {args}'.format(perl=self._perl, args=args), win_bash=self._win_bash) - - self._patch_install_name() - - if self._use_nmake and self._full_version < "1.1.0": - if not self.options.no_asm and self.settings.arch == "x86": - self.run(r"ms\do_nasm") - else: - self.run(r"ms\do_ms" if self.settings.arch == "x86" else r"ms\do_win64a") - - self._replace_runtime_in_file(os.path.join("ms", "nt.mak")) - self._replace_runtime_in_file(os.path.join("ms", "ntdll.mak")) - if self.settings.arch == "x86": - tools.replace_in_file(os.path.join("ms", "nt.mak"), "-WX", "") - tools.replace_in_file(os.path.join("ms", "ntdll.mak"), "-WX", "") - - self._run_make(makefile=self._nmake_makefile) - else: - self._run_make() - - def _make_install(self): - with tools.chdir(self._source_subfolder): - # workaround for MinGW (https://github.com/openssl/openssl/issues/7653) - if not os.path.isdir(os.path.join(self.package_folder, "bin")): - os.makedirs(os.path.join(self.package_folder, "bin")) - - if self._use_nmake and self._full_version < "1.1.0": - self._run_make(makefile=self._nmake_makefile, targets=["install"], parallel=False) - else: - self._run_make(targets=["install_sw"], parallel=False) - - @property - def _cc(self): - if "CROSS_COMPILE" in os.environ: - return "gcc" - if "CC" in os.environ: - return os.environ["CC"] - if self.settings.compiler == "apple-clang": - return tools.XCRun(self.settings).find("clang") - elif self.settings.compiler == "clang": - return "clang" - elif self.settings.compiler == "gcc": - return "gcc" - return "cc" - @contextmanager def _make_context(self): if self._use_nmake: @@ -739,86 +700,131 @@ def _make_context(self): # break nmake (don't know about mingw make). So we fix them def sanitize_env_var(var): return '"{}"'.format(var).replace('/', '\\') if '"' not in var else var - env = {key: sanitize_env_var(tools.get_env(key)) for key in ("CC", "RC") if tools.get_env(key)} - with tools.environment_append(env): + env = Environment() + for key in ("CC", "RC"): + if os.getenv(key): + env.define(key, sanitize_env_var(os.getenv(key))) + with env.vars(self).apply(): yield else: yield def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.vcvars(self.settings) if self._use_nmake else tools.no_op(): - env_vars = {"PERL": self._perl} - if self._full_version < "1.1.0": - cflags = " ".join(self._get_env_build().vars_dict["CFLAGS"]) - env_vars["CC"] = "%s %s" % (self._cc, cflags) - if self.settings.compiler == "apple-clang": - xcrun = tools.XCRun(self.settings) - env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) - env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) - with tools.environment_append(env_vars): - if self._full_version > "1.1.0": - self._create_targets() + apply_conandata_patches(self) + autotools = Autotools(self) + if self._full_version >= "1.1.0": + self._create_targets() + else: + self._patch_configure() + self._patch_makefile_org() + with self._make_context(): + with chdir(self, self.source_folder): + # workaround for clang-cl not producing .pdb files + if self._is_clangcl: + save(self, "ossl_static.pdb", "") + args = " ".join(self._configure_args) + self.output.info(self._configure_args) + + if self._use_nmake and self._full_version >= "1.1.0": + self._replace_runtime_in_file(os.path.join("Configurations", "10-main.conf")) + + self.run(f'{self._perl} ./Configure {args}') + + self._patch_install_name() + + if not self._use_nmake: + autotools.make() else: - self._patch_configure() - self._patch_makefile_org() - with self._make_context(): - self._make() + if self._full_version >= "1.1.0": + self.run(f'nmake /F Makefile') + else: # nmake 1.0.2 support + # Note: 1.0.2 should not be used according to the OpenSSL Project + # See https://www.openssl.org/source/ - @property - def _make_program(self): - if self._use_nmake: - return "nmake" - make_program = tools.get_env("CONAN_MAKE_PROGRAM", tools.which("make") or tools.which('mingw32-make')) - make_program = tools.unix_path(make_program) if self._settings_build.os == "Windows" else make_program - if not make_program: - raise Exception('could not find "make" executable. please set "CONAN_MAKE_PROGRAM" environment variable') - return make_program + if not self.options.no_asm and self.settings.arch == "x86": + self.run(r"ms\do_nasm") + else: + self.run(r"ms\do_ms" if self.settings.arch == "x86" else r"ms\do_win64a") + + self._replace_runtime_in_file(os.path.join("ms", "nt.mak")) + self._replace_runtime_in_file(os.path.join("ms", "ntdll.mak")) + if self.settings.arch == "x86": + replace_in_file(self, os.path.join("ms", "nt.mak"), "-WX", "") + replace_in_file(self, os.path.join("ms", "ntdll.mak"), "-WX", "") + + # NMAKE interprets trailing backslash as line continuation + replace_in_file(self, self._nmake_makefile, 'INSTALLTOP=\\', 'INSTALLTOP=/') + + self.run(f'nmake /F {self._nmake_makefile}') def _patch_install_name(self): - if tools.is_apple_os(self.settings.os) and self.options.shared: + if is_apple_os(self) and self.options.shared: old_str = '-install_name $(INSTALLTOP)/$(LIBDIR)/' new_str = '-install_name @rpath/' - makefile = "Makefile" if self._full_version >= "1.1.1" else "Makefile.shared" - tools.replace_in_file(makefile, old_str, new_str, strict=self.in_local_cache) + replace_in_file(self, makefile, old_str, new_str, strict=self.in_local_cache) + if self._use_nmake: + # NMAKE interprets trailing backslash as line continuation + if self._full_version >= "1.1.0": + replace_in_file(self, "Makefile", 'INSTALLTOP_dir=\\', 'INSTALLTOP_dir=/') def _replace_runtime_in_file(self, filename): runtime = msvc_runtime_flag(self) for e in ["MDd", "MTd", "MD", "MT"]: - tools.replace_in_file(filename, "/{} ".format(e), "/{} ".format(runtime), strict=False) - tools.replace_in_file(filename, "/{}\"".format(e), "/{}\"".format(runtime), strict=False) + replace_in_file(self, filename, "/{} ".format(e), "/{} ".format(runtime), strict=False) + replace_in_file(self, filename, "/{}\"".format(e), "/{}\"".format(runtime), strict=False) def package(self): - self.copy(src=self._source_subfolder, pattern="*LICENSE", dst="licenses") - with tools.vcvars(self.settings) if self._use_nmake else tools.no_op(): - self._make_install() - for root, _, files in os.walk(self.package_folder): - for filename in files: - if fnmatch.fnmatch(filename, "*.pdb"): - os.unlink(os.path.join(self.package_folder, root, filename)) + copy(self, "*LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) if self._use_nmake: - if self.settings.build_type == 'Debug' and self._full_version >= "1.1.0": - with tools.chdir(os.path.join(self.package_folder, 'lib')): + args = [] + if self._full_version >= "1.1.0": + target = "install_sw" + args.append(f"DESTDIR={self.package_folder}") + else: # 1.0.2 support + target = "install" + args.append(f"INSTALLTOP={self.package_folder}") + openssldir = self.options.openssldir or self._get_default_openssl_dir() + args.append(f"OPENSSLDIR={os.path.join(self.package_folder, openssldir)}") + + with chdir(self, self.source_folder): + if self._full_version >= "1.1.0": + self.run(f'nmake -f Makefile {target} {" ".join(args)}') + else: # 1.0.2 support + self.run(f'nmake -f {self._nmake_makefile} {target} {" ".join(args)}') + rm(self, "*.pdb", self.package_folder, recursive=True) + if self.settings.build_type == "Debug" and self._full_version >= "1.1.0": + with chdir(self, os.path.join(self.package_folder, "lib")): rename(self, "libssl.lib", "libssld.lib") rename(self, "libcrypto.lib", "libcryptod.lib") - # Old OpenSSL version family has issues with permissions. - # See https://github.com/conan-io/conan/issues/5831 - if self._full_version < "1.1.0" and self.options.shared and self.settings.os in ("Android", "FreeBSD", "Linux"): - with tools.chdir(os.path.join(self.package_folder, "lib")): - os.chmod("libssl.so.1.0.0", 0o755) - os.chmod("libcrypto.so.1.0.0", 0o755) + else: + autotools = Autotools(self) + args = [] + target = "install_sw" + if self._full_version >= "1.1.0": + args.append(f"DESTDIR={unix_path(self, self.package_folder)}") + else: # 1.0.2 support + args.append(f"INSTALL_PREFIX={unix_path(self, self.package_folder)}") + + with chdir(self, self.source_folder): + autotools.make(target=target, args=args) + + # Old OpenSSL version family has issues with permissions. + # See https://github.com/conan-io/conan/issues/5831 + if self._full_version < "1.1.0" and self.options.shared and self.settings.os in ("Android", "FreeBSD", "Linux"): + with chdir(self, os.path.join(self.package_folder, "lib")): + os.chmod("libssl.so.1.0.0", 0o755) + os.chmod("libcrypto.so.1.0.0", 0o755) - if self.options.shared: - libdir = os.path.join(self.package_folder, "lib") - for file in os.listdir(libdir): - if self._is_mingw and file.endswith(".dll.a"): - continue - if file.endswith(".a"): - os.unlink(os.path.join(libdir, file)) + if self.options.shared: + libdir = os.path.join(self.package_folder, "lib") + for file in os.listdir(libdir): + if self._is_mingw and file.endswith(".dll.a"): + continue + if file.endswith(".a"): + os.unlink(os.path.join(libdir, file)) - rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path) @@ -863,11 +869,11 @@ def _create_cmake_module_variables(self, module_file): set(OPENSSL_VERSION ${OpenSSL_VERSION}) endif() """ % {"config":str(self.settings.build_type).upper()}) - 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-{}-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") diff --git a/recipes/openssl/1.x.x/test_package/conanfile.py b/recipes/openssl/1.x.x/test_package/conanfile.py index 9534143abdfa60..e42aaed0f7cf11 100644 --- a/recipes/openssl/1.x.x/test_package/conanfile.py +++ b/recipes/openssl/1.x.x/test_package/conanfile.py @@ -53,4 +53,3 @@ def test(self): if not self._skip_test and can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "digest") self.run(bin_path, env="conanrun") - assert os.path.exists(os.path.join(self.deps_cpp_info["openssl"].rootpath, "licenses", "LICENSE")) diff --git a/recipes/openssl/1.x.x/test_package/digest.c b/recipes/openssl/1.x.x/test_package/digest.c index 88a5a900a54a4b..e93ed8d7789634 100644 --- a/recipes/openssl/1.x.x/test_package/digest.c +++ b/recipes/openssl/1.x.x/test_package/digest.c @@ -7,7 +7,7 @@ #include #include #if defined(WITH_ZLIB) -#include +#include #endif #if defined(_MSC_VER) && _MSC_VER < 1900 @@ -98,7 +98,8 @@ int main() printf("SSL library version: %s\n", OpenSSL_version(OPENSSL_VERSION)); #endif #if defined(WITH_ZLIB) - printf("ZLIB version: %s\n", ZLIB_VERSION); + COMP_METHOD *zlib_comp = COMP_zlib(); + printf("ZLIB compression method is named: %s\n", SSL_COMP_get_name(zlib_comp)); #endif return 0; diff --git a/recipes/openxlsx/all/conandata.yml b/recipes/openxlsx/all/conandata.yml new file mode 100644 index 00000000000000..b863f248b7ed46 --- /dev/null +++ b/recipes/openxlsx/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.4.1": + url: "https://github.com/troldal/OpenXLSX/archive/b80da42d1454f361c29117095ebe1989437db390.zip" + sha256: "feb03e603aebec3d901dc32c8bf0b3e5df63f6db9ad4bbe187aa4c1633cfd44b" diff --git a/recipes/openxlsx/all/conanfile.py b/recipes/openxlsx/all/conanfile.py new file mode 100644 index 00000000000000..47998aed0e0848 --- /dev/null +++ b/recipes/openxlsx/all/conanfile.py @@ -0,0 +1,102 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class OpenXlsxConan(ConanFile): + name = "openxlsx" + description = "reading, writing, creating and modifying Microsoft Excel® (.xlsx) files." + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/troldal/OpenXLSX" + topics = ("excel", "spreadsheet", "xlsx") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "9", + "clang": "9", + "apple-clang": "12", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + 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.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], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OPENXLSX_CREATE_DOCS"] = False + tc.variables["OPENXLSX_BUILD_SAMPLES"] = False + tc.variables["OPENXLSX_BUILD_TESTS"] = False + tc.variables["OPENXLSX_BUILD_BENCHMARKS"] = False + tc.variables["OPENXLSX_LIBRARY_TYPE"] = "SHARED" if self.options.shared else "STATIC" + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.md", 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")) + + def package_info(self): + lib_suffix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"OpenXLSX{lib_suffix}"] + + self.cpp_info.set_property("cmake_file_name", "OpenXLSX") + self.cpp_info.set_property("cmake_target_name", "OpenXLSX::OpenXLSX") + + 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") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "OpenXLSX" + self.cpp_info.filenames["cmake_find_package_multi"] = "OpenXLSX" + self.cpp_info.names["cmake_find_package"] = "OpenXLSX" + self.cpp_info.names["cmake_find_package_multi"] = "OpenXLSX" diff --git a/recipes/openxlsx/all/test_package/CMakeLists.txt b/recipes/openxlsx/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..63dbcb0eff0efc --- /dev/null +++ b/recipes/openxlsx/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(OpenXLSX REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenXLSX::OpenXLSX) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/openxlsx/all/test_package/conanfile.py b/recipes/openxlsx/all/test_package/conanfile.py new file mode 100644 index 00000000000000..a9fb96656f2039 --- /dev/null +++ b/recipes/openxlsx/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/openxlsx/all/test_package/test_package.cpp b/recipes/openxlsx/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..c717bd551aae31 --- /dev/null +++ b/recipes/openxlsx/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include "OpenXLSX/OpenXLSX.hpp" + +using namespace std; +using namespace OpenXLSX; + +int main(void) { + XLDocument doc; + doc.close(); + + return 0; +} diff --git a/recipes/openxlsx/all/test_v1_package/CMakeLists.txt b/recipes/openxlsx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/openxlsx/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/openxlsx/all/test_v1_package/conanfile.py b/recipes/openxlsx/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/openxlsx/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/openxlsx/config.yml b/recipes/openxlsx/config.yml new file mode 100644 index 00000000000000..3a9d5538921fcd --- /dev/null +++ b/recipes/openxlsx/config.yml @@ -0,0 +1,3 @@ +versions: + "0.4.1": + folder: all diff --git a/recipes/opusfile/all/conandata.yml b/recipes/opusfile/all/conandata.yml index eebd6b1e0a89c0..6248280777374c 100644 --- a/recipes/opusfile/all/conandata.yml +++ b/recipes/opusfile/all/conandata.yml @@ -8,7 +8,11 @@ sources: patches: "0.12": - patch_file: "patches/001-disable-cert-store-integration.patch" - base_path: "source_subfolder" + patch_description: "Allow to build with OpenSSL 1.1" + patch_type: "portability" + patch_source: "https://github.com/xiph/opusfile/issues/13#issuecomment-425349836" "0.11": - patch_file: "patches/001-disable-cert-store-integration.patch" - base_path: "source_subfolder" + patch_description: "Allow to build with OpenSSL 1.1" + patch_type: "portability" + patch_source: "https://github.com/xiph/opusfile/issues/13#issuecomment-425349836" diff --git a/recipes/opusfile/all/conanfile.py b/recipes/opusfile/all/conanfile.py index be6dba78da278e..c7c9a6ee8b4e26 100644 --- a/recipes/opusfile/all/conanfile.py +++ b/recipes/opusfile/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, MSBuild, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +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, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildDeps, MSBuildToolchain import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class OpusFileConan(ConanFile): @@ -24,118 +30,144 @@ class OpusFileConan(ConanFile): "http": True, } - generators = "pkg_config" - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + def export_sources(self): + 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def validate(self): - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("Opusfile doesn't support building as shared with Visual Studio") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("ogg/1.3.5") self.requires("opus/1.3.1") if self.options.http: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") + + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support building as shared with Visual Studio") def build_requirements(self): - if not self._is_msvc: - self.build_requires("libtool/2.4.6") - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not is_msvc(self): + 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", 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], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + deps = MSBuildDeps(self) + deps.configuration = self._msbuild_configuration + deps.generate() + else: + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-http={yes_no(self.options.http)}", + "--disable-examples", + ]) + tc.generate() + PkgConfigDeps(self).generate() - def _build_vs(self): - includedir = os.path.abspath(os.path.join(self._source_subfolder, "include")) - with tools.chdir(os.path.join(self._source_subfolder, "win32", "VS2015")): - msbuild = MSBuild(self) - build_type = str(self.settings.build_type) + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + sln_folder = os.path.join(self.source_folder, "win32", "VS2015") + vcxproj = os.path.join(sln_folder, "opusfile.vcxproj") if not self.options.http: - build_type += "-NoHTTP" - msbuild.build_env.include_paths.append(includedir) - msbuild.build(project_file="opusfile.sln", targets=["opusfile"], - platforms={"x86": "Win32"}, build_type=build_type, - upgrade_project=False) - - 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" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-http={}".format(yes_no(self.options.http)), - "--disable-examples", - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + replace_in_file(self, vcxproj, "OP_ENABLE_HTTP;", "") + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + replace_in_file( + self, vcxproj, + "true", + "", + ) + replace_in_file( + self, vcxproj, + "v140", + f"{MSBuildToolchain(self).toolset}", + ) + import_conan_generators = "" + for props_file in [MSBuildToolchain.filename, "conandeps.props"]: + props_path = os.path.join(self.generators_folder, props_file) + if os.path.exists(props_path): + import_conan_generators += f"" + replace_in_file( + self, vcxproj, + "", + f"{import_conan_generators}", + ) + #============================== - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self._is_msvc: - self._build_vs() + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(sln_folder, "opusfile.sln"), targets=["opusfile"]) else: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True) - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - 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="*", dst=os.path.join("include", "opus"), src=include_folder) - self.copy(pattern="*.dll", dst="bin", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + include_folder = os.path.join(self.source_folder, "include") + copy(self, "*", src=include_folder, dst=os.path.join(self.package_folder, "include", "opus")) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.components["libopusfile"].names["pkg_config"] = "opusfile" + self.cpp_info.components["libopusfile"].set_property("pkg_config_name", "opusfile") self.cpp_info.components["libopusfile"].libs = ["opusfile"] self.cpp_info.components["libopusfile"].includedirs.append(os.path.join("include", "opus")) self.cpp_info.components["libopusfile"].requires = ["ogg::ogg", "opus::opus"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["libopusfile"].system_libs = ["m", "dl", "pthread"] - if self._is_msvc: + if is_msvc(self): if self.options.http: self.cpp_info.components["libopusfile"].requires.append("openssl::openssl") else: - self.cpp_info.components["opusurl"].names["pkg_config"] = "opusurl" + self.cpp_info.set_property("pkg_config_name", "opusfile-do-not-use") + self.cpp_info.components["opusurl"].set_property("pkg_config_name", "opusurl") self.cpp_info.components["opusurl"].libs = ["opusurl"] self.cpp_info.components["opusurl"].requires = ["libopusfile"] if self.options.http: diff --git a/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch b/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch index 72a77fc47f380e..d6aaf58d662c65 100644 --- a/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch +++ b/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch @@ -1,5 +1,3 @@ -patch taken from https://github.com/xiph/opusfile/issues/13#issuecomment-425349836 for OpenSSL 1.1.1 support - diff -Nur opusfile-0.11/src/http.c opusfile-0.11-patched/src/http.c --- a/src/http.c 2018-09-14 23:25:45.000000000 +0200 +++ b/src/http.c 2018-09-27 15:42:55.161531800 +0200 diff --git a/recipes/opusfile/all/test_package/CMakeLists.txt b/recipes/opusfile/all/test_package/CMakeLists.txt index 7b9b613cbb24a3..70e83b74bb91b5 100644 --- a/recipes/opusfile/all/test_package/CMakeLists.txt +++ b/recipes/opusfile/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(opusfile REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE opusfile::opusfile) diff --git a/recipes/opusfile/all/test_package/conanfile.py b/recipes/opusfile/all/test_package/conanfile.py index d4128b04507778..98ab55852ad565 100644 --- a/recipes/opusfile/all/test_package/conanfile.py +++ b/recipes/opusfile/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 = "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,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/opusfile/all/test_v1_package/CMakeLists.txt b/recipes/opusfile/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/opusfile/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/opusfile/all/test_v1_package/conanfile.py b/recipes/opusfile/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/opusfile/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/osmanip/all/conanfile.py b/recipes/osmanip/all/conanfile.py index 8a6899850a3b87..ccea62899d7104 100644 --- a/recipes/osmanip/all/conanfile.py +++ b/recipes/osmanip/all/conanfile.py @@ -39,7 +39,7 @@ def configure(self): self.options.rm_safe("fPIC") def requirements(self): - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") if Version(self.version) < "4.2.0": self.requires("arsenalgear/1.2.2") else: diff --git a/recipes/osmanip/all/test_v1_package/CMakeLists.txt b/recipes/osmanip/all/test_v1_package/CMakeLists.txt index fbf268aae5e4a8..426dbc1aa18df9 100644 --- a/recipes/osmanip/all/test_v1_package/CMakeLists.txt +++ b/recipes/osmanip/all/test_v1_package/CMakeLists.txt @@ -5,8 +5,5 @@ project(test_package CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(osmanip REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE osmanip::osmanip) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/packio/all/conandata.yml b/recipes/packio/all/conandata.yml index 6e87f4c19f689e..409d2af8af9cf9 100644 --- a/recipes/packio/all/conandata.yml +++ b/recipes/packio/all/conandata.yml @@ -32,3 +32,6 @@ sources: "2.2.0": url: "https://github.com/qchateau/packio/archive/2.2.0.tar.gz" sha256: "ac9f33d5e8dd92bd3cdec106e10453424060bae9c4cd97281aa5d20fb20476f7" + "2.3.0": + url: "https://github.com/qchateau/packio/archive/2.3.0.tar.gz" + sha256: "4ef3bc76934855cc1a17eb00311bb42f5f14f616c75d4d1cc35151efcc988358" diff --git a/recipes/packio/config.yml b/recipes/packio/config.yml index 1ee2ce354c532a..84901be3d2175c 100644 --- a/recipes/packio/config.yml +++ b/recipes/packio/config.yml @@ -21,3 +21,5 @@ versions: folder: all "2.2.0": folder: all + "2.3.0": + folder: all diff --git a/recipes/perlinnoise/all/conandata.yml b/recipes/perlinnoise/all/conandata.yml new file mode 100644 index 00000000000000..9b1218cce4fb3b --- /dev/null +++ b/recipes/perlinnoise/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "3.0.0": + url: "https://github.com/Reputeless/PerlinNoise/archive/refs/tags/v3.0.0.tar.gz" + sha256: "1fea1e7ebeb3c66b79d60c2c398aa83ccfadcef343bd396c0f0a684380e827fc" diff --git a/recipes/perlinnoise/all/conanfile.py b/recipes/perlinnoise/all/conanfile.py new file mode 100644 index 00000000000000..5c27415325d35c --- /dev/null +++ b/recipes/perlinnoise/all/conanfile.py @@ -0,0 +1,79 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class PerlinnoiseConan(ConanFile): + name = "perlinnoise" + description = "Header-only Perlin noise library for modern C++ " + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Reputeless/PerlinNoise/" + topics = ("noise", "perlin", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compiler_required_cpp(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } + + 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._min_cppstd) + minimum_version = self._compiler_required_cpp.get(str(self.settings.compiler), False) + if minimum_version: + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") + else: + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], 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="*.hpp", + 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", "PerlinNoise") + self.cpp_info.set_property("cmake_target_name", "siv::PerlinNoise") + + self.cpp_info.components["siv"].set_property("cmake_target_name", "siv::PerlinNoise") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "PerlinNoise" + self.cpp_info.filenames["cmake_find_package_multi"] = "PerlinNoise" + self.cpp_info.names["cmake_find_package"] = "siv" + self.cpp_info.names["cmake_find_package_multi"] = "siv" + + self.cpp_info.components["siv"].names["cmake_find_package"] = "PerlinNoise" + self.cpp_info.components["siv"].names["cmake_find_package_multi"] = "PerlinNoise" diff --git a/recipes/perlinnoise/all/test_package/CMakeLists.txt b/recipes/perlinnoise/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..18878f56fc9d56 --- /dev/null +++ b/recipes/perlinnoise/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(PerlinNoise REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE siv::PerlinNoise) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/perlinnoise/all/test_package/conanfile.py b/recipes/perlinnoise/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/perlinnoise/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/perlinnoise/all/test_package/test_package.cpp b/recipes/perlinnoise/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..082d3dfe079317 --- /dev/null +++ b/recipes/perlinnoise/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include + +#include "PerlinNoise.hpp" + +int main(int argc, const char** argv) { + auto frequency = 32.f; + auto octaves = 9; + auto seed = siv::PerlinNoise::seed_type{74524}; + + auto generator = siv::PerlinNoise{seed}; + + auto width = 32; + auto height = 16; + + auto fx = width / frequency; + auto fy = height / frequency; + + for (auto y = 0; y < height; ++y) { + for (auto x = 0; x < width; ++x) { + auto color = generator.octave2D(x / fx, y / fy, octaves); + std::cout << color << " "; + } + std::cout << std::endl; + } + + return 0; +} diff --git a/recipes/perlinnoise/all/test_v1_package/CMakeLists.txt b/recipes/perlinnoise/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/perlinnoise/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +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/perlinnoise/all/test_v1_package/conanfile.py b/recipes/perlinnoise/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/perlinnoise/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/perlinnoise/config.yml b/recipes/perlinnoise/config.yml new file mode 100644 index 00000000000000..c6ac749e0b234b --- /dev/null +++ b/recipes/perlinnoise/config.yml @@ -0,0 +1,3 @@ +versions: + "3.0.0": + folder: all diff --git a/recipes/platform.interfaces/all/conandata.yml b/recipes/platform.interfaces/all/conandata.yml index e6bc2843d36970..25b51e862badd7 100644 --- a/recipes/platform.interfaces/all/conandata.yml +++ b/recipes/platform.interfaces/all/conandata.yml @@ -1,4 +1,12 @@ sources: + "0.3.41": + source: + url: "https://github.com/linksplatform/Interfaces/releases/download/cpp_0.3.41/platform.interfaces_0.3.41.zip" + sha256: "26bfb96f8918db86390cf326eba5c76cfc29f06a785d30c789445fe59371bab4" + license: + url: "https://raw.githubusercontent.com/linksplatform/Interfaces/cpp_0.3.41/LICENSE" + sha256: "79d0fc44716007dddc375601bca8879ad45bc1165bf9342b7a16572b4f41abe8" "0.1.2": - url: https://github.com/linksplatform/Interfaces/archive/refs/tags/0.4.0_0.1.2.zip - sha256: 317c29e7ac6122af14e8b1cc8e674a71ba0969c0391ee54d9e045a88d25b5739 + source: + url: "https://github.com/linksplatform/Interfaces/archive/refs/tags/0.4.0_0.1.2.tar.gz" + sha256: "61283bf6488b9051e9f9e80e89ab0d1f85b76a1dbee3fd27f193e678f23903e2" diff --git a/recipes/platform.interfaces/all/conanfile.py b/recipes/platform.interfaces/all/conanfile.py index 4b44a9f82e9bd3..b269b0438ae49e 100644 --- a/recipes/platform.interfaces/all/conanfile.py +++ b/recipes/platform.interfaces/all/conanfile.py @@ -1,60 +1,93 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, download +from conan.tools.layout import basic_layout +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 PlatformInterfacesConan(ConanFile): name = "platform.interfaces" - license = "Unlicense" - homepage = "https://github.com/linksplatform/Interfaces" - url = "https://github.com/conan-io/conan-center-index" description = """platform.interfaces is one of the libraries of the LinksPlatform modular framework, which uses innovations from the C++20 standard, for easier use of static polymorphism. It also includes some auxiliary structures for more convenient work with containers.""" + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/linksplatform/Interfaces" topics = ("platform", "concepts", "header-only") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _subfolder_sources(self): + return os.path.join(self.source_folder, "cpp", "Platform.Interfaces") @property - def _subfolder_sources(self): - return os.path.join(self._source_subfolder, "cpp", "Platform.Interfaces") + def _min_cppstd(self): + return "20" @property def _compilers_minimum_version(self): return { - "gcc": "10", + "gcc": "11", "Visual Studio": "16", - "clang": "11", - "apple-clang": "11" + "msvc": "193", + "clang": "13", } + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def validate(self): - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("platform.interfaces/{} " - "requires C++20 with {}, " + if self.settings.compiler == "apple-clang": + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, " "which is not supported " - "by {} {}.".format(self.version, self.settings.compiler, self.settings.compiler, self.settings.compiler.version)) + f"by {self.settings.compiler}.") + if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 20) + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, " + "which is not supported " + "by {self.settings.compiler} {self.settings.compiler.version}.") 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]["source"], strip_root=True) + if Version(self.version) >= "0.3.41": + download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE") def package(self): - self.copy("*.h", dst="include", src=self._subfolder_sources) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - def package_id(self): - self.info.header_only() + if Version(self.version) < "0.3.41": + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "cpp", "Platform.Interfaces"), + ) + else: + 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", "Platform.Interfaces") + self.cpp_info.set_property("cmake_target_name", "Platform.Interfaces::Platform.Interfaces") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "Platform.Interfaces" self.cpp_info.names["cmake_find_package_multi"] = "Platform.Interfaces" diff --git a/recipes/platform.interfaces/all/test_package/CMakeLists.txt b/recipes/platform.interfaces/all/test_package/CMakeLists.txt index d7e44f864ad880..b54dd14513b954 100644 --- a/recipes/platform.interfaces/all/test_package/CMakeLists.txt +++ b/recipes/platform.interfaces/all/test_package/CMakeLists.txt @@ -1,9 +1,12 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(Platform.Interfaces REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CONAN_PKG::platform.interfaces) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20) +target_link_libraries(${PROJECT_NAME} PRIVATE Platform.Interfaces::Platform.Interfaces) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) + +if(Platform.Interfaces_VERSION VERSION_GREATER_EQUAL "0.2.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE -DPLATFORM_INTERFACES_0_2_0_LATER) +endif() diff --git a/recipes/platform.interfaces/all/test_package/conanfile.py b/recipes/platform.interfaces/all/test_package/conanfile.py index bd7165a553cf41..e845ae751a3017 100644 --- a/recipes/platform.interfaces/all/test_package/conanfile.py +++ b/recipes/platform.interfaces/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 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/platform.interfaces/all/test_package/test_package.cpp b/recipes/platform.interfaces/all/test_package/test_package.cpp index e7eb9119d9793e..58843ae8a5fa98 100644 --- a/recipes/platform.interfaces/all/test_package/test_package.cpp +++ b/recipes/platform.interfaces/all/test_package/test_package.cpp @@ -7,6 +7,8 @@ using namespace Platform::Interfaces; +#if not defined (PLATFORM_INTERFACES_0_2_0_LATER) + void print(IEnumerable auto&& enumerable) { auto size = std::ranges::size(enumerable); @@ -42,6 +44,45 @@ void add(Collection& collection, const std::same_as auto& item) } } +#else + +void print(CEnumerable auto&& enumerable) +{ + auto size = std::ranges::size(enumerable); + + std::cout << '['; + for (int i = 0; auto&& item : enumerable) + { + std::cout << item; + if (i < size - 1) + { + std::cout << ", "; + } + + i++; + } + std::cout << ']' << std::endl; +} + +template::Item> +requires + CList || + CSet || + CDictionary +void add(Collection& collection, const std::same_as auto& item) +{ + if constexpr (CList) + { + collection.push_back(item); + } + else + { + collection.insert(item); + } +} + +#endif + int main() { std::vector v { 1, 2, 3 }; diff --git a/recipes/platform.interfaces/all/test_v1_package/CMakeLists.txt b/recipes/platform.interfaces/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/platform.interfaces/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/platform.interfaces/all/test_v1_package/conanfile.py b/recipes/platform.interfaces/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/platform.interfaces/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/platform.interfaces/config.yml b/recipes/platform.interfaces/config.yml index b3c71bd313abc6..6293fc33900962 100644 --- a/recipes/platform.interfaces/config.yml +++ b/recipes/platform.interfaces/config.yml @@ -1,3 +1,5 @@ versions: + "0.3.41": + folder: all "0.1.2": folder: all diff --git a/recipes/plog/all/conandata.yml b/recipes/plog/all/conandata.yml index 62dac8352bca60..a2d1cb2b746a69 100644 --- a/recipes/plog/all/conandata.yml +++ b/recipes/plog/all/conandata.yml @@ -1,5 +1,7 @@ sources: + "1.1.9": + url: "https://github.com/SergiusTheBest/plog/archive/1.1.9.tar.gz" + sha256: "058315b9ec9611b659337d4333519ab4783fad3f2f23b1cc7bb84d977ea38055" "1.1.5": url: "https://github.com/SergiusTheBest/plog/archive/1.1.5.tar.gz" sha256: "6c80b4701183d2415bec927e1f5ca9b1761b3b5c65d3e09fb29c743e016d5609" - diff --git a/recipes/plog/all/conanfile.py b/recipes/plog/all/conanfile.py index 0837c0bceb43bb..791d2759099196 100644 --- a/recipes/plog/all/conanfile.py +++ b/recipes/plog/all/conanfile.py @@ -1,28 +1,37 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools +required_conan_version = ">=1.52.0" class PlogConan(ConanFile): name = "plog" description = "Pretty powerful logging library in about 1000 lines of code" - homepage = "https://github.com/SergiusTheBest/plog" - url = "https://github.com/conan-io/conan-center-index" license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/SergiusTheBest/plog" topics = ("logging", "header-only", "portable") 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 source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", src=os.path.join(self._source_subfolder, "include"), dst=os.path.join("include")) + 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=os.path.join(self.source_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/plog/all/test_package/CMakeLists.txt b/recipes/plog/all/test_package/CMakeLists.txt index 945696beb2efc2..690cbc43fe6947 100644 --- a/recipes/plog/all/test_package/CMakeLists.txt +++ b/recipes/plog/all/test_package/CMakeLists.txt @@ -1,8 +1,11 @@ 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(plog 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 plog::plog) + +if(plog_VERSION VERSION_GREATER_EQUAL "1.1.6") + target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE -DPLOG_EXPLICIT_INIT) +endif() diff --git a/recipes/plog/all/test_package/conanfile.py b/recipes/plog/all/test_package/conanfile.py index 07847b3d9465f8..e845ae751a3017 100644 --- a/recipes/plog/all/test_package/conanfile.py +++ b/recipes/plog/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 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.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/plog/all/test_package/test_package.cpp b/recipes/plog/all/test_package/test_package.cpp index 3013bd66097690..7f43b933834551 100644 --- a/recipes/plog/all/test_package/test_package.cpp +++ b/recipes/plog/all/test_package/test_package.cpp @@ -1,6 +1,9 @@ #include #include +#ifdef PLOG_EXPLICIT_INIT +# include +#endif int main() { plog::init(plog::debug, "log.txt"); diff --git a/recipes/plog/all/test_v1_package/CMakeLists.txt b/recipes/plog/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/plog/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/plog/all/test_v1_package/conanfile.py b/recipes/plog/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/plog/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/plog/config.yml b/recipes/plog/config.yml index e48685771bd642..c3432fc6b2f2ae 100644 --- a/recipes/plog/config.yml +++ b/recipes/plog/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.9": + folder: all "1.1.5": folder: all diff --git a/recipes/proj/all/conandata.yml b/recipes/proj/all/conandata.yml index b3c7bcfc14d9d8..6a5d57f6c5cd39 100644 --- a/recipes/proj/all/conandata.yml +++ b/recipes/proj/all/conandata.yml @@ -1,7 +1,10 @@ sources: + "9.1.1": + url: "https://github.com/OSGeo/PROJ/releases/download/9.1.1/proj-9.1.1.tar.gz" + sha256: "003cd4010e52bb5eb8f7de1c143753aa830c8902b6ed01209f294846e40e6d39" "9.1.0": url: "https://github.com/OSGeo/PROJ/releases/download/9.1.0/proj-9.1.0.tar.gz" - sha256: 81b2239b94cad0886222cde4f53cb49d34905aad2a1317244a0c30a553db2315 + sha256: "81b2239b94cad0886222cde4f53cb49d34905aad2a1317244a0c30a553db2315" "9.0.1": url: "https://github.com/OSGeo/PROJ/releases/download/9.0.1/proj-9.0.1.tar.gz" sha256: "737eaacbe7906d0d6ff43f0d9ebedc5c734cccc9e6b8d7beefdec3ab22d9a6a3" @@ -11,21 +14,6 @@ sources: "8.2.1": url: "https://github.com/OSGeo/PROJ/releases/download/8.2.1/proj-8.2.1.tar.gz" sha256: "76ed3d0c3a348a6693dfae535e5658bbfd47f71cb7ff7eb96d9f12f7e068b1cf" - "8.2.0": - url: "https://github.com/OSGeo/PROJ/releases/download/8.2.0/proj-8.2.0.tar.gz" - sha256: "de93df9a4aa88d09459ead791f2dbc874b897bf67a5bbb3e4b68de7b1bdef13c" - "8.1.1": - url: "https://github.com/OSGeo/PROJ/releases/download/8.1.1/proj-8.1.1.tar.gz" - sha256: "82f1345e5fa530c407cb1fc0752e83f8d08d2b98772941bbdc7820241f7fada2" - "8.1.0": - url: "https://github.com/OSGeo/PROJ/releases/download/8.1.0/proj-8.1.0.tar.gz" - sha256: "22c5cdc5aa0832077b16c95ebeec748a0942811c1c3438c33d43c8d2ead59f48" - "8.0.1": - url: "https://github.com/OSGeo/PROJ/releases/download/8.0.1/proj-8.0.1.tar.gz" - sha256: "e0463a8068898785ca75dd49a261d3d28b07d0a88f3b657e8e0089e16a0375fa" - "8.0.0": - url: "https://github.com/OSGeo/PROJ/releases/download/8.0.0/proj-8.0.0.tar.gz" - sha256: "aa5d4b934450149a350aed7e5fbac880e2f7d3fa2f251c26cb64228f96a2109e" "7.2.1": url: "https://github.com/OSGeo/PROJ/releases/download/7.2.1/proj-7.2.1.tar.gz" sha256: "b384f42e5fb9c6d01fe5fa4d31da2e91329668863a684f97be5d4760dbbf0a14" @@ -33,6 +21,10 @@ sources: url: "https://github.com/OSGeo/PROJ/releases/download/6.3.1/proj-6.3.1.tar.gz" sha256: "6de0112778438dcae30fcc6942dee472ce31399b9e5a2b67e8642529868c86f8" patches: + "9.1.1": + - patch_file: "patches/0001-use-cmake-targets-9.1.0.patch" + patch_type: "conan" + patch_description: "Use cmake targets" "9.1.0": - patch_file: "patches/0001-use-cmake-targets-9.1.0.patch" patch_type: "conan" @@ -46,32 +38,13 @@ patches: patch_type: "conan" patch_description: "Use cmake targets" - patch_file: "patches/0002-cmake-configure-proj-pc.patch" - patch_type: "conan" - patch_description: "cmake configure proj pc (fixed by https://github.com/OSGeo/PROJ/pull/3087)" + patch_type: "portability" + patch_description: "cmake configure proj pc" + patch_source: "https://github.com/OSGeo/PROJ/pull/3087" "8.2.1": - patch_file: "patches/0001-use-cmake-targets-8.2.0.patch" patch_type: "conan" patch_description: "Use cmake targets" - "8.2.0": - - patch_file: "patches/0001-use-cmake-targets-8.2.0.patch" - patch_type: "conan" - patch_description: "Use cmake targets" - "8.1.1": - - patch_file: "patches/0001-use-cmake-targets-8.1.1.patch" - patch_type: "conan" - patch_description: "Use cmake targets" - "8.1.0": - - patch_file: "patches/0001-use-cmake-targets-8.1.0.patch" - patch_type: "conan" - patch_description: "Use cmake targets" - "8.0.1": - - patch_file: "patches/0001-use-cmake-targets-8.0.0.patch" - patch_type: "conan" - patch_description: "Use cmake targets" - "8.0.0": - - patch_file: "patches/0001-use-cmake-targets-8.0.0.patch" - patch_type: "conan" - patch_description: "Use cmake targets" "7.2.1": - patch_file: "patches/0001-use-cmake-targets-7.2.1.patch" patch_type: "conan" diff --git a/recipes/proj/all/conanfile.py b/recipes/proj/all/conanfile.py index b4cde813263f56..4aee84d29a2250 100644 --- a/recipes/proj/all/conanfile.py +++ b/recipes/proj/all/conanfile.py @@ -1,7 +1,6 @@ from conan import ConanFile from conan.tools.apple import is_apple_os -from conans.tools import stdcpp_library -from conan.tools.build import cross_building +from conan.tools.build import cross_building, stdcpp_library from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv, VirtualRunEnv from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file, collect_libs, rm, rename @@ -10,7 +9,7 @@ import os -required_conan_version = ">=1.53.0" +required_conan_version = ">=1.54.0" class ProjConan(ConanFile): @@ -181,9 +180,6 @@ def package_info(self): self.cpp_info.components["projlib"].set_property("cmake_target_name", f"{cmake_namespace}::proj") self.cpp_info.components["projlib"].set_property("pkg_config_name", "proj") - self.cpp_info.filenames["cmake_find_package"] = cmake_config_filename - self.cpp_info.filenames["cmake_find_package_multi"] = cmake_config_filename - self.cpp_info.components["projlib"].libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["projlib"].system_libs.append("m") @@ -194,8 +190,10 @@ def package_info(self): self.cpp_info.components["projlib"].system_libs.append("shell32") if proj_version >= "7.1.0": self.cpp_info.components["projlib"].system_libs.append("Ole32") - if not self.options.shared and stdcpp_library(self): - self.cpp_info.components["projlib"].system_libs.append(stdcpp_library(self)) + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.components["projlib"].system_libs.append(libcxx) self.cpp_info.components["projlib"].requires.extend(["nlohmann_json::nlohmann_json", "sqlite3::sqlite3"]) if self.options.get_safe("with_tiff"): self.cpp_info.components["projlib"].requires.append("libtiff::libtiff") @@ -208,21 +206,23 @@ def package_info(self): if not self.options.shared: self.cpp_info.components["projlib"].defines.append("PROJ_DLL=") + # see https://proj.org/usage/environmentvars.html#envvar-PROJ_DATA + proj_data_env_var_name = "PROJ_LIB" if Version(self.version) < "9.1.0" else "PROJ_DATA" res_path = os.path.join(self.package_folder, "res") - self.output.info(f"Prepending to PROJ_LIB environment variable: {res_path}") - self.runenv_info.prepend_path("PROJ_LIB", res_path) - - # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator - self.env_info.PROJ_LIB = res_path - + self.runenv_info.prepend_path(proj_data_env_var_name, res_path) if self.options.build_executables: - self.buildenv_info.prepend_path("PROJ_LIB", res_path) - 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) + self.buildenv_info.prepend_path(proj_data_env_var_name, res_path) # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = cmake_config_filename + self.cpp_info.filenames["cmake_find_package_multi"] = cmake_config_filename self.cpp_info.names["cmake_find_package"] = cmake_namespace self.cpp_info.names["cmake_find_package_multi"] = cmake_namespace self.cpp_info.components["projlib"].names["cmake_find_package"] = "proj" self.cpp_info.components["projlib"].names["cmake_find_package_multi"] = "proj" + if Version(self.version) < "9.1.0": + self.env_info.PROJ_LIB.append(res_path) + else: + self.env_info.PROJ_DATA.append(res_path) + if self.options.build_executables: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch deleted file mode 100644 index 39da5da53f2231..00000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff -ru a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt 2021-02-26 02:37:25.000000000 +0800 -+++ b/CMakeLists.txt 2022-12-14 21:26:48.404915901 +0800 -@@ -121,6 +121,8 @@ - include(ProjMac) - include(policies) - -+find_package(nlohmann_json REQUIRED) -+ - ################################################################################ - # Check for sqlite3 - ################################################################################ -diff -ru a/src/lib_proj.cmake b/src/lib_proj.cmake ---- a/src/lib_proj.cmake 2021-02-20 19:15:52.000000000 +0800 -+++ b/src/lib_proj.cmake 2022-12-14 21:25:41.713734988 +0800 -@@ -394,21 +394,18 @@ - target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) - endif() - --target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) --target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PUBLIC nlohmann_json::nlohmann_json PRIVATE SQLite::SQLite3) - - if(TIFF_ENABLED) - target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) -- target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIR}) -- target_link_libraries(proj PRIVATE ${TIFF_LIBRARY}) -+ target_link_libraries(proj PRIVATE TIFF::TIFF) - endif() - - if(CURL_ENABLED) - target_compile_definitions(proj PRIVATE -DCURL_ENABLED) -- target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIR}) - target_link_libraries(proj - PRIVATE -- ${CURL_LIBRARY} -+ CURL::libcurl - $<$:ws2_32> - $<$:wldap32> - $<$:advapi32> diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch deleted file mode 100644 index 332c0650174f9a..00000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -393,8 +393,7 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) - target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) - endif() - --target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) --target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE SQLite::SQLite3) - - if(NLOHMANN_JSON STREQUAL "external") - target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) -@@ -403,16 +402,14 @@ endif() - - if(TIFF_ENABLED) - target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) -- target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIR}) -- target_link_libraries(proj PRIVATE ${TIFF_LIBRARY}) -+ target_link_libraries(proj PRIVATE TIFF::TIFF) - endif() - - if(CURL_ENABLED) - target_compile_definitions(proj PRIVATE -DCURL_ENABLED) -- target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIR}) - target_link_libraries(proj - PRIVATE -- ${CURL_LIBRARY} -+ CURL::libcurl - $<$:ws2_32> - $<$:wldap32> - $<$:advapi32> diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch deleted file mode 100644 index bdb11d748aa629..00000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -393,8 +393,7 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) - target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) - endif() - --target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) --target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE SQLite::SQLite3) - - if(NLOHMANN_JSON STREQUAL "external") - target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) -@@ -404,16 +403,14 @@ endif() - - if(TIFF_ENABLED) - target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) -- target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIR}) -- target_link_libraries(proj PRIVATE ${TIFF_LIBRARY}) -+ target_link_libraries(proj PRIVATE TIFF::TIFF) - endif() - - if(CURL_ENABLED) - target_compile_definitions(proj PRIVATE -DCURL_ENABLED) -- target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIR}) - target_link_libraries(proj - PRIVATE -- ${CURL_LIBRARY} -+ CURL::libcurl - $<$:ws2_32> - $<$:wldap32> - $<$:advapi32> diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch index 0a4659e2173fa3..ddd144b4ef1226 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch @@ -1,6 +1,6 @@ ---- a/src/src/lib_proj.cmake 2022-08-29 01:53:05.000000000 +0800 -+++ b/src/lib_proj.cmake 2022-11-09 00:03:25.165493175 +0800 -@@ -447,8 +447,7 @@ +--- a/src/lib_proj.cmake ++++ b/src/lib_proj.cmake +@@ -447,8 +447,7 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) endif() @@ -10,7 +10,7 @@ if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) -@@ -458,16 +458,14 @@ +@@ -458,16 +457,14 @@ endif() if(TIFF_ENABLED) target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) diff --git a/recipes/proj/config.yml b/recipes/proj/config.yml index 0024c64a0bcb76..b8b070a608bedc 100644 --- a/recipes/proj/config.yml +++ b/recipes/proj/config.yml @@ -1,4 +1,6 @@ versions: + "9.1.1": + folder: "all" "9.1.0": folder: "all" "9.0.1": @@ -7,16 +9,6 @@ versions: folder: "all" "8.2.1": folder: "all" - "8.2.0": - folder: "all" - "8.1.1": - folder: "all" - "8.1.0": - folder: "all" - "8.0.1": - folder: "all" - "8.0.0": - folder: "all" "7.2.1": folder: "all" "6.3.1": diff --git a/recipes/protobuf/all/CMakeLists.txt b/recipes/protobuf/all/CMakeLists.txt deleted file mode 100644 index 70bacbfbf8f9a6..00000000000000 --- a/recipes/protobuf/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/cmake) diff --git a/recipes/protobuf/all/conandata.yml b/recipes/protobuf/all/conandata.yml index 8c08d5344edff0..29f76dd85aed7d 100644 --- a/recipes/protobuf/all/conandata.yml +++ b/recipes/protobuf/all/conandata.yml @@ -17,10 +17,12 @@ sources: "3.18.1": url: "https://github.com/protocolbuffers/protobuf/archive/v3.18.1.tar.gz" sha256: "9111bf0b542b631165fadbd80aa60e7fb25b25311c532139ed2089d76ddf6dd7" - "3.17.1": - url: "https://github.com/protocolbuffers/protobuf/archive/v3.17.1.tar.gz" - sha256: "036d66d6eec216160dd898cfb162e9d82c1904627642667cc32b104d407bb411" patches: + "3.19.6": + - patch_file: "patches/upstream-pr-9437-msvc-runtime.patch" + patch_description: "Properly handle CMAKE_MSVC_RUNTIME_LIBRARY when using CMake >= 3.15" + patch_type: "backport" "3.19.4": - - patch_file: "patches/upstream-pr-9153-msvc-runtime.patch" - base_path: "source_subfolder" + - patch_file: "patches/upstream-pr-9437-msvc-runtime.patch" + patch_description: "Properly handle CMAKE_MSVC_RUNTIME_LIBRARY when using CMake >= 3.15" + patch_type: "backport" diff --git a/recipes/protobuf/all/conanfile.py b/recipes/protobuf/all/conanfile.py index d23242627557db..3ea42d981f0042 100644 --- a/recipes/protobuf/all/conanfile.py +++ b/recipes/protobuf/all/conanfile.py @@ -1,17 +1,15 @@ -from conan.tools.files import rename, get, apply_conandata_patches, replace_in_file, rmdir, rm -from conan.tools.microsoft import msvc_runtime_flag, is_msvc -from conan.tools.scm import Version -from conan.tools.build import cross_building -from conan.errors import ConanInvalidConfiguration from conan import ConanFile -from conans import CMake +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 copy, rename, get, apply_conandata_patches, export_conandata_patches, replace_in_file, rmdir, rm +from conan.tools.microsoft import check_min_vs, msvc_runtime_flag, is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version -import functools import os import textwrap -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53" class ProtobufConan(ConanFile): @@ -41,19 +39,10 @@ class ProtobufConan(ConanFile): } short_paths = True - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _is_clang_cl(self): - return self.settings.compiler == 'clang' and self.settings.os == 'Windows' + return self.settings.compiler == "clang" and self.settings.os == "Windows" @property def _is_clang_x86(self): @@ -64,9 +53,7 @@ def _can_disable_rtti(self): return Version(self.version) >= "3.15.4" 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": @@ -76,60 +63,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: 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"]: + if self.options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Protobuf can't be built with shared + MT(d) runtimes") - if self.settings.compiler == "Visual Studio": - if Version(self.settings.compiler.version) < "14": - raise ConanInvalidConfiguration("On Windows Protobuf can only be built with " - "Visual Studio 2015 or higher.") + check_min_vs(self, "190") if self.settings.compiler == "clang": if Version(self.version) >= "3.15.4" and Version(self.settings.compiler.version) < "4": raise ConanInvalidConfiguration("protobuf {} doesn't support clang < 4".format(self.version)) - if hasattr(self, "settings_build") and cross_building(self) and \ - self.settings.os == "Macos" and self.options.shared: - # FIXME: should be allowed, actually build succeeds but it fails at build time of test package due to SIP - raise ConanInvalidConfiguration("protobuf shared not supported yet in CCI while cross-building on Macos") - 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], strip_root=True) @property def _cmake_install_base_path(self): return os.path.join("lib", "cmake", "protobuf") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CMAKE_INSTALL_CMAKEDIR"] = self._cmake_install_base_path.replace("\\", "/") - cmake.definitions["protobuf_WITH_ZLIB"] = self.options.with_zlib - cmake.definitions["protobuf_BUILD_TESTS"] = False - cmake.definitions["protobuf_BUILD_PROTOC_BINARIES"] = True + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_INSTALL_CMAKEDIR"] = self._cmake_install_base_path.replace("\\", "/") + tc.cache_variables["protobuf_WITH_ZLIB"] = self.options.with_zlib + tc.cache_variables["protobuf_BUILD_TESTS"] = False + tc.cache_variables["protobuf_BUILD_PROTOC_BINARIES"] = self.settings.os != "tvOS" if not self.options.debug_suffix: - cmake.definitions["protobuf_DEBUG_POSTFIX"] = "" + tc.cache_variables["protobuf_DEBUG_POSTFIX"] = "" if Version(self.version) >= "3.14.0": - cmake.definitions["protobuf_BUILD_LIBPROTOC"] = True + tc.cache_variables["protobuf_BUILD_LIBPROTOC"] = self.settings.os != "tvOS" if self._can_disable_rtti: - cmake.definitions["protobuf_DISABLE_RTTI"] = not self.options.with_rtti + tc.cache_variables["protobuf_DISABLE_RTTI"] = not self.options.with_rtti if is_msvc(self) or self._is_clang_cl: runtime = msvc_runtime_flag(self) if not runtime: runtime = self.settings.get_safe("compiler.runtime") - cmake.definitions["protobuf_MSVC_STATIC_RUNTIME"] = "MT" in runtime - if Version(self.version) < "3.18.0" and self._is_clang_cl: - cmake.definitions["CMAKE_RC_COMPILER"] = os.environ.get("RC", "llvm-rc") - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["protobuf_MSVC_STATIC_RUNTIME"] = "MT" in runtime + if is_apple_os(self) and self.options.shared: + # Workaround against SIP on macOS for consumers while invoking protoc when protobuf lib is shared + tc.variables["CMAKE_INSTALL_RPATH"] = "@loader_path/../lib" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): apply_conandata_patches(self) @@ -137,7 +120,7 @@ def _patch_sources(self): # Provide relocatable protobuf::protoc target and Protobuf_PROTOC_EXECUTABLE cache variable # TODO: some of the following logic might be disabled when conan will # allow to create executable imported targets in package_info() - protobuf_config_cmake = os.path.join(self._source_subfolder, "cmake", "protobuf-config.cmake.in") + protobuf_config_cmake = os.path.join(self.source_folder, "cmake", "protobuf-config.cmake.in") replace_in_file(self, protobuf_config_cmake, @@ -169,27 +152,9 @@ def _patch_sources(self): protoc_target ) - # Set DYLD_LIBRARY_PATH in command line to avoid issues with shared protobuf - # (even with virtualrunenv, this fix might be required due to SIP) - # Only works with cmake, cmake_find_package or cmake_find_package_multi generators - if is_apple_os(self): - replace_in_file(self, - protobuf_config_cmake, - "add_custom_command(", - ("set(CUSTOM_DYLD_LIBRARY_PATH ${CONAN_LIB_DIRS} ${Protobuf_LIB_DIRS} ${Protobuf_LIB_DIRS_RELEASE} ${Protobuf_LIB_DIRS_DEBUG} ${Protobuf_LIB_DIRS_RELWITHDEBINFO} ${Protobuf_LIB_DIRS_MINSIZEREL})\n" - "string(REPLACE \";\" \":\" CUSTOM_DYLD_LIBRARY_PATH \"${CUSTOM_DYLD_LIBRARY_PATH}\")\n" - "add_custom_command(") - ) - cmd_str = "COMMAND protobuf::protoc" if Version(self.version) < "3.20.0" else "COMMAND protobuf::protoc" - replace_in_file(self, - protobuf_config_cmake, - cmd_str, - "COMMAND ${CMAKE_COMMAND} -E env \"DYLD_LIBRARY_PATH=${CUSTOM_DYLD_LIBRARY_PATH}\" $" - ) - # Disable a potential warning in protobuf-module.cmake.in # TODO: remove this patch? Is it really useful? - protobuf_module_cmake = os.path.join(self._source_subfolder, "cmake", "protobuf-module.cmake.in") + protobuf_module_cmake = os.path.join(self.source_folder, "cmake", "protobuf-module.cmake.in") replace_in_file(self, protobuf_module_cmake, "if(DEFINED Protobuf_SRC_ROOT_FOLDER)", @@ -204,18 +169,20 @@ def _patch_sources(self): # https://github.com/protocolbuffers/protobuf/issues/9916 # it will be solved in protobuf 3.21.0 if Version(self.version) == "3.20.0": - replace_in_file(self, os.path.join(self._source_subfolder, "src", "google", "protobuf", "port_def.inc"), + replace_in_file(self, os.path.join(self.source_folder, "src", "google", "protobuf", "port_def.inc"), "#elif PROTOBUF_GNUC_MIN(12, 0)", "#elif PROTOBUF_GNUC_MIN(12, 2)") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake_root = "cmake" if Version(self.version) < "3.21" else None + cmake.configure(build_script_folder=cmake_root) 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() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) os.unlink(os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-config-version.cmake")) @@ -262,9 +229,10 @@ def package_info(self): self.cpp_info.components["libprotobuf"].defines = ["PROTOBUF_USE_DLLS"] # libprotoc - self.cpp_info.components["libprotoc"].set_property("cmake_target_name", "protobuf::libprotoc") - self.cpp_info.components["libprotoc"].libs = [lib_prefix + "protoc" + lib_suffix] - self.cpp_info.components["libprotoc"].requires = ["libprotobuf"] + if self.settings.os != "tvOS": + self.cpp_info.components["libprotoc"].set_property("cmake_target_name", "protobuf::libprotoc") + self.cpp_info.components["libprotoc"].libs = [lib_prefix + "protoc" + lib_suffix] + self.cpp_info.components["libprotoc"].requires = ["libprotobuf"] # libprotobuf-lite if self.options.lite: diff --git a/recipes/protobuf/all/patches/upstream-pr-9437-msvc-runtime.patch b/recipes/protobuf/all/patches/upstream-pr-9437-msvc-runtime.patch new file mode 100644 index 00000000000000..06cb0a97681d10 --- /dev/null +++ b/recipes/protobuf/all/patches/upstream-pr-9437-msvc-runtime.patch @@ -0,0 +1,17 @@ +Fix from Protobuf PR: https://github.com/protocolbuffers/protobuf/pull/9437 + +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -182,7 +182,11 @@ else (protobuf_BUILD_SHARED_LIBS) + # making programmatic control difficult. Prefer the functionality in newer + # CMake versions when available. + if(CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15) +- set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) ++ if (protobuf_MSVC_STATIC_RUNTIME) ++ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) ++ else() ++ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>DLL) ++ endif() + else() + # In case we are building static libraries, link also the runtime library statically + # so that MSVCR*.DLL is not required at runtime. diff --git a/recipes/protobuf/all/test_package/CMakeLists.txt b/recipes/protobuf/all/test_package/CMakeLists.txt index ca3bf5d1881694..a5240f3215abb5 100644 --- a/recipes/protobuf/all/test_package/CMakeLists.txt +++ b/recipes/protobuf/all/test_package/CMakeLists.txt @@ -1,21 +1,21 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.15) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(protobuf CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp addressbook.proto) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}") +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") if (protobuf_LITE) - target_link_libraries(${PROJECT_NAME} protobuf::libprotobuf-lite) + target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf-lite) else() - target_link_libraries(${PROJECT_NAME} protobuf::libprotobuf) + target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf) endif() -target_link_libraries(${PROJECT_NAME} protobuf::libprotoc) +if(TARGET protobuf::libprotoc) + target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotoc) +endif() protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS TARGET ${PROJECT_NAME}) protobuf_generate(LANGUAGE cpp TARGET ${PROJECT_NAME} PROTOS addressbook.proto) diff --git a/recipes/protobuf/all/test_package/conanfile.py b/recipes/protobuf/all/test_package/conanfile.py index 06d5305cf8a670..3823d923c46842 100644 --- a/recipes/protobuf/all/test_package/conanfile.py +++ b/recipes/protobuf/all/test_package/conanfile.py @@ -1,24 +1,41 @@ from conan import ConanFile -from conan.tools.build import cross_building -from conans import CMake +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - if hasattr(self, "settings_build") and cross_building(self): - self.build_requires(str(self.requires["protobuf"])) + if cross_building(self) and hasattr(self, "settings_build"): + self.tool_requires(self.tested_reference_str) + + def generate(self): + VirtualRunEnv(self).generate() + if cross_building(self) and hasattr(self, "settings_build"): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") + tc = CMakeToolchain(self) + tc.cache_variables["protobuf_LITE"] = self.dependencies[self.tested_reference_str].options.lite + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["protobuf_LITE"] = self.options["protobuf"].lite cmake.configure() cmake.build() def test(self): - if not cross_building(self): - self.run("protoc --version", run_environment=True) - 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/protobuf/all/test_v1_package/CMakeLists.txt b/recipes/protobuf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..f16bc97992e860 --- /dev/null +++ b/recipes/protobuf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_v1_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/protobuf/all/test_v1_package/conanfile.py b/recipes/protobuf/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..06d5305cf8a670 --- /dev/null +++ b/recipes/protobuf/all/test_v1_package/conanfile.py @@ -0,0 +1,24 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build_requirements(self): + if hasattr(self, "settings_build") and cross_building(self): + self.build_requires(str(self.requires["protobuf"])) + + def build(self): + cmake = CMake(self) + cmake.definitions["protobuf_LITE"] = self.options["protobuf"].lite + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + self.run("protoc --version", run_environment=True) + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/protobuf/config.yml b/recipes/protobuf/config.yml index c22211a7a9d4ea..86eea577c6b032 100644 --- a/recipes/protobuf/config.yml +++ b/recipes/protobuf/config.yml @@ -11,5 +11,3 @@ versions: folder: all "3.18.1": folder: all - "3.17.1": - folder: all diff --git a/recipes/qarchive/all/conandata.yml b/recipes/qarchive/all/conandata.yml index 7ae24ee9ad7cac..da2432b9b6e33b 100644 --- a/recipes/qarchive/all/conandata.yml +++ b/recipes/qarchive/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.4": + url: "https://github.com/antony-jr/QArchive/archive/v2.2.4.tar.gz" + sha256: "7c7f0e3bf3d6fb5130aa4632201873511944cd98ab16b273da5072198f53ad7b" "2.2.3": url: "https://github.com/antony-jr/QArchive/archive/v2.2.3.tar.gz" sha256: "2ada10efda34fe96c25744dd67e74ec68587d30ab01cc20be25cbcfb1e6262c4" diff --git a/recipes/qarchive/config.yml b/recipes/qarchive/config.yml index c6b70feeb93407..3db8c0c3676e91 100644 --- a/recipes/qarchive/config.yml +++ b/recipes/qarchive/config.yml @@ -1,4 +1,6 @@ versions: + "2.2.4": + folder: all "2.2.3": folder: all "2.1.1": diff --git a/recipes/qcustomplot/all/conandata.yml b/recipes/qcustomplot/all/conandata.yml index 817a87b4a32538..9655ef7e13aab0 100644 --- a/recipes/qcustomplot/all/conandata.yml +++ b/recipes/qcustomplot/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1.1": + url: "https://www.qcustomplot.com/release/2.1.1/QCustomPlot-source.tar.gz" + sha256: "5e2d22dec779db8f01f357cbdb25e54fbcf971adaee75eae8d7ad2444487182f" "2.1.0": url: "https://www.qcustomplot.com/release/2.1.0fixed/QCustomPlot-source.tar.gz" sha256: "357b78be0f52b2d01c17ec3e2e1271255761810af7e8a9476cef51fccf1a0f44" diff --git a/recipes/qcustomplot/config.yml b/recipes/qcustomplot/config.yml index 7d0ad87c0d0d85..a7d0cc4f0654be 100644 --- a/recipes/qcustomplot/config.yml +++ b/recipes/qcustomplot/config.yml @@ -1,4 +1,6 @@ versions: + "2.1.1": + folder: all "2.1.0": folder: all "1.3.2": diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index 1ffad75cd4fb3f..b156686dc16e78 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -1,4 +1,11 @@ sources: + "5.15.8": + url: + - "https://download.qt.io/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + sha256: "776a9302c336671f9406a53bd30b8e36f825742b2ec44a57c08217bff0fa86b9" "5.15.7": url: - "https://download.qt.io/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" @@ -21,7 +28,26 @@ sources: - "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.8": + - 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/chromium-v8-missing-constexpr.patch" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/v8" + - patch_file: "patches/chromium-skia-missing-iterator-include.patch" + base_path: "qt5/qtwebengine/src/3rdparty" + - patch_file: "patches/skia-cd397f3.diff" + 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" + - patch_file: "patches/337f28c9ab-5.15.8.patch" + base_path: "qt5/qtbase" "5.15.7": + - patch_file: "patches/337f28c9ab.patch" + base_path: "qt5/qtbase" - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" @@ -45,6 +71,8 @@ patches: - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" base_path: "qt5/qtwebengine/src/3rdparty" "5.15.6": + - patch_file: "patches/337f28c9ab.patch" + base_path: "qt5/qtbase" - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" @@ -68,6 +96,8 @@ patches: - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" base_path: "qt5/qtwebengine/src/3rdparty" "5.15.5": + - patch_file: "patches/337f28c9ab-5.15.5.patch" + base_path: "qt5/qtbase" - 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 80caa2e546079c..d761c194504bb8 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, replace_in_file, rm, rmdir, save, export_conandata_patches, apply_conandata_patches +from conan.tools.files import chdir, copy, get, load, replace_in_file, rm, rmdir, save, export_conandata_patches, apply_conandata_patches from conan.tools.microsoft import msvc_runtime_flag, is_msvc from conan.tools.scm import Version from conans import tools, RunEnvironment @@ -52,7 +52,7 @@ class QtConan(ConanFile): topics = ("ui", "framework") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.qt.io" - license = "LGPL-3.0" + license = "LGPL-3.0-only" settings = "os", "arch", "compiler", "build_type" options = { @@ -85,6 +85,7 @@ class QtConan(ConanFile): "with_gssapi": [True, False], "with_atspi": [True, False], "with_md4c": [True, False], + "with_x11": [True, False], "gui": [True, False], "widgets": [True, False], @@ -126,6 +127,7 @@ class QtConan(ConanFile): "with_gssapi": False, "with_atspi": False, "with_md4c": True, + "with_x11": True, "gui": True, "widgets": True, @@ -147,24 +149,24 @@ def _settings_build(self): return getattr(self, "settings_build", self.settings) def export(self): - self.copy(f"qtmodules{self.version}.conf") + copy(self, f"qtmodules{self.version}.conf", self.recipe_folder, self.export_folder) def export_sources(self): export_conandata_patches(self) def build_requirements(self): if self._settings_build.os == "Windows" and is_msvc(self): - self.build_requires("jom/1.1.3") + self.tool_requires("jom/1.1.3") if self.options.qtwebengine: - self.build_requires("ninja/1.11.1") - self.build_requires("nodejs/16.3.0") - self.build_requires("gperf/3.1") + self.tool_requires("ninja/1.11.1") + self.tool_requires("nodejs/16.3.0") + self.tool_requires("gperf/3.1") # gperf, bison, flex, python >= 2.7.5 & < 3 if self.settings.os != "Windows": - self.build_requires("bison/3.8.2") - self.build_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") else: - self.build_requires("winflexbison/2.5.24") + self.tool_requires("winflexbison/2.5.24") # Check if a valid python2 is available in PATH or it will failflex # Start by checking if python2 can be found @@ -202,13 +204,14 @@ def build_requirements(self): raise ConanInvalidConfiguration(msg) if self.options.qtwayland: - self.build_requires("wayland/1.21.0") + self.tool_requires("wayland/1.21.0") def config_options(self): if self.settings.os not in ["Linux", "FreeBSD"]: del self.options.with_icu del self.options.with_fontconfig del self.options.with_libalsa + del self.options.with_x11 del self.options.qtx11extras if self.settings.compiler == "apple-clang": if Version(self.settings.compiler.version) < "10.0": @@ -246,6 +249,7 @@ def configure(self): del self.options.with_libjpeg del self.options.with_libpng del self.options.with_md4c + del self.options.with_x11 if not self.options.with_dbus: del self.options.with_atspi @@ -343,10 +347,16 @@ def validate(self): # https://bugreports.qt.io/browse/QTBUG-95952 raise ConanInvalidConfiguration("Pulseaudio needs to be built with glib option or qt's configure script won't detect it") - if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: - raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") + if self.settings.os in ['Linux', 'FreeBSD']: + if self.options.with_gssapi: + raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") + + if self.options.get_safe("with_x11", False) and not self.dependencies.direct_host["xkbcommon"].options.with_x11: + raise ConanInvalidConfiguration("The 'with_x11' option for the 'xkbcommon' package must be enabled when the 'with_x11' option is enabled") + if self.options.get_safe("qtwayland", False) and not self.dependencies.direct_host["xkbcommon"].options.with_wayland: + raise ConanInvalidConfiguration("The 'with_wayland' option for the 'xkbcommon' package must be enabled when the 'qtwayland' option is enabled") - if cross_building(self) and self.options.cross_compile == "None": + if cross_building(self) and self.options.cross_compile == "None" and not is_apple_os(self): raise ConanInvalidConfiguration("option cross_compile must be set for cross compilation " "cf https://doc.qt.io/qt-5/configure-options.html#cross-compilation-options") @@ -361,7 +371,7 @@ def requirements(self): if is_apple_os(self): self.requires("moltenvk/1.1.10") if self.options.with_glib: - self.requires("glib/2.74.0") + self.requires("glib/2.75.2") # if self.options.with_libiconv: # QTBUG-84708 # self.requires("libiconv/1.16")# QTBUG-84708 if self.options.with_doubleconversion and not self.options.multiconfiguration: @@ -380,7 +390,7 @@ def requirements(self): else: self.requires("libjpeg/9e") if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration: - self.requires("libpng/1.6.38") + self.requires("libpng/1.6.39") if self.options.with_sqlite3 and not self.options.multiconfiguration: self.requires("sqlite3/3.39.4") self.options["sqlite3"].enable_column_metadata = True @@ -395,9 +405,9 @@ def requirements(self): self.requires("openal/1.22.2") if self.options.get_safe("with_libalsa", False): self.requires("libalsa/1.2.7.2") - if self.options.gui and not self.options.qtwayland and self.settings.os in ["Linux", "FreeBSD"]: + if self.options.get_safe("with_x11", False): + self.requires("xkbcommon/1.5.0") self.requires("xorg/system") - self.requires("xkbcommon/1.4.1") if self.options.get_safe("opengl", "no") != "no": self.requires("opengl/system") if self.options.with_zstd: @@ -419,6 +429,7 @@ def requirements(self): self.requires("dbus/1.15.2") if self.options.qtwayland: self.requires("wayland/1.21.0") + self.requires("xkbcommon/1.5.0") if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: self.requires("krb5/1.18.3") # conan-io/conan-center-index#4102 if self.options.get_safe("with_atspi"): @@ -551,6 +562,8 @@ def _xplatform(self): def build(self): args = ["-confirm-license", "-silent", "-nomake examples", "-nomake tests", f"-prefix {self.package_folder}"] + if cross_building(self): + args.append(f"-extprefix {self.package_folder}") args.append("-v") args.append("-archdatadir %s" % os.path.join(self.package_folder, "bin", "archdatadir")) args.append("-datadir %s" % os.path.join(self.package_folder, "bin", "datadir")) @@ -803,7 +816,7 @@ def package(self): Translations = bin/datadir/translations Documentation = bin/datadir/doc Examples = bin/datadir/examples""") - self.copy("*LICENSE*", src="qt5/", dst="licenses") + copy(self, "*LICENSE*", os.path.join(self.source_folder, "qt5/"), os.path.join(self.package_folder, "licenses")) for module in self._submodules: if not self.options.get_safe(module): rmdir(self, os.path.join(self.package_folder, "licenses", module)) @@ -1025,8 +1038,11 @@ def _create_plugin(pluginname, libname, plugintype, requires): gui_reqs.append("libpng::libpng") if self.options.get_safe("with_fontconfig", False): gui_reqs.append("fontconfig::fontconfig") - if not self.options.qtwayland and self.settings.os in ["Linux", "FreeBSD"]: - gui_reqs.extend(["xorg::xorg", "xkbcommon::xkbcommon"]) + if self.settings.os in ["Linux", "FreeBSD"]: + if self.options.qtwayland or self.options.get_safe("with_x11", False): + gui_reqs.append("xkbcommon::xkbcommon") + if self.options.get_safe("with_x11", False): + gui_reqs.append("xorg::xorg") if self.options.get_safe("opengl", "no") != "no": gui_reqs.append("opengl::opengl") if self.options.get_safe("with_vulkan", False): @@ -1124,15 +1140,17 @@ def _create_plugin(pluginname, libname, plugintype, requires): service_support_reqs.append("DBus") _create_module("ServiceSupport", service_support_reqs) _create_module("EdidSupport") - if not self.options.qtwayland: + if self.options.get_safe("with_x11", False): _create_module("XkbCommonSupport", ["Core", "Gui", "xkbcommon::libxkbcommon-x11"]) xcb_qpa_reqs = ["Core", "Gui", "ServiceSupport", "ThemeSupport", "FontDatabaseSupport", "EdidSupport", "XkbCommonSupport", "xorg::xorg"] + elif self.options.qtwayland: + _create_module("XkbCommonSupport", ["Core", "Gui", "xkbcommon::libxkbcommon"]) if self.options.with_dbus and self.options.with_atspi: _create_module("LinuxAccessibilitySupport", ["Core", "DBus", "Gui", "AccessibilitySupport", "at-spi2-core::at-spi2-core"]) xcb_qpa_reqs.append("LinuxAccessibilitySupport") if self.options.get_safe("with_vulkan"): xcb_qpa_reqs.append("VulkanSupport") - if not self.options.qtwayland: + if self.options.get_safe("with_x11", False): _create_module("XcbQpa", xcb_qpa_reqs, has_include_dir=False) _create_plugin("QXcbIntegrationPlugin", "qxcb", "platforms", ["Core", "Gui", "XcbQpa"]) diff --git a/recipes/qt/5.x.x/patches/337f28c9ab-5.15.5.patch b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.5.patch new file mode 100644 index 00000000000000..a2ea249c1db5fa --- /dev/null +++ b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.5.patch @@ -0,0 +1,40 @@ +From 337f28c9abb12f28538cfe2f49e5afc460578b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= +Date: Tue, 5 Jul 2022 15:38:33 +0200 +Subject: Darwin: Replace deprecated symbol kIOMasterPortDefault with + equivalent + +We can't use the replacement kIOMainPortDefault yet, as it's not +available in operating system versions we still support, but the +kIOMasterPortDefault documentation explicitly says that passing +NULL as a port argument indicates "use the default". + +As the underlying type of a mach_port_t is potentially either +a pointer or an unsigned int, we initialize the default to 0. + +Pick-to: 6.2 6.3 6.4 5.15 +Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 +Reviewed-by: Alexandru Croitor +--- + src/corelib/global/qglobal.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'src/corelib/global/qglobal.cpp') + +diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp +index 738e39658f..c894471ad6 100644 +--- a/src/corelib/global/qglobal.cpp ++++ b/src/corelib/global/qglobal.cpp +@@ -3059,7 +3059,8 @@ QByteArray QSysInfo::machineUniqueId() + { + #if defined(Q_OS_DARWIN) && __has_include() + char uuid[UuidStringLen + 1]; +- io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); ++ static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault ++ io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +-- +cgit v1.2.1 + diff --git a/recipes/qt/5.x.x/patches/337f28c9ab-5.15.8.patch b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.8.patch new file mode 100644 index 00000000000000..053e6afa62e83b --- /dev/null +++ b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.8.patch @@ -0,0 +1,39 @@ +From 337f28c9abb12f28538cfe2f49e5afc460578b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= +Date: Tue, 5 Jul 2022 15:38:33 +0200 +Subject: Darwin: Replace deprecated symbol kIOMasterPortDefault with + equivalent + +We can't use the replacement kIOMainPortDefault yet, as it's not +available in operating system versions we still support, but the +kIOMasterPortDefault documentation explicitly says that passing +NULL as a port argument indicates "use the default". + +As the underlying type of a mach_port_t is potentially either +a pointer or an unsigned int, we initialize the default to 0. + +Pick-to: 6.2 6.3 6.4 5.15 +Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 +Reviewed-by: Alexandru Croitor +--- + src/corelib/global/qglobal.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'src/corelib/global/qglobal.cpp') + +diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp +index 738e39658f..c894471ad6 100644 +--- a/src/corelib/global/qglobal.cpp ++++ b/src/corelib/global/qglobal.cpp +@@ -3077,7 +3077,8 @@ QByteArray QSysInfo::machineUniqueId() + { + #if defined(Q_OS_DARWIN) && __has_include() + char uuid[UuidStringLen + 1]; +- io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); ++ static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault ++ io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +-- +cgit v1.2.1 diff --git a/recipes/qt/5.x.x/patches/337f28c9ab.patch b/recipes/qt/5.x.x/patches/337f28c9ab.patch new file mode 100644 index 00000000000000..6784be15b8cfe0 --- /dev/null +++ b/recipes/qt/5.x.x/patches/337f28c9ab.patch @@ -0,0 +1,40 @@ +From 337f28c9abb12f28538cfe2f49e5afc460578b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= +Date: Tue, 5 Jul 2022 15:38:33 +0200 +Subject: Darwin: Replace deprecated symbol kIOMasterPortDefault with + equivalent + +We can't use the replacement kIOMainPortDefault yet, as it's not +available in operating system versions we still support, but the +kIOMasterPortDefault documentation explicitly says that passing +NULL as a port argument indicates "use the default". + +As the underlying type of a mach_port_t is potentially either +a pointer or an unsigned int, we initialize the default to 0. + +Pick-to: 6.2 6.3 6.4 5.15 +Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 +Reviewed-by: Alexandru Croitor +--- + src/corelib/global/qglobal.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'src/corelib/global/qglobal.cpp') + +diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp +index 738e39658f..c894471ad6 100644 +--- a/src/corelib/global/qglobal.cpp ++++ b/src/corelib/global/qglobal.cpp +@@ -3067,7 +3067,8 @@ QByteArray QSysInfo::machineUniqueId() + { + #if defined(Q_OS_DARWIN) && __has_include() + char uuid[UuidStringLen + 1]; +- io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); ++ static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault ++ io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +-- +cgit v1.2.1 + diff --git a/recipes/qt/5.x.x/qtmodules5.15.8.conf b/recipes/qt/5.x.x/qtmodules5.15.8.conf new file mode 100644 index 00000000000000..452233655f279d --- /dev/null +++ b/recipes/qt/5.x.x/qtmodules5.15.8.conf @@ -0,0 +1,326 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 5.15 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 5.15 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtsvg + path = qtdeclarative + url = ../qtdeclarative.git + branch = 5.15 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 5.15 + status = addon +[submodule "qtscript"] + depends = qtbase + recommends = qttools + path = qtscript + url = ../qtscript.git + branch = 5.15 + status = deprecated +[submodule "qtmultimedia"] + depends = qtbase + recommends = qtdeclarative + path = qtmultimedia + url = ../qtmultimedia.git + branch = 5.15 + status = essential +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 5.15 + status = essential +[submodule "qtxmlpatterns"] + depends = qtbase + recommends = qtdeclarative + path = qtxmlpatterns + url = ../qtxmlpatterns.git + branch = 5.15 + status = deprecated +[submodule "qttranslations"] + depends = qttools + path = qttranslations + url = ../qttranslations.git + branch = 5.15 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia qtquickcontrols qtquickcontrols2 + path = qtdoc + url = ../qtdoc.git + branch = 5.15 + status = essential + priority = 40 +[submodule "qtrepotools"] + path = qtrepotools + url = ../qtrepotools.git + branch = master + status = essential + project = - +[submodule "qtqa"] + depends = qtbase + path = qtqa + url = ../qtqa.git + branch = master + status = essential + priority = 50 +[submodule "qtlocation"] + depends = qtbase + recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport + path = qtlocation + url = ../qtlocation.git + branch = 5.15 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 5.15 + status = addon +[submodule "qtsystems"] + depends = qtbase + recommends = qtdeclarative + path = qtsystems + url = ../qtsystems.git + branch = dev + status = ignore +[submodule "qtfeedback"] + depends = qtdeclarative + recommends = qtmultimedia + path = qtfeedback + url = ../qtfeedback.git + branch = master + status = ignore +[submodule "qtdocgallery"] + depends = qtdeclarative + path = qtdocgallery + url = ../qtdocgallery.git + branch = master + status = ignore +[submodule "qtpim"] + depends = qtdeclarative + path = qtpim + url = ../qtpim.git + branch = dev + status = ignore +[submodule "qtconnectivity"] + depends = qtbase + recommends = qtdeclarative qtandroidextras + path = qtconnectivity + url = ../qtconnectivity.git + branch = 5.15 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 5.15 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtimageformats qtgamepad + path = qt3d + url = ../qt3d.git + branch = 5.15 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 5.15 + status = addon +[submodule "qtgraphicaleffects"] + depends = qtdeclarative + path = qtgraphicaleffects + url = ../qtgraphicaleffects.git + branch = 5.15 + status = essential +[submodule "qtquickcontrols"] + depends = qtdeclarative + recommends = qtgraphicaleffects + path = qtquickcontrols + url = ../qtquickcontrols.git + branch = 5.15 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 5.15 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 5.15 + status = addon +[submodule "qtx11extras"] + depends = qtbase + path = qtx11extras + url = ../qtx11extras.git + branch = 5.15 + status = addon +[submodule "qtmacextras"] + depends = qtbase + path = qtmacextras + url = ../qtmacextras.git + branch = 5.15 + status = addon +[submodule "qtwinextras"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtwinextras + url = ../qtwinextras.git + branch = 5.15 + status = addon +[submodule "qtandroidextras"] + depends = qtbase + path = qtandroidextras + url = ../qtandroidextras.git + branch = 5.15 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 5.15 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 5.15 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools + path = qtwebengine + url = ../qtwebengine.git + branch = 5.15 + status = addon + priority = 10 +[submodule "qtcanvas3d"] + depends = qtdeclarative + path = qtcanvas3d + url = ../qtcanvas3d.git + branch = dev + status = ignore +[submodule "qtwebview"] + depends = qtdeclarative + recommends = qtwebengine + path = qtwebview + url = ../qtwebview.git + branch = 5.15 + status = addon +[submodule "qtquickcontrols2"] + depends = qtgraphicaleffects + recommends = qtimageformats + path = qtquickcontrols2 + url = ../qtquickcontrols2.git + branch = 5.15 + status = essential +[submodule "qtpurchasing"] + depends = qtbase + recommends = qtdeclarative qtandroidextras + path = qtpurchasing + url = ../qtpurchasing.git + branch = 5.15 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 5.15 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 5.15 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia qtquickcontrols + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 5.15 + status = addon +[submodule "qtgamepad"] + depends = qtbase + recommends = qtdeclarative + path = qtgamepad + url = ../qtgamepad.git + branch = 5.15 + status = addon +[submodule "qtscxml"] + depends = qtbase qtdeclarative + path = qtscxml + url = ../qtscxml.git + branch = 5.15 + status = addon +[submodule "qtspeech"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtspeech + url = ../qtspeech.git + branch = 5.15 + status = addon +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 5.15 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 5.15 + status = addon +[submodule "qtwebglplugin"] + depends = qtbase qtwebsockets + recommends = qtdeclarative + path = qtwebglplugin + url = ../qtwebglplugin.git + branch = 5.15 + status = addon +[submodule "qtlottie"] + depends = qtbase qtdeclarative + path = qtlottie + url = ../qtlottie.git + branch = 5.15 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 5.15 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative + path = qtquick3d + url = ../qtquick3d.git + branch = 5.15 + status = addon diff --git a/recipes/qt/6.x.x/conandata.yml b/recipes/qt/6.x.x/conandata.yml index 9e25152cc68fc7..fa3f6c751ce192 100644 --- a/recipes/qt/6.x.x/conandata.yml +++ b/recipes/qt/6.x.x/conandata.yml @@ -1,4 +1,12 @@ sources: + "6.4.2": + url: + - "https://download.qt.io/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + sha256: "689f53e6652da82fccf7c2ab58066787487339f28d1ec66a8765ad357f4976be" "6.4.1": url: - "https://download.qt.io/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" @@ -24,6 +32,16 @@ sources: - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" sha256: "cfe41905b6bde3712c65b102ea3d46fc80a44c9d1487669f14e4a6ee82ebb8fd" patches: + "6.4.2": + - base_path: "qtbase/cmake" + patch_file: "patches/qt6-pri-helpers-fix.diff" + - patch_file: "patches/c72097e.diff" + base_path: "qtwebengine" + - patch_file: "patches/d13958d.diff" + base_path: "qtbase" + patch_description: "Fix PCRE2 detection" + patch_type: "bugfix" + patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/445885" "6.4.1": - base_path: "qtbase/cmake" patch_file: "patches/qt6-pri-helpers-fix.diff" diff --git a/recipes/qt/6.x.x/conanfile.py b/recipes/qt/6.x.x/conanfile.py index 11e269b6da1f1e..5d14c217230f8d 100644 --- a/recipes/qt/6.x.x/conanfile.py +++ b/recipes/qt/6.x.x/conanfile.py @@ -8,9 +8,9 @@ from conan import ConanFile from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.build import cross_building, check_min_cppstd, build_jobs +from conan.tools.build import cross_building, check_min_cppstd, build_jobs, default_cppstd from conan.tools.env import VirtualBuildEnv, Environment -from conan.tools.files import get, replace_in_file, apply_conandata_patches, save, rm, rmdir, export_conandata_patches +from conan.tools.files import copy, get, replace_in_file, apply_conandata_patches, save, rm, rmdir, export_conandata_patches from conan.tools.gnu import PkgConfigDeps from conan.tools.microsoft import msvc_runtime_flag, is_msvc from conan.tools.scm import Version @@ -18,7 +18,7 @@ from conans import RunEnvironment, tools from conans.model import Generator -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.55.0" class qt(Generator): @@ -65,10 +65,10 @@ class QtConan(ConanFile): name = "qt" description = "Qt is a cross-platform framework for graphical user interfaces." - topics = ("qt", "ui") + topics = ("framework", "ui") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.qt.io" - license = "LGPL-3.0" + license = "LGPL-3.0-only" settings = "os", "arch", "compiler", "build_type" options = { @@ -98,6 +98,7 @@ class QtConan(ConanFile): "with_pulseaudio": [True, False], "with_gssapi": [True, False], "with_md4c": [True, False], + "with_x11": [True, False], "gui": [True, False], "widgets": [True, False], @@ -140,6 +141,7 @@ class QtConan(ConanFile): "with_pulseaudio": False, "with_gssapi": False, "with_md4c": True, + "with_x11": True, "gui": True, "widgets": True, @@ -185,7 +187,7 @@ def export_sources(self): export_conandata_patches(self) def export(self): - self.copy("qtmodules%s.conf" % self.version) + copy(self, f"qtmodules{self.version}.conf", self.recipe_folder, self.export_folder) def config_options(self): if self.settings.os not in ["Linux", "FreeBSD"]: @@ -193,6 +195,7 @@ def config_options(self): del self.options.with_fontconfig self.options.with_glib = False del self.options.with_libalsa + del self.options.with_x11 if self.settings.os == "Windows": self.options.opengl = "dynamic" @@ -224,6 +227,7 @@ def configure(self): del self.options.with_libjpeg del self.options.with_libpng del self.options.with_md4c + del self.options.with_x11 if not self.options.get_safe("qtmultimedia"): del self.options.with_libalsa @@ -344,6 +348,11 @@ def validate(self): if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") + if self.options.get_safe("with_x11", False) and not self.dependencies.direct_host["xkbcommon"].options.with_x11: + raise ConanInvalidConfiguration("The 'with_x11' option for the 'xkbcommon' package must be enabled when the 'with_x11' option is enabled") + if self.options.get_safe("qtwayland", False) and not self.dependencies.direct_host["xkbcommon"].options.with_wayland: + raise ConanInvalidConfiguration("The 'with_wayland' option for the 'xkbcommon' package must be enabled when the 'qtwayland' option is enabled") + if cross_building(self): raise ConanInvalidConfiguration("cross compiling qt 6 is not yet supported. Contributions are welcome") @@ -361,7 +370,7 @@ def requirements(self): if is_apple_os(self): self.requires("moltenvk/1.2.0") if self.options.with_glib: - self.requires("glib/2.75.0") + self.requires("glib/2.75.1") if self.options.with_doubleconversion and not self.options.multiconfiguration: self.requires("double-conversion/3.2.1") if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration: @@ -393,14 +402,15 @@ def requirements(self): self.requires("openal/1.22.2") if self.options.get_safe("with_libalsa", False): self.requires("libalsa/1.2.7.2") - if self.options.gui and self.settings.os in ["Linux", "FreeBSD"]: - self.requires("xorg/system") + if self.options.get_safe("with_x11", False): self.requires("xkbcommon/1.4.1") + self.requires("xorg/system") if self.settings.os != "Windows" and self.options.get_safe("opengl", "no") != "no": self.requires("opengl/system") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.qtwayland: + self.requires("xkbcommon/1.4.1") self.requires("wayland/1.21.0") if self.options.with_brotli: self.requires("brotli/1.0.9") @@ -410,7 +420,7 @@ def requirements(self): self.requires("xorg-proto/2022.2") self.requires("libxshmfence/1.3") self.requires("nss/3.85") - self.requires("libdrm/2.4.109") + self.requires("libdrm/2.4.114") if self.options.get_safe("with_gstreamer", False): self.requires("gst-plugins-base/1.19.2") if self.options.get_safe("with_pulseaudio", False): @@ -423,24 +433,24 @@ def requirements(self): self.requires("md4c/0.4.8") def build_requirements(self): - self.build_requires("cmake/3.25.0") - self.build_requires("ninja/1.11.1") - self.build_requires("pkgconf/1.9.3") + self.tool_requires("cmake/3.25.0") + self.tool_requires("ninja/1.11.1") + self.tool_requires("pkgconf/1.9.3") if self.settings.os == "Windows": - self.build_requires('strawberryperl/5.32.1.1') + self.tool_requires('strawberryperl/5.32.1.1') if self.options.get_safe("qtwebengine"): - self.build_requires("nodejs/16.3.0") - self.build_requires("gperf/3.1") + self.tool_requires("nodejs/16.3.0") + self.tool_requires("gperf/3.1") # gperf, bison, flex, python >= 2.7.5 & < 3 if self.settings.os != "Windows": - self.build_requires("bison/3.8.2") - self.build_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") else: - self.build_requires("winflexbison/2.5.24") + self.tool_requires("winflexbison/2.5.24") if self.options.qtwayland: - self.build_requires("wayland/1.21.0") + self.tool_requires("wayland/1.21.0") if cross_building(self): self.tool_requires(f"qt/{self.version}") @@ -449,6 +459,13 @@ def generate(self): ms.generate() tc = CMakeDeps(self) + tc.set_property("libdrm", "cmake_file_name", "Libdrm") + tc.set_property("libdrm::libdrm_libdrm", "cmake_target_name", "Libdrm::Libdrm") + tc.set_property("wayland", "cmake_file_name", "Wayland") + tc.set_property("wayland::wayland-client", "cmake_target_name", "Wayland::Client") + tc.set_property("wayland::wayland-server", "cmake_target_name", "Wayland::Server") + tc.set_property("wayland::wayland-cursor", "cmake_target_name", "Wayland::Cursor") + tc.set_property("wayland::wayland-egl", "cmake_target_name", "Wayland::Egl") tc.generate() for f in glob.glob("*.cmake"): @@ -593,6 +610,17 @@ def generate(self): #"set(QT_EXTRA_INCLUDEPATHS ${CONAN_INCLUDE_DIRS})\n" #"set(QT_EXTRA_DEFINES ${CONAN_DEFINES})\n" #"set(QT_EXTRA_LIBDIRS ${CONAN_LIB_DIRS})\n" + + current_cpp_std = self.settings.get_safe("compiler.cppstd", default_cppstd(self)) + current_cpp_std = str(current_cpp_std).replace("gnu", "") + cpp_std_map = { + "20": "FEATURE_cxx20" + } + if Version(self.version) >= "6.5.0": + cpp_std_map["23"] = "FEATURE_cxx2b" + + tc.variables[cpp_std_map.get(current_cpp_std, "FEATURE_cxx17")] = "ON" + tc.generate() def source(self): @@ -781,7 +809,7 @@ def package(self): cmake = CMake(self) cmake.install() save(self, os.path.join(self.package_folder, "bin", "qt.conf"), qt.content_template("..", "res", self.settings.os)) - self.copy("*LICENSE*", src=self.source_folder, dst="licenses") + copy(self, "*LICENSE*", self.source_folder, os.path.join(self.package_folder, "licenses")) for module in self._get_module_tree: if module != "qtbase" and not self.options.get_safe(module): rmdir(self, os.path.join(self.package_folder, "licenses", module)) @@ -1013,6 +1041,8 @@ def _create_plugin(pluginname, libname, type, requires): self.cpp_info.components["qtPlatform"].includedirs = [os.path.join("res", "archdatadir", "mkspecs", self._xplatform())] if Version(self.version) < "6.1.0": self.cpp_info.components["qtCore"].libs.append("Qt6Core_qobject%s" % libsuffix) + if self.options.with_dbus: + _create_module("DBus", ["dbus::dbus"]) if self.options.gui: gui_reqs = [] if self.options.with_dbus: @@ -1024,7 +1054,10 @@ def _create_plugin(pluginname, libname, type, requires): if self.options.get_safe("with_fontconfig", False): gui_reqs.append("fontconfig::fontconfig") if self.settings.os in ["Linux", "FreeBSD"]: - gui_reqs.extend(["xorg::xorg", "xkbcommon::xkbcommon"]) + if self.options.qtwayland or self.options.get_safe("with_x11", False): + gui_reqs.append("xkbcommon::xkbcommon") + if self.options.get_safe("with_x11", False): + gui_reqs.append("xorg::xorg") if self.settings.os != "Windows" and self.options.get_safe("opengl", "no") != "no": gui_reqs.append("opengl::opengl") if self.options.get_safe("with_vulkan", False): @@ -1065,7 +1098,7 @@ def _create_plugin(pluginname, libname, type, requires): _create_plugin("QMinimalIntegrationPlugin", "qminimal", "platforms", []) elif self.settings.os == "Emscripten": _create_plugin("QWasmIntegrationPlugin", "qwasm", "platforms", ["Core", "Gui"]) - elif self.settings.os in ["Linux", "FreeBSD"]: + elif self.options.get_safe("with_x11", False): _create_module("XcbQpaPrivate", ["xkbcommon::libxkbcommon-x11", "xorg::xorg"], has_include_dir=False) _create_plugin("QXcbIntegrationPlugin", "qxcb", "platforms", ["Core", "Gui", "XcbQpaPrivate"]) @@ -1105,8 +1138,6 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("OpenGL", ["Gui"]) if self.options.widgets and self.options.get_safe("opengl", "no") != "no": _create_module("OpenGLWidgets", ["OpenGL", "Widgets"]) - if self.options.with_dbus: - _create_module("DBus", ["dbus::dbus"]) _create_module("Concurrent") _create_module("Xml") @@ -1142,6 +1173,9 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Designer", ["Gui", "UiPlugin", "Widgets", "Xml"]) _create_module("Help", ["Gui", "Sql", "Widgets"]) + if self.options.qtshadertools and self.options.gui: + _create_module("ShaderTools", ["Gui"]) + if self.options.qtquick3d and qt_quick_enabled: _create_module("Quick3DUtils", ["Gui"]) _create_module("Quick3DAssetImport", ["Gui", "Qml", "Quick3DUtils"]) @@ -1153,9 +1187,6 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("QuickControls2", ["Gui", "Quick"]) _create_module("QuickTemplates2", ["Gui", "Quick"]) - if self.options.qtshadertools and self.options.gui: - _create_module("ShaderTools", ["Gui"]) - if self.options.qtsvg and self.options.gui: _create_module("Svg", ["Gui"]) if self.options.widgets: diff --git a/recipes/qt/6.x.x/qtmodules6.4.2.conf b/recipes/qt/6.x.x/qtmodules6.4.2.conf new file mode 100644 index 00000000000000..10324ecab234bc --- /dev/null +++ b/recipes/qt/6.x.x/qtmodules6.4.2.conf @@ -0,0 +1,318 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 6.4.2 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 6.4.2 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtimageformats qtshadertools qtsvg qtlanguageserver + path = qtdeclarative + url = ../qtdeclarative.git + branch = 6.4.2 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 6.4.2 + status = addon +[submodule "qtmultimedia"] + depends = qtbase qtshadertools + recommends = qtdeclarative qtquick3d + path = qtmultimedia + url = ../qtmultimedia.git + branch = 6.4.2 + status = addon +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 6.4.2 + status = essential +[submodule "qtxmlpatterns"] + depends = qtbase + recommends = qtdeclarative + path = qtxmlpatterns + url = ../qtxmlpatterns.git + branch = dev + status = ignore +[submodule "qttranslations"] + depends = qttools + path = qttranslations + url = ../qttranslations.git + branch = 6.4.2 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia + path = qtdoc + url = ../qtdoc.git + branch = 6.4.2 + status = essential + priority = 40 +[submodule "qtrepotools"] + path = qtrepotools + url = ../qtrepotools.git + branch = master + status = essential + project = - +[submodule "qtqa"] + depends = qtbase + path = qtqa + url = ../qtqa.git + branch = dev + status = essential + priority = 50 +[submodule "qtlocation"] + depends = qtbase qtpositioning + recommends = qtdeclarative + path = qtlocation + url = ../qtlocation.git + branch = dev + status = ignore +[submodule "qtpositioning"] + depends = qtbase + recommends = qtdeclarative qtserialport + path = qtpositioning + url = ../qtpositioning.git + branch = 6.4.2 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 6.4.2 + status = addon +[submodule "qtsystems"] + depends = qtbase + recommends = qtdeclarative + path = qtsystems + url = ../qtsystems.git + branch = dev + status = ignore +[submodule "qtfeedback"] + depends = qtdeclarative + recommends = qtmultimedia + path = qtfeedback + url = ../qtfeedback.git + branch = master + status = ignore +[submodule "qtpim"] + depends = qtdeclarative + path = qtpim + url = ../qtpim.git + branch = dev + status = ignore +[submodule "qtconnectivity"] + depends = qtbase + recommends = qtdeclarative + path = qtconnectivity + url = ../qtconnectivity.git + branch = 6.4.2 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 6.4.2 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtshadertools + path = qt3d + url = ../qt3d.git + branch = 6.4.2 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 6.4.2 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 6.4.2 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 6.4.2 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 6.4.2 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 6.4.2 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtwebchannel qttools qtpositioning + path = qtwebengine + url = ../qtwebengine.git + branch = 6.4.2 + status = addon + priority = 10 +[submodule "qtcanvas3d"] + depends = qtdeclarative + path = qtcanvas3d + url = ../qtcanvas3d.git + branch = dev + status = ignore +[submodule "qtwebview"] + depends = qtdeclarative + recommends = qtwebengine + path = qtwebview + url = ../qtwebview.git + branch = 6.4.2 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 6.4.2 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 6.4.2 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 6.4.2 + status = addon +[submodule "qtgamepad"] + depends = qtbase + recommends = qtdeclarative + path = qtgamepad + url = ../qtgamepad.git + branch = dev + status = ignore +[submodule "qtscxml"] + depends = qtbase qtdeclarative + path = qtscxml + url = ../qtscxml.git + branch = 6.4.2 + status = addon +[submodule "qtspeech"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtspeech + url = ../qtspeech.git + branch = 6.4.2 + status = addon +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 6.4.2 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 6.4.2 + status = addon +[submodule "qtwebglplugin"] + depends = qtbase qtwebsockets + recommends = qtdeclarative + path = qtwebglplugin + url = ../qtwebglplugin.git + branch = dev + status = ignore +[submodule "qtlottie"] + depends = qtbase qtdeclarative + path = qtlottie + url = ../qtlottie.git + branch = 6.4.2 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 6.4.2 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquicktimeline + path = qtquick3d + url = ../qtquick3d.git + branch = 6.4.2 + status = addon +[submodule "qtshadertools"] + depends = qtbase + path = qtshadertools + url = ../qtshadertools.git + branch = 6.4.2 + status = addon +[submodule "qt5compat"] + depends = qtbase qtdeclarative + path = qt5compat + url = ../qt5compat.git + branch = 6.4.2 + status = deprecated +[submodule "qtcoap"] + depends = qtbase + path = qtcoap + url = ../qtcoap.git + branch = 6.4.2 + status = addon +[submodule "qtmqtt"] + depends = qtbase qtdeclarative + path = qtmqtt + url = ../qtmqtt.git + branch = 6.4.2 + status = addon +[submodule "qtopcua"] + depends = qtbase qtdeclarative + path = qtopcua + url = ../qtopcua.git + branch = 6.4.2 + status = addon +[submodule "qtlanguageserver"] + depends = qtbase + path = qtlanguageserver + url = ../qtlanguageserver.git + branch = 6.4.2 + status = preview +[submodule "qthttpserver"] + depends = qtbase + recommends = qtwebsockets + path = qthttpserver + url = ../qthttpserver.git + branch = 6.4.2 + status = preview +[submodule "qtquick3dphysics"] + depends = qtbase qtdeclarative qtquick3d qtshadertools + path = qtquick3dphysics + url = ../qtquick3dphysics.git + branch = 6.4.2 + status = preview diff --git a/recipes/qt/config.yml b/recipes/qt/config.yml index caf36e07d009d7..c0a8dca335737b 100644 --- a/recipes/qt/config.yml +++ b/recipes/qt/config.yml @@ -1,10 +1,14 @@ versions: + "6.4.2": + folder: 6.x.x "6.4.1": folder: 6.x.x "6.3.2": folder: 6.x.x "6.2.4": folder: 6.x.x + "5.15.8": + folder: 5.x.x "5.15.7": folder: 5.x.x "5.15.6": diff --git a/recipes/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index 67985d018cfe1f..2eafed83e3a7f6 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.6.0": + url: "https://github.com/odygrd/quill/archive/v2.6.0.tar.gz" + sha256: "d72fd5a01bf8d3e59ed93a789a8f103bc31efe0fb3c09182c74036a2e3a8451b" "2.5.1": url: "https://github.com/odygrd/quill/archive/v2.5.1.tar.gz" sha256: "62227595cc2b4c0c42ed35f17ef5b7487d8231aca9e75234a4c0e346cea19928" @@ -23,15 +26,6 @@ sources: "2.0.2": url: "https://github.com/odygrd/quill/archive/v2.0.2.tar.gz" sha256: "d2dc9004886b787f8357e97d2f2d0c74a460259f7f95d65ab49d060fe34a9b5c" - "2.0.1": - url: "https://github.com/odygrd/quill/archive/v2.0.1.tar.gz" - sha256: "39527aca74edd02d9df0bba62211df9f6d53984d4f6cca470734e19c4d8b69fb" "1.7.3": url: "https://github.com/odygrd/quill/archive/v1.7.3.tar.gz" sha256: "3fff0c5ffb19bbde5429369079741f84a6acce3a781b504cec5e677b05461208" - "1.6.3": - url: "https://github.com/odygrd/quill/archive/v1.6.3.tar.gz" - sha256: "886120b084db952aafe651c64f459e69fec481b4e189c14daa8c4108afebcba3" - "1.5.2": - url: "https://github.com/odygrd/quill/archive/v1.5.2.tar.gz" - sha256: "e409fda0bd949e997f63de4d422a8f17ccc9cb0d58f11403bd309c7a93aa0d6b" diff --git a/recipes/quill/all/test_package/CMakeLists.txt b/recipes/quill/all/test_package/CMakeLists.txt index 417fe001a33124..d53c2b924044a5 100644 --- a/recipes/quill/all/test_package/CMakeLists.txt +++ b/recipes/quill/all/test_package/CMakeLists.txt @@ -4,7 +4,7 @@ project(test_package LANGUAGES CXX) find_package(quill REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} quill::quill) +target_link_libraries(${PROJECT_NAME} PRIVATE quill::quill) if(quill_VERSION VERSION_GREATER_EQUAL "2.0.0") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) else() diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index dfa317084ea31f..2790b70d22e862 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -1,4 +1,6 @@ versions: + "2.6.0": + folder: "all" "2.5.1": folder: "all" "2.4.2": @@ -15,11 +17,5 @@ versions: folder: "all" "2.0.2": folder: "all" - "2.0.1": - folder: "all" "1.7.3": folder: "all" - "1.6.3": - folder: "all" - "1.5.2": - folder: "all" diff --git a/recipes/qxlsx/all/conandata.yml b/recipes/qxlsx/all/conandata.yml index 7e3a5bc31390d5..68d91ea6c08310 100644 --- a/recipes/qxlsx/all/conandata.yml +++ b/recipes/qxlsx/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.5": + url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.5.zip" + sha256: "eadcad2718335673f86fe20fd91e822e6c1e3624483be9d79cf79254e5426067" "1.4.4": url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.4.zip" sha256: "3efbd6f63a1ffd521c535dce7b5a5a7e9ebd23db51e6ae8e3e2eb89796e57675" @@ -7,5 +10,9 @@ sources: sha256: "d2f7c6aff71f2f30ade8d8020682e36a3d63f422a5d2f1c5831b55573241bd4a" patches: "1.4.3": - - patch_file: "patches/0001-allow-shared.patch" - - patch_file: "patches/0002-add-install-target.patch" + - patch_file: "patches/1.4.3/0001-allow-shared.patch" + patch_type: "conan" + patch_source: "https://github.com/QtExcel/QXlsx/pull/197" + - patch_file: "patches/1.4.3/0002-add-install-target.patch" + patch_type: "conan" + patch_source: "https://github.com/QtExcel/QXlsx/pull/197" diff --git a/recipes/qxlsx/all/conanfile.py b/recipes/qxlsx/all/conanfile.py index 2323a1dec48f6c..2db27dce4134a0 100644 --- a/recipes/qxlsx/all/conanfile.py +++ b/recipes/qxlsx/all/conanfile.py @@ -1,10 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class QXlsxConan(ConanFile): @@ -25,9 +26,12 @@ class QXlsxConan(ConanFile): "fPIC": True } + @property + def _qt_version(self): + return Version(self.dependencies["qt"].ref.version).major + 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": @@ -35,13 +39,28 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("qt/5.15.5") + self.requires("qt/5.15.7") def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "1.4.4" and not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.0") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -49,10 +68,12 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["QT_VERSION_MAJOR"] = Version(self.deps_cpp_info["qt"].version).major + tc.variables["QT_VERSION_MAJOR"] = self._qt_version tc.generate() tc = CMakeDeps(self) tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") def build(self): apply_conandata_patches(self) @@ -63,6 +84,7 @@ def build(self): def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) + cmake.configure(build_script_folder="QXlsx") cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -70,7 +92,10 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "QXlsx") self.cpp_info.set_property("cmake_target_name", "QXlsx::Core") # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["qxlsx_core"].libs = ["QXlsx"] + if Version(self.version) <= "1.4.4": + self.cpp_info.components["qxlsx_core"].libs = ["QXlsx"] + else: + self.cpp_info.components["qxlsx_core"].libs = [f"QXlsxQt{self._qt_version}"] self.cpp_info.components["qxlsx_core"].includedirs = [os.path.join("include", "QXlsx")] self.cpp_info.components["qxlsx_core"].requires = ["qt::qtCore", "qt::qtGui"] diff --git a/recipes/qxlsx/all/patches/0001-allow-shared.patch b/recipes/qxlsx/all/patches/1.4.3/0001-allow-shared.patch similarity index 100% rename from recipes/qxlsx/all/patches/0001-allow-shared.patch rename to recipes/qxlsx/all/patches/1.4.3/0001-allow-shared.patch diff --git a/recipes/qxlsx/all/patches/0002-add-install-target.patch b/recipes/qxlsx/all/patches/1.4.3/0002-add-install-target.patch similarity index 100% rename from recipes/qxlsx/all/patches/0002-add-install-target.patch rename to recipes/qxlsx/all/patches/1.4.3/0002-add-install-target.patch diff --git a/recipes/qxlsx/config.yml b/recipes/qxlsx/config.yml index c3a2585d470758..c1105e15407295 100644 --- a/recipes/qxlsx/config.yml +++ b/recipes/qxlsx/config.yml @@ -1,4 +1,6 @@ versions: + "1.4.5": + folder: "all" "1.4.4": folder: "all" "1.4.3": diff --git a/recipes/rapidcsv/all/conandata.yml b/recipes/rapidcsv/all/conandata.yml index 1cab273fd5038d..4a94a5cab704f2 100644 --- a/recipes/rapidcsv/all/conandata.yml +++ b/recipes/rapidcsv/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "8.69": + url: "https://github.com/d99kris/rapidcsv/archive/v8.69.tar.gz" + sha256: "b63e58b1d18277f0331e211bbe6740587069fcd3e5b5a5fb63be7d2f17250d54" "8.64": url: "https://github.com/d99kris/rapidcsv/archive/v8.64.tar.gz" sha256: "e2ab5231b6e65f1e168dc279bbba2e34afd43c7bc6e2522726b107bcc4e8ebac" diff --git a/recipes/rapidcsv/all/conanfile.py b/recipes/rapidcsv/all/conanfile.py index cc5590d7435321..a9d964b6536a38 100644 --- a/recipes/rapidcsv/all/conanfile.py +++ b/recipes/rapidcsv/all/conanfile.py @@ -1,28 +1,47 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class RapidcsvConan(ConanFile): name = "rapidcsv" description = "C++ CSV parser library" - topics = ("csv", "parser") + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/d99kris/rapidcsv" - license = "BSD-3-Clause" + topics = ("csv", "parser", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + 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): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="rapidcsv.h", dst="include", src=os.path.join(self._source_subfolder, "src")) + 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=os.path.join(self.source_folder, "src"), + ) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rapidcsv/all/test_package/CMakeLists.txt b/recipes/rapidcsv/all/test_package/CMakeLists.txt index d9d85dd378817c..30d340fa95be76 100644 --- a/recipes/rapidcsv/all/test_package/CMakeLists.txt +++ b/recipes/rapidcsv/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) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(rapidcsv REQUIRED) +find_package(rapidcsv REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE rapidcsv::rapidcsv) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rapidcsv/all/test_package/conanfile.py b/recipes/rapidcsv/all/test_package/conanfile.py index 49a3a66ea5bad4..e845ae751a3017 100644 --- a/recipes/rapidcsv/all/test_package/conanfile.py +++ b/recipes/rapidcsv/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 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/rapidcsv/all/test_v1_package/CMakeLists.txt b/recipes/rapidcsv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/rapidcsv/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/rapidcsv/all/test_v1_package/conanfile.py b/recipes/rapidcsv/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/rapidcsv/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/rapidcsv/config.yml b/recipes/rapidcsv/config.yml index 4ce50b4cd62f58..fa4a806018292a 100644 --- a/recipes/rapidcsv/config.yml +++ b/recipes/rapidcsv/config.yml @@ -1,4 +1,6 @@ versions: + "8.69": + folder: "all" "8.64": folder: "all" "8.62": diff --git a/recipes/rapidyaml/all/conandata.yml b/recipes/rapidyaml/all/conandata.yml index 28db57dc0078f6..dd5074af2a9b9f 100644 --- a/recipes/rapidyaml/all/conandata.yml +++ b/recipes/rapidyaml/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.0": + url: "https://github.com/biojppm/rapidyaml/releases/download/v0.5.0/rapidyaml-0.5.0-src.tgz" + sha256: "6493557778791a3a2375510ce6c0ecd70163fc8ce4f8ed683acc36e3e55ee881" "0.4.1": url: "https://github.com/biojppm/rapidyaml/releases/download/v0.4.1/rapidyaml-0.4.1-src.tgz" sha256: "3c0a671a7a5aab972f7d259736d14beb9f428c4441f0c220dc0717a4946b495c" @@ -9,6 +12,10 @@ sources: url: "https://github.com/biojppm/rapidyaml/releases/download/v0.3.0/rapidyaml-0.3.0-src.tgz" sha256: "38854b8359eaf42cc27352f4b7321f509f6775445a3e2746cc8cd1e468a52aa9" patches: + "0.5.0": + - patch_file: "patches/0.5.0-001-remove-internal-c4core.patch" + patch_description: "disable using internal c4core" + patch_type: "conan" "0.4.1": - patch_file: "patches/0.4.1-001-remove-internal-c4core.patch" patch_description: "disable using internal c4core" diff --git a/recipes/rapidyaml/all/conanfile.py b/recipes/rapidyaml/all/conanfile.py index fbdfd5da9b5b70..9b33134d2e034e 100644 --- a/recipes/rapidyaml/all/conanfile.py +++ b/recipes/rapidyaml/all/conanfile.py @@ -6,7 +6,7 @@ from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class RapidYAMLConan(ConanFile): name = "rapidyaml" @@ -44,16 +44,13 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("c4core/0.1.10") + self.requires("c4core/0.1.11") def validate(self): if self.info.settings.compiler.cppstd: diff --git a/recipes/rapidyaml/all/patches/0.5.0-001-remove-internal-c4core.patch b/recipes/rapidyaml/all/patches/0.5.0-001-remove-internal-c4core.patch new file mode 100644 index 00000000000000..b9735434a58e10 --- /dev/null +++ b/recipes/rapidyaml/all/patches/0.5.0-001-remove-internal-c4core.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 11c52e0..e79d144 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ project(ryml + LANGUAGES CXX) + include(./compat.cmake) + +-c4_project(VERSION 0.5.0 STANDALONE ++c4_project(VERSION 0.5.0 + AUTHOR "Joao Paulo Magalhaes ") + + +@@ -21,8 +21,7 @@ option(RYML_DBG "Enable (very verbose) ryml debug prints." OFF) + + #------------------------------------------------------- + +-c4_require_subproject(c4core INCORPORATE +- SUBDIRECTORY ${RYML_EXT_DIR}/c4core) ++find_package(c4core REQUIRED CONFIG) + + c4_add_library(ryml + SOURCES +@@ -56,9 +55,8 @@ c4_add_library(ryml + INC_DIRS + $ + $ +- LIBS c4core +- INCORPORATE c4core +- ) ++ LIBS c4core::c4core ++) + + if(RYML_WITH_TAB_TOKENS) + target_compile_definitions(ryml PUBLIC RYML_WITH_TAB_TOKENS) +@@ -76,7 +74,6 @@ endif() + #------------------------------------------------------- + + c4_install_target(ryml) +-c4_install_exports(DEPENDENCIES c4core) + c4_pack_project() + + diff --git a/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt b/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt index 2cbec639fb36cd..bc541ea90b5128 100644 --- a/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt +++ b/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ryml REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ryml::ryml) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -if(ryml_VERSION VERSION_GREATER_EQUAL "0.4.0") - target_compile_definitions(${PROJECT_NAME} PRIVATE RYML_USE_PARSE_IN_ARENA) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/rapidyaml/config.yml b/recipes/rapidyaml/config.yml index 0c5f8691c06f8c..a10a27debb1f08 100644 --- a/recipes/rapidyaml/config.yml +++ b/recipes/rapidyaml/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.0": + folder: all "0.4.1": folder: all "0.4.0": diff --git a/recipes/redis-plus-plus/all/conandata.yml b/recipes/redis-plus-plus/all/conandata.yml index ce8377c9cadd8b..2437f2fe67b154 100644 --- a/recipes/redis-plus-plus/all/conandata.yml +++ b/recipes/redis-plus-plus/all/conandata.yml @@ -1,17 +1,24 @@ sources: + "1.3.7": + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.7.tar.gz" + sha256: "89cb83b0a23ac5825300c301814eab74aa3cdcfcd12e87d443c2692e367768ba" "1.3.3": - sha256: 23689059b7ba50fcd8fa673c5dbb7bdb010b896b14abad5aa80a5ec48eb64f26 - url: https://github.com/sewenew/redis-plus-plus/archive/1.3.3.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.3.tar.gz" + sha256: "23689059b7ba50fcd8fa673c5dbb7bdb010b896b14abad5aa80a5ec48eb64f26" "1.3.2": - sha256: e172cd8dcfeaf649e20a2d24537f8676c7cabed5c24182d73be189e53a013289 - url: https://github.com/sewenew/redis-plus-plus/archive/1.3.2.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.2.tar.gz" + sha256: "e172cd8dcfeaf649e20a2d24537f8676c7cabed5c24182d73be189e53a013289" "1.2.3": - sha256: 1a3336752133019c963e06c28667b96690d6395b804e5e326671777ff88982ea - url: https://github.com/sewenew/redis-plus-plus/archive/1.2.3.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.2.3.tar.gz" + sha256: "1a3336752133019c963e06c28667b96690d6395b804e5e326671777ff88982ea" "1.2.1": - sha256: f09c9fcc362955edb887632cd008102887278c94934d7e8c9d0acb8707671902 - url: https://github.com/sewenew/redis-plus-plus/archive/1.2.1.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.2.1.tar.gz" + sha256: "f09c9fcc362955edb887632cd008102887278c94934d7e8c9d0acb8707671902" patches: + "1.3.7": + - patch_file: "patches/1.3.7-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" "1.3.3": - patch_file: "patches/1.3.3-0001-fix-dependencies-injection.patch" patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" diff --git a/recipes/redis-plus-plus/all/conanfile.py b/recipes/redis-plus-plus/all/conanfile.py index 0fdfa9ba24d649..b10c66e4f7f94c 100644 --- a/recipes/redis-plus-plus/all/conanfile.py +++ b/recipes/redis-plus-plus/all/conanfile.py @@ -67,7 +67,7 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hiredis/1.0.2") + self.requires("hiredis/1.1.0") if self.options.get_safe("build_async"): self.requires("libuv/1.44.2") @@ -142,6 +142,7 @@ def package_info(self): self.cpp_info.components["redis++lib"].requires.append("libuv::libuv") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["redis++lib"].system_libs.append("pthread") + self.cpp_info.components["redis++lib"].system_libs.append("m") # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "redis++" diff --git a/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch b/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch new file mode 100644 index 00000000000000..19ec65facf381f --- /dev/null +++ b/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch @@ -0,0 +1,33 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 69794d9..fbb75b7 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -34,8 +34,7 @@ if(REDIS_PLUS_PLUS_BUILD_ASYNC) + message(STATUS "redis-plus-plus build async interface with libuv") + + # libuv dependency +- find_path(REDIS_PLUS_PLUS_ASYNC_LIB_HEADER NAMES uv.h) +- find_library(REDIS_PLUS_PLUS_ASYNC_LIB uv) ++ find_package(libuv REQUIRED CONFIG) + else() + message(FATAL_ERROR "invalid REDIS_PLUS_PLUS_BUILD_ASYNC") + endif() +@@ -191,7 +190,7 @@ if(REDIS_PLUS_PLUS_BUILD_STATIC) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${STATIC_LIB} PUBLIC $) +- target_include_directories(${STATIC_LIB} PUBLIC $) ++ target_link_libraries(${STATIC_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${STATIC_LIB} SYSTEM PUBLIC $) + endif() +@@ -245,8 +244,7 @@ if(REDIS_PLUS_PLUS_BUILD_SHARED) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${SHARED_LIB} PUBLIC $) +- target_include_directories(${SHARED_LIB} PUBLIC $) +- target_link_libraries(${SHARED_LIB} PUBLIC ${REDIS_PLUS_PLUS_ASYNC_LIB}) ++ target_link_libraries(${SHARED_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${SHARED_LIB} SYSTEM PUBLIC $) + endif() diff --git a/recipes/redis-plus-plus/config.yml b/recipes/redis-plus-plus/config.yml index c4181ae02bba7d..923fc0f3c1acbd 100644 --- a/recipes/redis-plus-plus/config.yml +++ b/recipes/redis-plus-plus/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.7": + folder: all "1.3.3": folder: all "1.3.2": diff --git a/recipes/roaring/all/conandata.yml b/recipes/roaring/all/conandata.yml index 62857710d6c8c3..8f0024fd425aab 100644 --- a/recipes/roaring/all/conandata.yml +++ b/recipes/roaring/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.8.1": + url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.8.1.tar.gz" + sha256: "5359f2a051f10e42cea5edc3cb3650fd272e9125e6a0538901cf30619939d4f8" "0.8.0": url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.8.0.tar.gz" sha256: "cd6c4770baccfea385c0c6891a8a80133ba26093209740ca0a3eea348aff1a20" diff --git a/recipes/roaring/config.yml b/recipes/roaring/config.yml index 1dc23bfdde0f2e..e7836bd317d3c4 100644 --- a/recipes/roaring/config.yml +++ b/recipes/roaring/config.yml @@ -1,4 +1,6 @@ versions: + "0.8.1": + folder: all "0.8.0": folder: all "0.7.3": diff --git a/recipes/sdl/all/CMakeLists.txt b/recipes/sdl/all/CMakeLists.txt deleted file mode 100644 index 94daaf65016d8d..00000000000000 --- a/recipes/sdl/all/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(${CONAN_INSTALL_FOLDER}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(UNIX AND NOT APPLE) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) - add_definitions("-DGBM_BO_USE_CURSOR=2") - endif() - endif() -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/sdl/all/conandata.yml b/recipes/sdl/all/conandata.yml index e96121e1d94356..24d42d4c8fad29 100644 --- a/recipes/sdl/all/conandata.yml +++ b/recipes/sdl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.26.1": + url: "https://www.libsdl.org/release/SDL2-2.26.1.tar.gz" + sha256: "02537cc7ebd74071631038b237ec4bfbb3f4830ba019e569434da33f42373e04" "2.26.0": url: "https://www.libsdl.org/release/SDL2-2.26.0.tar.gz" sha256: "8000d7169febce93c84b6bdf376631f8179132fd69f7015d4dadb8b9c2bdb295" @@ -23,14 +26,19 @@ sources: patches: "2.0.20": - patch_file: "patches/0004-2.0.20-ndk.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "ndk patch" "2.0.16": - patch_file: "patches/0003-2.0.16-wayland-scanner-buildrequires.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "wayland scanner buildrequires" "2.0.14": - patch_file: "patches/0001-fix-cmake-ios-tvos.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "fix cmake ios tvos" - patch_file: "patches/0002-mingw-improvements.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw improvements" - patch_file: "patches/0003-2.0.14-wayland-scanner-buildrequires.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "wayland scanner buildrequires" diff --git a/recipes/sdl/all/conanfile.py b/recipes/sdl/all/conanfile.py index 698a088fe228a5..045807a9023bd8 100644 --- a/recipes/sdl/all/conanfile.py +++ b/recipes/sdl/all/conanfile.py @@ -1,15 +1,16 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os -from conan.tools.files import apply_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, replace_in_file, rm, rmdir, copy from conan.tools.microsoft import is_msvc from conan.tools.build import cross_building from conan.tools.scm import Version -from conans import CMake, tools -import functools +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import Environment + import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class SDLConan(ConanFile): @@ -21,6 +22,9 @@ class SDLConan(ConanFile): license = "Zlib" settings = "os", "arch", "compiler", "build_type" + + generators = "CMakeDeps", "PkgConfigDeps", "VirtualBuildEnv" + options = { "shared": [True, False], "fPIC": [True, False], @@ -80,20 +84,24 @@ class SDLConan(ConanFile): "libunwind": True, } - generators = ["cmake", "pkg_config"] + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _source_subfolder(self): - return "source_subfolder" + def generate(self): + self.define_toolchain() + lib_paths = [lib for _, dep in self.dependencies.items() for lib in dep.cpp_info.libdirs] + env = Environment() + env.define_path("LIBRARY_PATH", os.pathsep.join(lib_paths)) + + # FIXME: remove and raise required_conan_version to 1.55 once it's on c3i + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + + env = env.vars(self, scope="build") + env.save_script("sdl_env") - @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": @@ -125,9 +133,9 @@ 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def requirements(self): if self.options.get_safe("iconv", False): @@ -185,12 +193,12 @@ def build_requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + destination=self.source_folder) def _patch_sources(self): apply_conandata_patches(self) - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), 'check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)', '# check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)') @@ -198,184 +206,193 @@ def _patch_sources(self): if self.options.get_safe("wayland") and Version(self.version) >= "2.0.18": wayland_bin_path = " ".join("\"{}\"".format(path) for path in self.deps_env_info["wayland"].PATH) replace_in_file(self, - os.path.join(self._source_subfolder, "cmake", "sdlchecks.cmake"), + os.path.join(self.source_folder, "cmake", "sdlchecks.cmake"), "find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED)", "find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED PATHS {} NO_DEFAULT_PATH)".format(wayland_bin_path), ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SDL2_DISABLE_INSTALL"] = False # SDL2_* options will get renamed to SDL_ options in the next SDL release + def define_toolchain(self): + tc = CMakeToolchain(self) + if self.settings.os == "Linux" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < 5.0: + tc.preprocessor_definitions["GBM_BO_USE_CURSOR"] = 2 + + tc.variables["SDL2_DISABLE_INSTALL"] = False # SDL2_* options will get renamed to SDL_ options in the next SDL release if is_apple_os(self): - cmake.definitions["CMAKE_OSX_ARCHITECTURES"] = { + tc.variables["CMAKE_OSX_ARCHITECTURES"] = { "armv8": "arm64", }.get(str(self.settings.arch), str(self.settings.arch)) cmake_required_includes = [] # List of directories used by CheckIncludeFile (https://cmake.org/cmake/help/latest/module/CheckIncludeFile.html) cmake_extra_ldflags = [] - # FIXME: self.install_folder not defined? Neccessary? - cmake.definitions["CONAN_INSTALL_FOLDER"] = self.install_folder + cmake_extra_libs = [] + if self.settings.os != "Windows" and not self.options.shared: - cmake.definitions["SDL_STATIC_PIC"] = self.options.fPIC + tc.variables["SDL_STATIC_PIC"] = self.options.fPIC if is_msvc(self) and not self.options.shared: - cmake.definitions["HAVE_LIBC"] = True - cmake.definitions["SDL_SHARED"] = self.options.shared - cmake.definitions["SDL_STATIC"] = not self.options.shared + tc.variables["HAVE_LIBC"] = True + tc.variables["SDL_SHARED"] = self.options.shared + tc.variables["SDL_STATIC"] = not self.options.shared if Version(self.version) < "2.0.18": - cmake.definitions["VIDEO_OPENGL"] = self.options.opengl - cmake.definitions["VIDEO_OPENGLES"] = self.options.opengles - cmake.definitions["VIDEO_VULKAN"] = self.options.vulkan + tc.variables["VIDEO_OPENGL"] = self.options.opengl + tc.variables["VIDEO_OPENGLES"] = self.options.opengles + tc.variables["VIDEO_VULKAN"] = self.options.vulkan if self.settings.os == "Linux": # See https://github.com/bincrafters/community/issues/696 - cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 + tc.variables["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 - cmake.definitions["ALSA"] = self.options.alsa + tc.variables["ALSA"] = self.options.alsa if self.options.alsa: - cmake.definitions["ALSA_SHARED"] = self.deps_cpp_info["libalsa"].shared - cmake.definitions["HAVE_ASOUNDLIB_H"] = True - cmake.definitions["HAVE_LIBASOUND"] = True - cmake.definitions["JACK"] = self.options.jack + tc.variables["ALSA_SHARED"] = self.options["libalsa"].shared + tc.variables["HAVE_ASOUNDLIB_H"] = True + tc.variables["HAVE_LIBASOUND"] = True + tc.variables["JACK"] = self.options.jack if self.options.jack: - cmake.definitions["JACK_SHARED"] = self.deps_cpp_info["jack"].shared - cmake.definitions["ESD"] = self.options.esd + tc.variables["JACK_SHARED"] = self.options["jack"].shared + tc.variables["ESD"] = self.options.esd if self.options.esd: - cmake.definitions["ESD_SHARED"] = self.deps_cpp_info["esd"].shared - cmake.definitions["PULSEAUDIO"] = self.options.pulse + tc.variables["ESD_SHARED"] = self.options["esd"].shared + tc.variables["PULSEAUDIO"] = self.options.pulse if self.options.pulse: - cmake.definitions["PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared - cmake.definitions["SNDIO"] = self.options.sndio + tc.variables["PULSEAUDIO_SHARED"] = self.options["pulseaudio"].shared + tc.variables["SNDIO"] = self.options.sndio if self.options.sndio: - cmake.definitions["SNDIO_SHARED"] = self.deps_cpp_info["sndio"].shared - cmake.definitions["NAS"] = self.options.nas + tc.variables["SNDIO_SHARED"] = self.options["sndio"].shared + tc.variables["NAS"] = self.options.nas if self.options.nas: cmake_extra_ldflags += ["-lXau"] # FIXME: SDL sources doesn't take into account transitive dependencies - cmake_required_includes += [os.path.join(self.deps_cpp_info["nas"].rootpath, str(it)) for it in self.deps_cpp_info["nas"].includedirs] - cmake.definitions["NAS_SHARED"] = self.options["nas"].shared - cmake.definitions["VIDEO_X11"] = self.options.x11 + cmake_required_includes += self.dependencies["nas"].cpp_info.includedirs + tc.variables["NAS_SHARED"] = self.options["nas"].shared + tc.variables["VIDEO_X11"] = self.options.x11 if self.options.x11: - cmake.definitions["HAVE_XEXT_H"] = True - cmake.definitions["VIDEO_X11_XCURSOR"] = self.options.xcursor + tc.variables["HAVE_XEXT_H"] = True + tc.variables["VIDEO_X11_XCURSOR"] = self.options.xcursor if self.options.xcursor: - cmake.definitions["HAVE_XCURSOR_H"] = True - cmake.definitions["VIDEO_X11_XINERAMA"] = self.options.xinerama + tc.variables["HAVE_XCURSOR_H"] = True + tc.variables["VIDEO_X11_XINERAMA"] = self.options.xinerama if self.options.xinerama: - cmake.definitions["HAVE_XINERAMA_H"] = True - cmake.definitions["VIDEO_X11_XINPUT"] = self.options.xinput + tc.variables["HAVE_XINERAMA_H"] = True + tc.variables["VIDEO_X11_XINPUT"] = self.options.xinput if self.options.xinput: - cmake.definitions["HAVE_XINPUT_H"] = True - cmake.definitions["VIDEO_X11_XRANDR"] = self.options.xrandr + tc.variables["HAVE_XINPUT_H"] = True + tc.variables["VIDEO_X11_XRANDR"] = self.options.xrandr if self.options.xrandr: - cmake.definitions["HAVE_XRANDR_H"] = True - cmake.definitions["VIDEO_X11_XSCRNSAVER"] = self.options.xscrnsaver + tc.variables["HAVE_XRANDR_H"] = True + tc.variables["VIDEO_X11_XSCRNSAVER"] = self.options.xscrnsaver if self.options.xscrnsaver: - cmake.definitions["HAVE_XSS_H"] = True - cmake.definitions["VIDEO_X11_XSHAPE"] = self.options.xshape + tc.variables["HAVE_XSS_H"] = True + tc.variables["VIDEO_X11_XSHAPE"] = self.options.xshape if self.options.xshape: - cmake.definitions["HAVE_XSHAPE_H"] = True - cmake.definitions["VIDEO_X11_XVM"] = self.options.xvm + tc.variables["HAVE_XSHAPE_H"] = True + tc.variables["VIDEO_X11_XVM"] = self.options.xvm if self.options.xvm: - cmake.definitions["HAVE_XF86VM_H"] = True - cmake.definitions["VIDEO_WAYLAND"] = self.options.wayland + tc.variables["HAVE_XF86VM_H"] = True + tc.variables["VIDEO_WAYLAND"] = self.options.wayland if self.options.wayland: # FIXME: Otherwise 2.0.16 links with system wayland (from egl/system requirement) - cmake_extra_ldflags += ["-L{}".format(os.path.join(self.deps_cpp_info["wayland"].rootpath, it)) for it in self.deps_cpp_info["wayland"].libdirs] - cmake.definitions["WAYLAND_SHARED"] = self.options["wayland"].shared - cmake.definitions["WAYLAND_SCANNER_1_15_FOUND"] = 1 # FIXME: Check actual build-requires version + cmake_extra_ldflags += ["-L{}".format(it) for it in self.dependencies["wayland"].cpp_info.libdirs] + tc.variables["WAYLAND_SHARED"] = self.options["wayland"].shared + tc.variables["WAYLAND_SCANNER_1_15_FOUND"] = 1 # FIXME: Check actual build-requires version - cmake.definitions["VIDEO_DIRECTFB"] = self.options.directfb - cmake.definitions["VIDEO_RPI"] = self.options.video_rpi - cmake.definitions["HAVE_LIBUNWIND_H"] = self.options.libunwind + tc.variables["VIDEO_DIRECTFB"] = self.options.directfb + tc.variables["VIDEO_RPI"] = self.options.video_rpi + tc.variables["HAVE_LIBUNWIND_H"] = self.options.libunwind elif self.settings.os == "Windows": - cmake.definitions["DIRECTX"] = self.options.directx + tc.variables["DIRECTX"] = self.options.directx else: - cmake.definitions["SDL_OPENGL"] = self.options.opengl - cmake.definitions["SDL_OPENGLES"] = self.options.opengles - cmake.definitions["SDL_VULKAN"] = self.options.vulkan + tc.variables["SDL_OPENGL"] = self.options.opengl + tc.variables["SDL_OPENGLES"] = self.options.opengles + tc.variables["SDL_VULKAN"] = self.options.vulkan if self.settings.os == "Linux": # See https://github.com/bincrafters/community/issues/696 - cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 + tc.variables["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 - cmake.definitions["SDL_ALSA"] = self.options.alsa + tc.variables["SDL_ALSA"] = self.options.alsa if self.options.alsa: - cmake.definitions["SDL_ALSA_SHARED"] = self.deps_cpp_info["libalsa"].shared - cmake.definitions["HAVE_ASOUNDLIB_H"] = True - cmake.definitions["HAVE_LIBASOUND"] = True - cmake.definitions["SDL_JACK"] = self.options.jack + tc.variables["SDL_ALSA_SHARED"] = self.options["libalsa"].shared + tc.variables["HAVE_ASOUNDLIB_H"] = True + tc.variables["HAVE_LIBASOUND"] = True + tc.variables["SDL_JACK"] = self.options.jack if self.options.jack: - cmake.definitions["SDL_JACK_SHARED"] = self.deps_cpp_info["jack"].shared - cmake.definitions["SDL_ESD"] = self.options.esd + tc.variables["SDL_JACK_SHARED"] = self.options["jack"].shared + tc.variables["SDL_ESD"] = self.options.esd if self.options.esd: - cmake.definitions["SDL_ESD_SHARED"] = self.deps_cpp_info["esd"].shared - cmake.definitions["SDL_PULSEAUDIO"] = self.options.pulse + tc.variables["SDL_ESD_SHARED"] = self.options["esd"].shared + tc.variables["SDL_PULSEAUDIO"] = self.options.pulse if self.options.pulse: - cmake.definitions["SDL_PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared - cmake.definitions["SDL_SNDIO"] = self.options.sndio + tc.variables["SDL_PULSEAUDIO_SHARED"] = self.options["pulseaudio"].shared + for component in self.dependencies["pulseaudio"].cpp_info.components: + if self.dependencies["pulseaudio"].cpp_info.components[component].libs: + cmake_extra_libs += self.dependencies["pulseaudio"].cpp_info.components[component].libs + cmake_extra_ldflags += ["-L{}".format(it) for it in self.dependencies["pulseaudio"].cpp_info.components[component].libdirs] + cmake_extra_ldflags += ["-lxcb", "-lrt"] # FIXME: SDL sources doesn't take into account transitive dependencies + tc.variables["SDL_SNDIO"] = self.options.sndio if self.options.sndio: - cmake.definitions["SDL_SNDIO_SHARED"] = self.deps_cpp_info["sndio"].shared - cmake.definitions["SDL_NAS"] = self.options.nas + tc.variables["SDL_SNDIO_SHARED"] = self.options["sndio"].shared + tc.variables["SDL_NAS"] = self.options.nas if self.options.nas: cmake_extra_ldflags += ["-lXau"] # FIXME: SDL sources doesn't take into account transitive dependencies - cmake_required_includes += [os.path.join(self.deps_cpp_info["nas"].rootpath, str(it)) for it in self.deps_cpp_info["nas"].includedirs] - cmake.definitions["SDL_NAS_SHARED"] = self.options["nas"].shared - cmake.definitions["SDL_X11"] = self.options.x11 + cmake_required_includes += self.dependencies["nas"].cpp_info.includedirs + tc.variables["SDL_NAS_SHARED"] = self.options["nas"].shared + tc.variables["SDL_X11"] = self.options.x11 if self.options.x11: - cmake.definitions["HAVE_XEXT_H"] = True - cmake.definitions["SDL_X11_XCURSOR"] = self.options.xcursor + tc.variables["HAVE_XEXT_H"] = True + tc.variables["SDL_X11_XCURSOR"] = self.options.xcursor if self.options.xcursor: - cmake.definitions["HAVE_XCURSOR_H"] = True - cmake.definitions["SDL_X11_XINERAMA"] = self.options.xinerama + tc.variables["HAVE_XCURSOR_H"] = True + tc.variables["SDL_X11_XINERAMA"] = self.options.xinerama if self.options.xinerama: - cmake.definitions["HAVE_XINERAMA_H"] = True - cmake.definitions["SDL_X11_XINPUT"] = self.options.xinput + tc.variables["HAVE_XINERAMA_H"] = True + tc.variables["SDL_X11_XINPUT"] = self.options.xinput if self.options.xinput: - cmake.definitions["HAVE_XINPUT_H"] = True - cmake.definitions["SDL_X11_XRANDR"] = self.options.xrandr + tc.variables["HAVE_XINPUT_H"] = True + tc.variables["SDL_X11_XRANDR"] = self.options.xrandr if self.options.xrandr: - cmake.definitions["HAVE_XRANDR_H"] = True - cmake.definitions["SDL_X11_XSCRNSAVER"] = self.options.xscrnsaver + tc.variables["HAVE_XRANDR_H"] = True + tc.variables["SDL_X11_XSCRNSAVER"] = self.options.xscrnsaver if self.options.xscrnsaver: - cmake.definitions["HAVE_XSS_H"] = True - cmake.definitions["SDL_X11_XSHAPE"] = self.options.xshape + tc.variables["HAVE_XSS_H"] = True + tc.variables["SDL_X11_XSHAPE"] = self.options.xshape if self.options.xshape: - cmake.definitions["HAVE_XSHAPE_H"] = True - cmake.definitions["SDL_X11_XVM"] = self.options.xvm + tc.variables["HAVE_XSHAPE_H"] = True + tc.variables["SDL_X11_XVM"] = self.options.xvm if self.options.xvm: - cmake.definitions["HAVE_XF86VM_H"] = True - cmake.definitions["SDL_WAYLAND"] = self.options.wayland + tc.variables["HAVE_XF86VM_H"] = True + tc.variables["SDL_WAYLAND"] = self.options.wayland if self.options.wayland: # FIXME: Otherwise 2.0.16 links with system wayland (from egl/system requirement) - cmake_extra_ldflags += ["-L{}".format(os.path.join(self.deps_cpp_info["wayland"].rootpath, it)) for it in self.deps_cpp_info["wayland"].libdirs] - cmake.definitions["SDL_WAYLAND_SHARED"] = self.options["wayland"].shared + cmake_extra_ldflags += ["-L{}".format(it) for it in self.dependencies["wayland"].cpp_info.libdirs] + tc.variables["SDL_WAYLAND_SHARED"] = self.options["wayland"].shared - cmake.definitions["SDL_DIRECTFB"] = self.options.directfb - cmake.definitions["SDL_RPI"] = self.options.video_rpi - cmake.definitions["HAVE_LIBUNWIND_H"] = self.options.libunwind + tc.variables["SDL_DIRECTFB"] = self.options.directfb + tc.variables["SDL_RPI"] = self.options.video_rpi + tc.variables["HAVE_LIBUNWIND_H"] = self.options.libunwind elif self.settings.os == "Windows": - cmake.definitions["SDL_DIRECTX"] = self.options.directx + tc.variables["SDL_DIRECTX"] = self.options.directx if Version(self.version) >= "2.0.22": - cmake.definitions["SDL2_DISABLE_SDL2MAIN"] = not self.options.sdl2main + tc.variables["SDL2_DISABLE_SDL2MAIN"] = not self.options.sdl2main # Add extra information collected from the deps - cmake.definitions["EXTRA_LDFLAGS"] = " ".join(cmake_extra_ldflags) - cmake.definitions["CMAKE_REQUIRED_INCLUDES"] = ";".join(cmake_required_includes) - cmake.configure(build_dir=self._build_subfolder) - return cmake + tc.variables["EXTRA_LDFLAGS"] = ";".join(cmake_extra_ldflags) + tc.variables["CMAKE_REQUIRED_INCLUDES"] = ";".join(cmake_required_includes) + cmake_extra_cflags = ["-I{}".format(path) for _, dep in self.dependencies.items() for path in dep.cpp_info.includedirs] + tc.variables["EXTRA_CFLAGS"] = ";".join(cmake_extra_cflags) + tc.variables["EXTRA_LIBS"] = ";".join(cmake_extra_libs) + tc.generate() def build(self): self._patch_sources() - lib_paths = [lib for dep in self.deps_cpp_info.deps for lib in self.deps_cpp_info[dep].lib_paths] - with tools.environment_append({"LIBRARY_PATH": os.pathsep.join(lib_paths)}): - cmake = self._configure_cmake() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() + def package(self): + cmake = CMake(self) if self.version >= "2.0.16": - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE.txt", src=os.path.join(self.source_folder), dst=os.path.join(self.package_folder, "licenses")) else: - self.copy(pattern="COPYING.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="COPYING.txt", src=os.path.join(self.source_folder), dst=os.path.join(self.package_folder, "licenses")) cmake.install() rm(self, "sdl2-config", os.path.join(self.package_folder, "bin")) rmdir(self, os.path.join(self.package_folder, "cmake")) diff --git a/recipes/sdl/all/test_package/CMakeLists.txt b/recipes/sdl/all/test_package/CMakeLists.txt index 429003c689829e..4195ae0c9ad328 100644 --- a/recipes/sdl/all/test_package/CMakeLists.txt +++ b/recipes/sdl/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(SDL2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) @@ -14,16 +11,3 @@ else() target_link_libraries(${PROJECT_NAME} SDL2::SDL2) endif() -function(add_option option) - if(${option}) - target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "${option}") - endif() -endfunction() - -add_option(WITH_X11) -add_option(WITH_ALSA) -add_option(WITH_PULSE) -add_option(WITH_ESD) -add_option(WITH_ARTS) -add_option(WITH_DIRECTFB) -add_option(WITH_DIRECTX) diff --git a/recipes/sdl/all/test_package/conanfile.py b/recipes/sdl/all/test_package/conanfile.py index 0de69e86ca9dfd..956346bb808549 100644 --- a/recipes/sdl/all/test_package/conanfile.py +++ b/recipes/sdl/all/test_package/conanfile.py @@ -1,27 +1,32 @@ -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, CMakeToolchain import os +# It will become the standard on Conan 2.x 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 requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + def build(self): cmake = CMake(self) - if self.settings.os == "Linux": - cmake.definitions["WITH_X11"] = self.options["sdl"].x11 - cmake.definitions["WITH_ALSA"] = self.options["sdl"].alsa - cmake.definitions["WITH_PULSE"] = self.options["sdl"].pulse - cmake.definitions["WITH_ESD"] = self.options["sdl"].esd - cmake.definitions["WITH_ARTS"] = self.options["sdl"].arts - cmake.definitions["WITH_DIRECTFB"] = self.options["sdl"].directfb - if self.settings.os == "Windows": - cmake.definitions["WITH_DIRECTX"] = self.options["sdl"].directx 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) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sdl/all/test_package/test_package.cpp b/recipes/sdl/all/test_package/test_package.cpp index 62a211f91d3037..69868e55398deb 100644 --- a/recipes/sdl/all/test_package/test_package.cpp +++ b/recipes/sdl/all/test_package/test_package.cpp @@ -1,81 +1,9 @@ #include -#include -#include -#include #include -#include -static void throw_exception(const char * message, const char * name) -{ - std::stringstream s; - s << message << " - " << name; - throw std::runtime_error(s.str().c_str()); -} - -static void check_audio_driver(const char * name) -{ - std::cout << "checking for audio driver " << name << " ... "; - bool found = false; - int count = SDL_GetNumAudioDrivers(); - for (int i = 0; i < count; ++i) { - if (0 == strcmp(name, SDL_GetAudioDriver(i))) { - found = true; - break; - } - } - if (!found) - throw_exception("audio driver wasn't found", name); - std::cout << "OK!" << std::endl; -} - -static void check_video_driver(const char * name) -{ - std::cout << "checking for video driver " << name << " ... "; - bool found = false; - int count = SDL_GetNumVideoDrivers(); - for (int i = 0; i < count; ++i) { - if (0 == strcmp(name, SDL_GetVideoDriver(i))) { - found = true; - break; - } - } - if (!found) - throw_exception("video driver wasn't found", name); - std::cout << "OK!" << std::endl; -} - - -int main(int argc, char *argv[]) try -{ +int main(int argc, char* args[]) { SDL_version v; SDL_GetVersion(&v); std::cout << "SDL version " << int(v.major) << "." << int(v.minor) << "." << int(v.patch) << std::endl; -#ifdef WITH_X11 - check_video_driver("x11"); -#endif -#ifdef WITH_ALSA - check_audio_driver("alsa"); -#endif -#ifdef WITH_PULSE - check_audio_driver("pulseaudio"); -#endif -#ifdef WITH_ESD - check_audio_driver("esd"); -#endif -#ifdef WITH_ARTS - check_audio_driver("arts"); -#endif -#ifdef WITH_DIRECTFB - check_video_driver("directfb"); -#endif -#ifdef WITH_DIRECTX - check_audio_driver("directsound"); -#endif - return EXIT_SUCCESS; -} -catch (std::runtime_error & e) -{ - std::cout << "FAIL!" << std::endl; - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; + return 0; } diff --git a/recipes/sdl/all/test_v1_package/CMakeLists.txt b/recipes/sdl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..b272a5b7393038 --- /dev/null +++ b/recipes/sdl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(SDL2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} SDL2::SDL2main) +if(TARGET SDL2::SDL2-static) + target_link_libraries(${PROJECT_NAME} SDL2::SDL2-static) +else() + target_link_libraries(${PROJECT_NAME} SDL2::SDL2) +endif() diff --git a/recipes/sdl/all/test_v1_package/conanfile.py b/recipes/sdl/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..8037a9296cc42b --- /dev/null +++ b/recipes/sdl/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) diff --git a/recipes/sdl/all/test_v1_package/test_package.cpp b/recipes/sdl/all/test_v1_package/test_package.cpp new file mode 100644 index 00000000000000..69868e55398deb --- /dev/null +++ b/recipes/sdl/all/test_v1_package/test_package.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main(int argc, char* args[]) { + SDL_version v; + SDL_GetVersion(&v); + std::cout << "SDL version " << int(v.major) << "." << int(v.minor) << "." << int(v.patch) << std::endl; + return 0; +} diff --git a/recipes/sdl/config.yml b/recipes/sdl/config.yml index 54cef5c632d3af..130fce619991af 100644 --- a/recipes/sdl/config.yml +++ b/recipes/sdl/config.yml @@ -1,4 +1,6 @@ versions: + "2.26.1": + folder: all "2.26.0": folder: all "2.24.1": diff --git a/recipes/seasocks/all/conandata.yml b/recipes/seasocks/all/conandata.yml index 1cc1c6a9f403a6..8ea105850a8bab 100644 --- a/recipes/seasocks/all/conandata.yml +++ b/recipes/seasocks/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.5": + url: "https://github.com/mattgodbolt/seasocks/archive/v1.4.5.tar.gz" + sha256: "82211959cf8aabc85b300358c5f68cf9c56dfdf4eaa09e548580fce908acfc1b" "1.4.4": url: "https://github.com/mattgodbolt/seasocks/archive/v1.4.4.tar.gz" sha256: "5ec016ee87d4985a031212fa23a00de3de5f0fa1ceb82d7b9a3d1c189356bf8d" diff --git a/recipes/seasocks/all/conanfile.py b/recipes/seasocks/all/conanfile.py index 5ae4859a7dc8d6..5a35a2a904c834 100644 --- a/recipes/seasocks/all/conanfile.py +++ b/recipes/seasocks/all/conanfile.py @@ -1,19 +1,20 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, replace_in_file +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.53.0" class SeasocksConan(ConanFile): name = "seasocks" description = "A tiny embeddable C++ HTTP and WebSocket server for Linux" - topics = ("seasocks", "embeddable", "webserver", "websockets") - homepage = "https://github.com/mattgodbolt/seasocks" - url = "https://github.com/conan-io/conan-center-index" license = "BSD-2-Clause" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mattgodbolt/seasocks" + topics = ("embeddable", "webserver", "websockets") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,12 +27,22 @@ class SeasocksConan(ConanFile): "with_zlib": True, } - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" + @property + def _min_cppstd(self): + return 11 if Version(self.version) < "1.4.5" else 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + if Version(self.version) < "1.4.5": + return {} + else: + return { + "Visual Studio": "16", + "msvc": "191", + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } def config_options(self): if self.settings.os == "Windows": @@ -39,47 +50,60 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.settings.os not in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration(f"Seasocks {self.version} doesn't support this os") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support this os") + + if self.settings.compiler.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.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], strip_root=True) def _patch_sources(self): # No warnings as errors - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, "-Werror", "") - tools.replace_in_file(cmakelists, "-pedantic-errors", "") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "-Werror", "") + replace_in_file(self, cmakelists, "-pedantic-errors", "") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["DEFLATE_SUPPORT"] = self.options.with_zlib - cmake.definitions["SEASOCKS_SHARED"] = self.options.shared - cmake.definitions["SEASOCKS_EXAMPLE_APP"] = False - cmake.definitions["UNITTESTS"] = False - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DEFLATE_SUPPORT"] = self.options.with_zlib + tc.variables["SEASOCKS_SHARED"] = self.options.shared + tc.variables["SEASOCKS_EXAMPLE_APP"] = False + tc.variables["UNITTESTS"] = False + 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("LICENSE", src=self._source_subfolder, dst="licenses") - 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")) - tools.rmdir(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, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Seasocks") @@ -88,7 +112,7 @@ def package_info(self): # TODO: back to global scope in conan v2 once cmake_find_package* generators removed self.cpp_info.components["libseasocks"].libs = ["seasocks"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["libseasocks"].system_libs.append("pthread") + self.cpp_info.components["libseasocks"].system_libs.extend(["pthread", "m"]) # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Seasocks" diff --git a/recipes/seasocks/all/test_package/CMakeLists.txt b/recipes/seasocks/all/test_package/CMakeLists.txt index 0010361a5592eb..f005fadc417169 100644 --- a/recipes/seasocks/all/test_package/CMakeLists.txt +++ b/recipes/seasocks/all/test_package/CMakeLists.txt @@ -1,12 +1,13 @@ -cmake_minimum_required(VERSION 3.3) -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(Seasocks REQUIRED CONFIG) find_package(Threads REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE Seasocks::seasocks Threads::Threads) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +if(Seasocks_VERSION VERSION_LESS "1.4.5") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/seasocks/all/test_package/conanfile.py b/recipes/seasocks/all/test_package/conanfile.py index 38f4483872d47f..a9fb96656f2039 100644 --- a/recipes/seasocks/all/test_package/conanfile.py +++ b/recipes/seasocks/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/seasocks/all/test_v1_package/CMakeLists.txt b/recipes/seasocks/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/seasocks/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/seasocks/all/test_v1_package/conanfile.py b/recipes/seasocks/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/seasocks/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/seasocks/config.yml b/recipes/seasocks/config.yml index c381a7e1424013..bcda68af0d12d3 100644 --- a/recipes/seasocks/config.yml +++ b/recipes/seasocks/config.yml @@ -1,3 +1,5 @@ versions: + "1.4.5": + folder: "all" "1.4.4": folder: "all" diff --git a/recipes/sentry-breakpad/all/conandata.yml b/recipes/sentry-breakpad/all/conandata.yml index 3c7fe86d983af4..ebc2e5e3d2cd54 100644 --- a/recipes/sentry-breakpad/all/conandata.yml +++ b/recipes/sentry-breakpad/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.3": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.3/sentry-native.zip" + sha256: "d9a2434783e558bc9e074518ce155bda129bfa12d376dde939e6a732c92f9757" "0.5.0": url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" @@ -17,4 +20,3 @@ sources: "0.2.6": url: "https://github.com/getsentry/sentry-native/releases/download/0.2.6/sentry-native-0.2.6.zip" sha256: "0d93bd77f70a64f3681d4928dfca6b327374218a84d33ee31489114d8e4716c0" -#patches: diff --git a/recipes/sentry-breakpad/config.yml b/recipes/sentry-breakpad/config.yml index 69f2362e8a2a3a..8b62ee8e2e1d6f 100644 --- a/recipes/sentry-breakpad/config.yml +++ b/recipes/sentry-breakpad/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.3": + folder: all "0.5.0": folder: all "0.4.18": diff --git a/recipes/sentry-crashpad/all/CMakeLists.txt b/recipes/sentry-crashpad/all/CMakeLists.txt deleted file mode 100644 index 0d619e82907892..00000000000000 --- a/recipes/sentry-crashpad/all/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(MINGW) - find_program(JWASM_FOUND jwasm) - if (JWASM_FOUND) - set(CMAKE_ASM_MASM_COMPILER ${JWASM_FOUND}) - execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VERSION_OUTPUT) - if (COMPILER_VERSION_OUTPUT) - if (COMPILER_VERSION_OUTPUT MATCHES "x86_64") - set(JWASM_FLAGS -win64) - else() - set(JWASM_FLAGS -coff) - endif() - endif() - endif() -endif() - -add_subdirectory(source_subfolder/external/crashpad) diff --git a/recipes/sentry-crashpad/all/conandata.yml b/recipes/sentry-crashpad/all/conandata.yml index f38fb6b1f43168..1eda14320322d2 100644 --- a/recipes/sentry-crashpad/all/conandata.yml +++ b/recipes/sentry-crashpad/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.3": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.3/sentry-native.zip" + sha256: "d9a2434783e558bc9e074518ce155bda129bfa12d376dde939e6a732c92f9757" "0.5.0": url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" @@ -20,4 +23,5 @@ sources: patches: "0.2.6": - patch_file: "patches/0.2.6-0001-missing-installed-headers.patch" - base_path: "source_subfolder" + patch_description: "Missing installed headers" + patch_type: "portability" diff --git a/recipes/sentry-crashpad/all/conanfile.py b/recipes/sentry-crashpad/all/conanfile.py index 502e2bdfac30ee..04d89296dc4f89 100644 --- a/recipes/sentry-crashpad/all/conanfile.py +++ b/recipes/sentry-crashpad/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +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 get, apply_conandata_patches, copy, export_conandata_patches, rmdir, rm, replace_in_file +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.3" class SentryCrashpadConan(ConanFile): @@ -26,96 +32,86 @@ class SentryCrashpadConan(ConanFile): } short_paths = True - generators = "cmake" - _cmake = None @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _minimum_compilers_version(self): return { - "Visual Studio": "15" if tools.Version(self.version) < "0.4.16" else "16", + "Visual Studio": "15" if Version(self.version) < "0.4.16" else "16", "gcc": "6", "clang": "3.4", "apple-clang": "5.1", } 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 self.settings.os not in ("Linux", "Android") or tools.Version(self.version) < "0.4": + if self.settings.os not in ("Linux", "Android") or Version(self.version) < "0.4": del self.options.with_tls def build_requirements(self): if self._is_mingw: - self.build_requires("jwasm/2.13") + self.tool_requires("jwasm/2.13") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("libcurl/7.86.0") + self.requires("zlib/1.2.13") if self.options.get_safe("with_tls"): - self.requires("openssl/1.1.1n") + self.requires("openssl/1.1.1s") def validate(self): if self.settings.compiler.get_safe("cppstd"): # Set as required in crashpad CMake file. # See https://github.com/getsentry/crashpad/blob/71bcaad4cf30294b8de1bfa02064ab629437163b/CMakeLists.txt#L67 - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) if not minimum_version: self.output.warn("Compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("Build requires support for C++14. Minimum version for {} is {}" - .format(str(self.settings.compiler), minimum_version)) - if tools.Version(self.version) < "0.4.7" and self.settings.os == "Macos" and self.settings.arch == "armv8": + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"Build requires support for C++14. Minimum version for {self.settings.compiler} is {minimum_version}") + if Version(self.version) < "0.4.7" and self.settings.os == "Macos" and self.settings.arch == "armv8": raise ConanInvalidConfiguration("This version doesn't support ARM compilation") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder) + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CRASHPAD_ENABLE_INSTALL"] = True - self._cmake.definitions["CRASHPAD_ENABLE_INSTALL_DEV"] = True - self._cmake.definitions["CRASHPAD_ZLIB_SYSTEM"] = True + def source(self): + get(self, **self.conan_data["sources"][str(self.version)]) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CRASHPAD_ENABLE_INSTALL"] = True + tc.variables["CRASHPAD_ENABLE_INSTALL_DEV"] = True + tc.variables["CRASHPAD_ZLIB_SYSTEM"] = True + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) > "0.4": + apply_conandata_patches(self) + if Version(self.version) > "0.4": openssl_repl = "find_package(OpenSSL REQUIRED)" if self.options.get_safe("with_tls") else "" - tools.replace_in_file(os.path.join(self._source_subfolder, "external", "crashpad", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "external", "crashpad", "CMakeLists.txt"), "find_package(OpenSSL)", openssl_repl) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder="external/crashpad") cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=os.path.join(self._source_subfolder, "external", "crashpad")) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.configure(build_script_folder="external/crashpad") cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "crashpad") @@ -126,7 +122,7 @@ def package_info(self): self.cpp_info.components["crashpad_mini_chromium"].libs = ["mini_chromium"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["crashpad_mini_chromium"].system_libs.append("pthread") - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): self.cpp_info.components["crashpad_mini_chromium"].frameworks = ["CoreFoundation", "Foundation", "Security"] if self.settings.os == "Macos": self.cpp_info.components["crashpad_mini_chromium"].frameworks.extend(["ApplicationServices", "IOKit"]) @@ -137,7 +133,7 @@ def package_info(self): self.cpp_info.components["crashpad_compat"].set_property("cmake_target_name", "crashpad::compat") self.cpp_info.components["crashpad_compat"].includedirs.append(os.path.join("include", "crashpad")) # On Apple crashpad_compat is an interface library - if not tools.is_apple_os(self.settings.os): + if not is_apple_os(self): self.cpp_info.components["crashpad_compat"].libs = ["crashpad_compat"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["crashpad_compat"].system_libs.append("dl") @@ -179,7 +175,7 @@ def package_info(self): "crashpad_util", "crashpad_mini_chromium", ] - if tools.Version(self.version) > "0.3": + if Version(self.version) > "0.3": if self.settings.os == "Windows": # getopt self.cpp_info.components["crashpad_getopt"].set_property("cmake_target_name", "crashpad::getopt") @@ -200,7 +196,7 @@ def package_info(self): self.cpp_info.components["crashpad_tools"].libs = ["crashpad_tools"] 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) # TODO: to remove in conan v2 once cmake_find_package* generators removed @@ -218,7 +214,7 @@ def package_info(self): self.cpp_info.components["crashpad_snapshot"].names["cmake_find_package_multi"] = "snapshot" self.cpp_info.components["crashpad_minidump"].names["cmake_find_package"] = "minidump" self.cpp_info.components["crashpad_minidump"].names["cmake_find_package_multi"] = "minidump" - if tools.Version(self.version) > "0.3": + if Version(self.version) > "0.3": if self.settings.os == "Windows": self.cpp_info.components["crashpad_getopt"].names["cmake_find_package"] = "getopt" self.cpp_info.components["crashpad_getopt"].names["cmake_find_package_multi"] = "getopt" diff --git a/recipes/sentry-crashpad/all/test_package/CMakeLists.txt b/recipes/sentry-crashpad/all/test_package/CMakeLists.txt index e918f75812c631..b9de1503ca01fb 100644 --- a/recipes/sentry-crashpad/all/test_package/CMakeLists.txt +++ b/recipes/sentry-crashpad/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) find_package(crashpad REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE crashpad::client) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sentry-crashpad/all/test_package/conanfile.py b/recipes/sentry-crashpad/all/test_package/conanfile.py index a8b1104b7289cc..3a9d92c6be51d3 100644 --- a/recipes/sentry-crashpad/all/test_package/conanfile.py +++ b/recipes/sentry-crashpad/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.files import mkdir +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,10 +22,10 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): test_env_dir = "test_env" - tools.mkdir(test_env_dir) - bin_path = os.path.join("bin", "test_package") + mkdir(self, test_env_dir) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" - handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe) - self.run("%s %s/db %s" % (bin_path, test_env_dir, handler_bin_path), run_environment=True) + handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].bin_paths[0], handler_exe) + self.run(f"{bin_path} {test_env_dir} {handler_bin_path}", run_environment=True) diff --git a/recipes/sentry-crashpad/all/test_v1_package/CMakeLists.txt b/recipes/sentry-crashpad/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/sentry-crashpad/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/sentry-crashpad/all/test_v1_package/conanfile.py b/recipes/sentry-crashpad/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..07143b37b946fc --- /dev/null +++ b/recipes/sentry-crashpad/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +from conan.tools.files import mkdir +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): + test_env_dir = "test_env" + mkdir(self, test_env_dir) + bin_path = os.path.join("bin", "test_package") + handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" + handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe) + self.run(f"{bin_path} {test_env_dir} {handler_bin_path}", run_environment=True) diff --git a/recipes/sentry-crashpad/config.yml b/recipes/sentry-crashpad/config.yml index 69f2362e8a2a3a..8b62ee8e2e1d6f 100644 --- a/recipes/sentry-crashpad/config.yml +++ b/recipes/sentry-crashpad/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.3": + folder: all "0.5.0": folder: all "0.4.18": diff --git a/recipes/sentry-native/all/conandata.yml b/recipes/sentry-native/all/conandata.yml index 50a4d6caf333cf..4c206ae279b56c 100644 --- a/recipes/sentry-native/all/conandata.yml +++ b/recipes/sentry-native/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.3": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.3/sentry-native.zip" + sha256: "d9a2434783e558bc9e074518ce155bda129bfa12d376dde939e6a732c92f9757" "0.5.0": url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" diff --git a/recipes/sentry-native/config.yml b/recipes/sentry-native/config.yml index 69f2362e8a2a3a..8b62ee8e2e1d6f 100644 --- a/recipes/sentry-native/config.yml +++ b/recipes/sentry-native/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.3": + folder: all "0.5.0": folder: all "0.4.18": diff --git a/recipes/sfml/all/conandata.yml b/recipes/sfml/all/conandata.yml index 7ee890396d833d..58f8c7d9b6cc45 100644 --- a/recipes/sfml/all/conandata.yml +++ b/recipes/sfml/all/conandata.yml @@ -5,6 +5,18 @@ sources: patches: "2.5.1": - patch_file: "patches/0001-cmake-robust-find-deps.patch" + patch_description: "Robust discovery of dependencies" + patch_type: "conan" - patch_file: "patches/0002-allow-non-x86-64-macos.patch" + patch_description: "Allow compilation for macOS arm" + patch_type: "portability" - patch_file: "patches/0003-allow-shared-MT.patch" + patch_description: "Allow to build shared SFML with MT runtime" + patch_type: "portability" - patch_file: "patches/0004-fix-ios.patch" + patch_description: "Fix iOS detection logic in CMakeLists" + patch_type: "portability" + - patch_file: "patches/0005-remove-auto-ptr.patch" + patch_description: "Remove usage of auto_ptr to allow compilation with C++17 standard" + patch_type: "portability" + patch_source: "https://github.com/SFML/SFML/commit/bf92efe9a4035fee0258386173d53556aa196e49" diff --git a/recipes/sfml/all/conanfile.py b/recipes/sfml/all/conanfile.py index fbbe0cc38f82f7..32bcab86eaacb1 100644 --- a/recipes/sfml/all/conanfile.py +++ b/recipes/sfml/all/conanfile.py @@ -7,7 +7,7 @@ import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class SfmlConan(ConanFile): @@ -45,10 +45,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") @@ -62,16 +59,16 @@ def requirements(self): self.requires("xorg/system") if self.options.graphics: self.requires("freetype/2.12.1") - self.requires("stb/cci.20210910") + self.requires("stb/cci.20220909") if self.options.audio: self.requires("flac/1.3.3") self.requires("openal/1.22.2") self.requires("vorbis/1.3.7") def validate(self): - 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: + if self.settings.os not in ["Windows", "Linux", "FreeBSD", "Android", "Macos", "iOS"]: + raise ConanInvalidConfiguration(f"{self.ref} not supported on {self.settings.os}") + if self.options.graphics and not self.options.window: raise ConanInvalidConfiguration("sfml:graphics=True requires sfml:window=True") def source(self): diff --git a/recipes/sfml/all/patches/0005-remove-auto-ptr.patch b/recipes/sfml/all/patches/0005-remove-auto-ptr.patch new file mode 100644 index 00000000000000..63069f1d9cab4a --- /dev/null +++ b/recipes/sfml/all/patches/0005-remove-auto-ptr.patch @@ -0,0 +1,43 @@ +--- a/src/SFML/Audio/AudioDevice.cpp ++++ b/src/SFML/Audio/AudioDevice.cpp +@@ -29,7 +29,7 @@ + #include + #include + #include +-#include ++#include + + + namespace +@@ -107,9 +107,13 @@ bool AudioDevice::isExtensionSupported(const std::string& extension) + // This device will not be used in this function and merely + // makes sure there is a valid OpenAL device for extension + // queries if none has been created yet. +- std::auto_ptr device; ++ // ++ // Using an std::vector for this since auto_ptr is deprecated ++ // and we have no better STL facility for dynamically allocating ++ // a temporary instance with strong exception guarantee. ++ std::vector device; + if (!audioDevice) +- device.reset(new AudioDevice); ++ device.resize(1); + + if ((extension.length() > 2) && (extension.substr(0, 3) == "ALC")) + return alcIsExtensionPresent(audioDevice, extension.c_str()) != AL_FALSE; +@@ -125,9 +129,13 @@ int AudioDevice::getFormatFromChannelCount(unsigned int channelCount) + // This device will not be used in this function and merely + // makes sure there is a valid OpenAL device for format + // queries if none has been created yet. +- std::auto_ptr device; ++ // ++ // Using an std::vector for this since auto_ptr is deprecated ++ // and we have no better STL facility for dynamically allocating ++ // a temporary instance with strong exception guarantee. ++ std::vector device; + if (!audioDevice) +- device.reset(new AudioDevice); ++ device.resize(1); + + // Find the good format according to the number of channels + int format = 0; diff --git a/recipes/sfml/all/test_v1_package/CMakeLists.txt b/recipes/sfml/all/test_v1_package/CMakeLists.txt index 5ac31c943d9c4b..0d20897301b68b 100644 --- a/recipes/sfml/all/test_v1_package/CMakeLists.txt +++ b/recipes/sfml/all/test_v1_package/CMakeLists.txt @@ -1,33 +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) -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}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/simdutf/all/conandata.yml b/recipes/simdutf/all/conandata.yml index 2ba4399d0df483..2c889449b402e3 100644 --- a/recipes/simdutf/all/conandata.yml +++ b/recipes/simdutf/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "3.0.0": + url: "https://github.com/simdutf/simdutf/archive/v3.0.0.tar.gz" + sha256: "cc23b47fd0caf9018fc0dcf49ebeff2676654fff997f9f6ce50fa93cd36f661f" + "2.2.0": + url: "https://github.com/simdutf/simdutf/archive/v2.2.0.tar.gz" + sha256: "b0b8527e194700363cc47e75a7b8d58c88798b0dc31671f5ae5c8803d8678fe6" + "2.1.0": + url: "https://github.com/simdutf/simdutf/archive/v2.1.0.tar.gz" + sha256: "a8a8bbd71c8d8be1f7da16722776988d0640758fe0a46066eb3129868dad08da" "2.0.9": url: "https://github.com/simdutf/simdutf/archive/v2.0.9.tar.gz" sha256: "ff6a19de4c23671e7f1077cf6c0f60bc01197f29c6e4f56fa485c9cd732576ac" @@ -18,6 +27,18 @@ sources: url: "https://github.com/simdutf/simdutf/archive/refs/tags/v1.0.1.tar.gz" sha256: "e7832ba58fb95fe00de76dbbb2f17d844a7ad02a6f5e3e9e5ce9520e820049a0" patches: + "3.0.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.2.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.1.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" "2.0.9": - patch_file: "patches/2.0.3-0001-fix-cmake.patch" patch_description: "remove static build, enable rpath on macOS" diff --git a/recipes/simdutf/all/conanfile.py b/recipes/simdutf/all/conanfile.py index 47c94ebd381ae5..6bdedd0dd5b54c 100644 --- a/recipes/simdutf/all/conanfile.py +++ b/recipes/simdutf/all/conanfile.py @@ -6,7 +6,7 @@ import os -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class SimdutfConan(ConanFile): name = "simdutf" @@ -38,10 +38,7 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/simdutf/config.yml b/recipes/simdutf/config.yml index c018870b2e9a00..6f40e329116345 100644 --- a/recipes/simdutf/config.yml +++ b/recipes/simdutf/config.yml @@ -1,4 +1,10 @@ versions: + "3.0.0": + folder: all + "2.2.0": + folder: all + "2.1.0": + folder: all "2.0.9": folder: all "2.0.8": diff --git a/recipes/sqlite3/all/conandata.yml b/recipes/sqlite3/all/conandata.yml index 62074c59a652e7..b155ef964565f5 100644 --- a/recipes/sqlite3/all/conandata.yml +++ b/recipes/sqlite3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.40.1": + url: "https://sqlite.org/2022/sqlite-amalgamation-3400100.zip" + sha256: "49112cc7328392aa4e3e5dae0b2f6736d0153430143d21f69327788ff4efe734" "3.40.0": url: "https://sqlite.org/2022/sqlite-amalgamation-3400000.zip" sha256: "7c23eb51409315738c930a222cf7cd41518ae5823c41e60a81b93a07070ef22a" diff --git a/recipes/sqlite3/config.yml b/recipes/sqlite3/config.yml index 971a8b973abfda..db730ea2013eaf 100644 --- a/recipes/sqlite3/config.yml +++ b/recipes/sqlite3/config.yml @@ -1,4 +1,6 @@ versions: + "3.40.1": + folder: all "3.40.0": folder: all "3.39.4": diff --git a/recipes/squirrel/all/CMakeLists.txt b/recipes/squirrel/all/CMakeLists.txt deleted file mode 100644 index 8977c3f43d6f8d..00000000000000 --- a/recipes/squirrel/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_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/squirrel/all/conandata.yml b/recipes/squirrel/all/conandata.yml index c8c6b8b3282932..05364b18d9da38 100644 --- a/recipes/squirrel/all/conandata.yml +++ b/recipes/squirrel/all/conandata.yml @@ -1,8 +1,16 @@ sources: + "3.2": + url: "https://github.com/albertodemichelis/squirrel/archive/v3.2.tar.gz" + sha256: "02805414cfadd5bbb921891d3599b83375a40650abd6404a8ab407dc5e86a996" "3.1": url: "https://github.com/albertodemichelis/squirrel/archive/v3.1.tar.gz" sha256: "51942b8638a97b673e34ecf3ca50304996fa99bbdbfa7fe93d9744e6769b2f95" patches: + "3.2": + - patch_file: "patches/3.2-fix-cmake-static-build.patch" + patch_description: "fix static build issue" + patch_type: "portability" "3.1": - - patch_file: "patches/fix-cmake-static-shared.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.1-fix-cmake-static-shared.patch" + patch_description: "add flag to switch static/shared builds" + patch_type: "conan" diff --git a/recipes/squirrel/all/conanfile.py b/recipes/squirrel/all/conanfile.py index f7561951403deb..ea393f79ca89fb 100644 --- a/recipes/squirrel/all/conanfile.py +++ b/recipes/squirrel/all/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class SquirrelConan(ConanFile): name = "squirrel" @@ -12,11 +14,10 @@ class SquirrelConan(ConanFile): "language, designed to be a light-weight scripting language that " \ "fits in the size, memory bandwidth, and real-time requirements " \ "of applications like video games." + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.squirrel-lang.org/" - license = "MIT" - topics = ("squirrel", "programming-language", "object-oriented", "scripting") - + topics = ("programming-language", "object-oriented", "scripting") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,16 +28,8 @@ class SquirrelConan(ConanFile): "fPIC": True, } - 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"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,42 +37,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if tools.Version(self.version) <= "3.1": - if self.settings.os == "Macos": - raise ConanInvalidConfiguration("squirrel 3.1 and earlier does not support Macos") + if Version(self.version) <= "3.1": + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.ref} and earlier does not support Macos") if self.settings.compiler == "clang": - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) if compiler_version < "9" or compiler_version >= "11": raise ConanInvalidConfiguration( - f"squirrel 3.1 and earlier does not support Clang {compiler_version}" + f"{self.ref} and earlier does not support Clang {compiler_version}" + ) + if self.settings.compiler == "gcc": + compiler_version = Version(self.settings.compiler.version) + if compiler_version >= "12": + raise ConanInvalidConfiguration( + f"{self.ref} and earlier does not support gcc {compiler_version}" ) 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) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["DISABLE_DYNAMIC"] = not self.options.shared - cmake.definitions["DISABLE_STATIC"] = self.options.shared - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DISABLE_DYNAMIC"] = not self.options.shared + tc.variables["DISABLE_STATIC"] = self.options.shared + 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("COPYRIGHT", 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) + copy(self, pattern="COPYRIGHT", 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")) + def package_info(self): self.cpp_info.set_property("cmake_file_name", "squirrel") # CMakeDeps generator uses the global target if a downstream recipe depends on squirrel globally, @@ -90,20 +92,22 @@ def package_info(self): suffix = "" if self.options.shared else "_static" # squirrel - self.cpp_info.components["libsquirrel"].set_property("cmake_target_name", "squirrel::squirrel{}".format(suffix)) - self.cpp_info.components["libsquirrel"].libs = ["squirrel{}".format(suffix)] + self.cpp_info.components["libsquirrel"].set_property("cmake_target_name", f"squirrel::squirrel{suffix}") + self.cpp_info.components["libsquirrel"].libs = [f"squirrel{suffix}"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libsquirrel"].system_libs.append("m") # sqstdlib - self.cpp_info.components["sqstdlib"].set_property("cmake_target_name", "squirrel::sqstdlib{}".format(suffix)) - self.cpp_info.components["sqstdlib"].libs = ["sqstdlib{}".format(suffix)] + self.cpp_info.components["sqstdlib"].set_property("cmake_target_name", f"squirrel::sqstdlib{suffix}") + self.cpp_info.components["sqstdlib"].libs = [f"sqstdlib{suffix}"] self.cpp_info.components["sqstdlib"].requires = ["libsquirrel"] binpath = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var : {}".format(binpath)) + self.output.info(f"Appending PATH env var : {binpath}") self.env_info.PATH.append(binpath) # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["libsquirrel"].names["cmake_find_package"] = "squirrel{}".format(suffix) - self.cpp_info.components["libsquirrel"].names["cmake_find_package_multi"] = "squirrel{}".format(suffix) - self.cpp_info.components["sqstdlib"].names["cmake_find_package"] = "sqstdlib{}".format(suffix) - self.cpp_info.components["sqstdlib"].names["cmake_find_package_multi"] = "sqstdlib{}".format(suffix) + self.cpp_info.components["libsquirrel"].names["cmake_find_package"] = f"squirrel{suffix}" + self.cpp_info.components["libsquirrel"].names["cmake_find_package_multi"] = f"squirrel{suffix}" + self.cpp_info.components["sqstdlib"].names["cmake_find_package"] = f"sqstdlib{suffix}" + self.cpp_info.components["sqstdlib"].names["cmake_find_package_multi"] = f"sqstdlib{suffix}" diff --git a/recipes/squirrel/all/patches/fix-cmake-static-shared.patch b/recipes/squirrel/all/patches/3.1-fix-cmake-static-shared.patch similarity index 100% rename from recipes/squirrel/all/patches/fix-cmake-static-shared.patch rename to recipes/squirrel/all/patches/3.1-fix-cmake-static-shared.patch diff --git a/recipes/squirrel/all/patches/3.2-fix-cmake-static-build.patch b/recipes/squirrel/all/patches/3.2-fix-cmake-static-build.patch new file mode 100644 index 00000000000000..95706b31330730 --- /dev/null +++ b/recipes/squirrel/all/patches/3.2-fix-cmake-static-build.patch @@ -0,0 +1,13 @@ +diff --git a/sq/CMakeLists.txt b/sq/CMakeLists.txt +index bdea07d..f7629a3 100644 +--- a/sq/CMakeLists.txt ++++ b/sq/CMakeLists.txt +@@ -15,7 +15,7 @@ endif() + + if(NOT DISABLE_STATIC) + add_executable(sq_static sq.c) +- add_executable(squirrel::interpreter_static ALIAS sq) ++ add_executable(squirrel::interpreter_static ALIAS sq_static) + set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C EXPORT_NAME interpreter_static) + target_link_libraries(sq_static squirrel_static sqstdlib_static) + if(NOT SQ_DISABLE_INSTALLER) diff --git a/recipes/squirrel/all/test_package/CMakeLists.txt b/recipes/squirrel/all/test_package/CMakeLists.txt index 503b882c67cec4..13a7e10ca59c7b 100644 --- a/recipes/squirrel/all/test_package/CMakeLists.txt +++ b/recipes/squirrel/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(squirrel REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(TARGET squirrel::squirrel_static) - target_link_libraries(${PROJECT_NAME} squirrel::squirrel_static squirrel::sqstdlib_static) + target_link_libraries(${PROJECT_NAME} PRIVATE squirrel::squirrel_static squirrel::sqstdlib_static) else() - target_link_libraries(${PROJECT_NAME} squirrel::squirrel squirrel::sqstdlib) + target_link_libraries(${PROJECT_NAME} PRIVATE squirrel::squirrel squirrel::sqstdlib) endif() diff --git a/recipes/squirrel/all/test_package/conanfile.py b/recipes/squirrel/all/test_package/conanfile.py index 38f4483872d47f..a9fb96656f2039 100644 --- a/recipes/squirrel/all/test_package/conanfile.py +++ b/recipes/squirrel/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/squirrel/all/test_v1_package/CMakeLists.txt b/recipes/squirrel/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..925ecbe19e448d --- /dev/null +++ b/recipes/squirrel/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/squirrel/all/test_v1_package/conanfile.py b/recipes/squirrel/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..5a05af3c2dfd2f --- /dev/null +++ b/recipes/squirrel/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/squirrel/config.yml b/recipes/squirrel/config.yml index 992d10eb37c116..02e8efce1632dc 100644 --- a/recipes/squirrel/config.yml +++ b/recipes/squirrel/config.yml @@ -1,3 +1,5 @@ versions: + "3.2": + folder: all "3.1": folder: all diff --git a/recipes/strong_type/all/conandata.yml b/recipes/strong_type/all/conandata.yml new file mode 100644 index 00000000000000..dc0617a7a142bc --- /dev/null +++ b/recipes/strong_type/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "v7": + url: https://github.com/rollbear/strong_type/archive/refs/tags/v7.tar.gz + sha256: 854365b28dfaaee5c2047dd4d2e746c809b76035191b22a4ce24f4cac49d0891 + "v8": + url: https://github.com/rollbear/strong_type/archive/refs/tags/v8.tar.gz + sha256: 31ee68e097fec2ce65dbf2ed683911c5ee6a7a37808b28d84479ef7e17990fad diff --git a/recipes/strong_type/all/conanfile.py b/recipes/strong_type/all/conanfile.py new file mode 100644 index 00000000000000..70093f14d533d3 --- /dev/null +++ b/recipes/strong_type/all/conanfile.py @@ -0,0 +1,60 @@ +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.50.0" + + +class StrongTypeConan(ConanFile): + name = "strong_type" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rollbear/strong_type" + description = "An additive strong typedef library for C++14/17/20" + topics = ("cpp14", "cpp17", "strong_type") + license = "BSL-1.0" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + + 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) + + def build(self): + pass + + def package(self): + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + 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", "strong_type") + self.cpp_info.set_property("cmake_target_name", "rollbear::strong_type") + 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"] = "strong_type" + self.cpp_info.filenames["cmake_find_package_multi"] = "strong_type" + self.cpp_info.names["cmake_find_package"] = "rollbear" + self.cpp_info.names["cmake_find_package_multi"] = "rollbear" + self.cpp_info.components["strong_type"].names["cmake_find_package"] = "strong_type" + self.cpp_info.components["strong_type"].names["cmake_find_package_multi"] = "strong_type" + self.cpp_info.components["strong_type"].set_property("cmake_target_name", "rollbear::strong_type") + self.cpp_info.components["strong_type"].bindirs = [] + self.cpp_info.components["strong_type"].frameworkdirs = [] + self.cpp_info.components["strong_type"].libdirs = [] + self.cpp_info.components["strong_type"].resdirs = [] diff --git a/recipes/strong_type/all/test_package/CMakeLists.txt b/recipes/strong_type/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..d668b94ccc7767 --- /dev/null +++ b/recipes/strong_type/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(strong_type REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rollbear::strong_type) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/strong_type/all/test_package/conanfile.py b/recipes/strong_type/all/test_package/conanfile.py new file mode 100644 index 00000000000000..d120a992c06a69 --- /dev/null +++ b/recipes/strong_type/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, cmake_layout +import os + + +class TestPackageConan(ConanFile): + 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) + 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/strong_type/all/test_package/test_package.cpp b/recipes/strong_type/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..b48e03ab7f9a51 --- /dev/null +++ b/recipes/strong_type/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + + +int main() { + using myint = strong::type; + + if (value_of(myint{3}) == 3) + return 0; + + return 1; +} diff --git a/recipes/strong_type/all/test_v1_package/CMakeLists.txt b/recipes/strong_type/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..16903060128893 --- /dev/null +++ b/recipes/strong_type/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(strong_type REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rollbear::strong_type) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/strong_type/all/test_v1_package/conanfile.py b/recipes/strong_type/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..a500b98343c743 --- /dev/null +++ b/recipes/strong_type/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +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/strong_type/config.yml b/recipes/strong_type/config.yml new file mode 100644 index 00000000000000..24ded6bddb75a9 --- /dev/null +++ b/recipes/strong_type/config.yml @@ -0,0 +1,5 @@ +versions: + "v7": + folder: all + "v8": + folder: all diff --git a/recipes/taskflow/all/conandata.yml b/recipes/taskflow/all/conandata.yml index dae7658daeb106..8b83234e329cad 100644 --- a/recipes/taskflow/all/conandata.yml +++ b/recipes/taskflow/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.5.0": + url: "https://github.com/taskflow/taskflow/archive/v3.5.0.tar.gz" + sha256: "33c44e0da7dfda694d2b431724d6c8fd25a889ad0afbb4a32e8da82e2e9c2a92" "3.4.0": url: "https://github.com/taskflow/taskflow/archive/v3.4.0.tar.gz" sha256: "8f449137d3f642b43e905aeacdf1d7c5365037d5e1586103ed4f459f87cecf89" @@ -26,3 +29,5 @@ sources: patches: "3.3.0": - patch_file: "patches/3.3.0-immintrin-guard.patch" + patch_description: "add condition to check IA architecture" + patch_type: "portability" diff --git a/recipes/taskflow/config.yml b/recipes/taskflow/config.yml index 943da98e3a4e48..bd7fbbad854e3f 100644 --- a/recipes/taskflow/config.yml +++ b/recipes/taskflow/config.yml @@ -1,4 +1,6 @@ versions: + "3.5.0": + folder: all "3.4.0": folder: all "3.3.0": diff --git a/recipes/taywee-args/all/conandata.yml b/recipes/taywee-args/all/conandata.yml index 50dde225215bef..0a92d5f6ec7c08 100644 --- a/recipes/taywee-args/all/conandata.yml +++ b/recipes/taywee-args/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "6.4.4": + url: "https://github.com/Taywee/args/archive/6.4.4.tar.gz" + sha256: "7dca5e33148984cf701580324846c6557990a826bd1ab7a97ccdd6d0e486302f" "6.4.2": url: "https://github.com/Taywee/args/archive/6.4.2.tar.gz" sha256: "882adaf179471edf0ac468bab67a0ee53979e4efe91fe4992d5b38422067dd85" diff --git a/recipes/taywee-args/config.yml b/recipes/taywee-args/config.yml index 9c5be1f93b4292..9525359795e196 100644 --- a/recipes/taywee-args/config.yml +++ b/recipes/taywee-args/config.yml @@ -1,4 +1,6 @@ versions: + "6.4.4": + folder: all "6.4.2": folder: all "6.4.1": diff --git a/recipes/tsl-ordered-map/all/conandata.yml b/recipes/tsl-ordered-map/all/conandata.yml index 85051743065ccd..50a0714a45e066 100644 --- a/recipes/tsl-ordered-map/all/conandata.yml +++ b/recipes/tsl-ordered-map/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/Tessil/ordered-map/archive/v1.1.0.tar.gz" + sha256: "d6070502351646d68f2bbe6078c0da361bc1db733ee8a392e33cfb8b31183e28" "1.0.0": url: "https://github.com/Tessil/ordered-map/archive/v1.0.0.tar.gz" sha256: "49cd436b8bdacb01d5f4afd7aab0c0d6fa57433dfc29d65f08a5f1ed1e2af26b" diff --git a/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt b/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt index 843a031b132e48..be00a8c7f57c71 100644 --- a/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt +++ b/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tsl-ordered-map REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tsl::ordered_map) -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/tsl-ordered-map/config.yml b/recipes/tsl-ordered-map/config.yml index 40341aa3db6cd3..73c245662b08d6 100644 --- a/recipes/tsl-ordered-map/config.yml +++ b/recipes/tsl-ordered-map/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.0": + folder: all "1.0.0": folder: all diff --git a/recipes/tsl-robin-map/all/conandata.yml b/recipes/tsl-robin-map/all/conandata.yml index c223869bef2e46..89211be8fec7bf 100644 --- a/recipes/tsl-robin-map/all/conandata.yml +++ b/recipes/tsl-robin-map/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.1": + url: "https://github.com/Tessil/robin-map/archive/v1.2.1.tar.gz" + sha256: "2b54d2c1de2f73bea5c51d5dcbd64813a08caf1bfddcfdeee40ab74e9599e8e3" "1.0.1": url: "https://github.com/Tessil/robin-map/archive/v1.0.1.tar.gz" sha256: "b2ffdb623727cea852a66bddcb7fa6d938538a82b40e48294bb581fe086ef005" diff --git a/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt b/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt index 1fde03f4de7cd9..be00a8c7f57c71 100644 --- a/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt +++ b/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tsl-robin-map REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tsl::robin_map) -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/tsl-robin-map/config.yml b/recipes/tsl-robin-map/config.yml index bfce952bf842d6..7a3b316dace84a 100644 --- a/recipes/tsl-robin-map/config.yml +++ b/recipes/tsl-robin-map/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.1": + folder: all "1.0.1": folder: all "0.6.3": diff --git a/recipes/tuplet/all/conandata.yml b/recipes/tuplet/all/conandata.yml index a2444a74ca194f..98eee37c105c5f 100644 --- a/recipes/tuplet/all/conandata.yml +++ b/recipes/tuplet/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1.0": + url: "https://github.com/codeinred/tuplet/archive/v2.1.0.tar.gz" + sha256: "e77503b81259c4d67d1b16b887b9ab778422e2ffc031d2171b5117d2fddb237c" "2.0.0": url: "https://github.com/codeinred/tuplet/archive/refs/tags/v2.0.0.tar.gz" sha256: "cb754d119ca9d0a17ef165624d2c856b86eed9451bc8bc5c17b41410177a8d9f" diff --git a/recipes/tuplet/config.yml b/recipes/tuplet/config.yml index 9e6e28e4637599..dab8b51866d730 100644 --- a/recipes/tuplet/config.yml +++ b/recipes/tuplet/config.yml @@ -1,4 +1,6 @@ versions: + "2.1.0": + folder: all "2.0.0": folder: all "1.2.2": diff --git a/recipes/unordered_dense/all/conandata.yml b/recipes/unordered_dense/all/conandata.yml index d1960fdae4ca49..6869314546f18f 100644 --- a/recipes/unordered_dense/all/conandata.yml +++ b/recipes/unordered_dense/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.0.2": + url: "https://github.com/martinus/unordered_dense/archive/v3.0.2.tar.gz" + sha256: "0c0b874e9682cce3c75a1152308bfbb108538aaf1e90824d7789e2b64122520b" "3.0.0": url: "https://github.com/martinus/unordered_dense/archive/v3.0.0.tar.gz" sha256: "e73452d7c1e274b4a15b553c0904f1de4bcfa61b00514acd1eaad7deac805ef0" diff --git a/recipes/unordered_dense/config.yml b/recipes/unordered_dense/config.yml index de31902ca22589..4443921a008618 100644 --- a/recipes/unordered_dense/config.yml +++ b/recipes/unordered_dense/config.yml @@ -1,4 +1,6 @@ versions: + "3.0.2": + folder: all "3.0.0": folder: all "2.0.1": diff --git a/recipes/usockets/all/conandata.yml b/recipes/usockets/all/conandata.yml index c851ea9d76dea5..5b4a41335be2a9 100644 --- a/recipes/usockets/all/conandata.yml +++ b/recipes/usockets/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.8.5": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.5.tar.gz" + sha256: "c52c98b7ff2c24534c17ad97d5fea8ca0cb7ff38cc933b8d08bac6e498a2ea6b" + "0.8.3": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.3.tar.gz" + sha256: "2f96a26365b87badbea2360a82521a382c0c3ee2dcf4f32c79b11d0cb1989a53" "0.8.2": url: "https://github.com/uNetworking/uSockets/archive/v0.8.2.tar.gz" sha256: "c17fc99773a30552cdd7741ff98af177eeecb26b89fc38011b430956b3b2eca5" @@ -15,6 +21,16 @@ sources: url: "https://github.com/uNetworking/uSockets/archive/v0.4.0.tar.gz" sha256: "f9f15b395def578cc79a5b32abc64fa9cff5dac873062911f515b984b90f7cc2" patches: + "0.8.5": + - patch_file: "patches/0001-makefile_0.8.3.patch" + base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" + "0.8.3": + - patch_file: "patches/0001-makefile_0.8.3.patch" + base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" "0.8.2": - patch_file: "patches/0001-makefile_0.8.2.patch" base_path: "source_subfolder" diff --git a/recipes/usockets/all/conanfile.py b/recipes/usockets/all/conanfile.py index 265bb2485b4dc8..09208942cd97ef 100644 --- a/recipes/usockets/all/conanfile.py +++ b/recipes/usockets/all/conanfile.py @@ -2,10 +2,13 @@ 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.tools.microsoft import is_msvc from conan.errors import ConanInvalidConfiguration from conans import MSBuild, AutoToolsBuildEnvironment +from conans.tools import vcvars, environment_append, unix_path, get_env import os +import contextlib required_conan_version = ">=1.52.0" @@ -61,6 +64,10 @@ def _minimum_compilers_version(self, cppstd): 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) @@ -114,14 +121,20 @@ def requirements(self): if self.options.with_ssl == "openssl": self.requires("openssl/1.1.1s") elif self.options.with_ssl == "wolfssl": - self.requires("wolfssl/5.3.0") + self.requires("wolfssl/5.5.1") if self.options.eventloop == "libuv": self.requires("libuv/1.44.2") elif self.options.eventloop == "gcd": self.requires("libdispatch/5.3.2") elif self.options.eventloop == "boost": - self.requires("boost/1.80.0") + self.requires("boost/1.81.0") + + def build_requirements(self): + if self._settings_build.os == "Windows" and not get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + if self.settings.compiler == "Visual Studio": + self.build_requires("automake/1.16.5") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @@ -134,11 +147,34 @@ def _build_msvc(self): msbuild = MSBuild(self) msbuild.build(project_file="uSockets.vcxproj", platforms={"x86": "Win32"}) + @contextlib.contextmanager + def _build_context(self): + if is_msvc(self): + with vcvars(self): + env = { + "CC": "{} cl -nologo".format(unix_path(self.deps_user_info["automake"].compile)), + "CXX": "{} cl -nologo".format(unix_path(self.deps_user_info["automake"].compile)), + "CFLAGS": "-{}".format(self.settings.compiler.runtime), + "LD": "link", + "NM": "dumpbin -symbols", + "STRIP": ":", + "AR": "{} lib".format(unix_path(self.deps_user_info["automake"].ar_lib)), + "RANLIB": ":", + } + + if self.options.eventloop == "libuv": + env["CPPFLAGS"] = "-I" + unix_path(self.deps_cpp_info["libuv"].include_paths[0]) + " " + + with environment_append(env): + yield + else: + yield + def _build_configure(self): autotools = AutoToolsBuildEnvironment(self) autotools.fpic = self.options.get_safe("fPIC", False) with chdir(self, self._source_subfolder): - args = [] + args = ["WITH_LTO=0"] if self.options.with_ssl == "openssl": args.append("WITH_OPENSSL=1") elif self.options.with_ssl == "wolfssl": @@ -156,16 +192,17 @@ def _build_configure(self): def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": + if Version(self.version) < "0.8.3" and is_msvc(self): self._build_msvc() else: - self._build_configure() + with self._build_context(): + self._build_configure() def package(self): 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) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) # drop internal headers rmdir(self, os.path.join(self.package_folder, "include", "internal")) diff --git a/recipes/usockets/all/patches/0001-makefile_0.8.3.patch b/recipes/usockets/all/patches/0001-makefile_0.8.3.patch new file mode 100644 index 00000000000000..5ea7628ad348dd --- /dev/null +++ b/recipes/usockets/all/patches/0001-makefile_0.8.3.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile b/Makefile +index f6e2c6b..087d021 100644 +--- a/Makefile ++++ b/Makefile +@@ -63,21 +63,21 @@ endif + # By default we build the uSockets.a static library + default: + rm -f *.o +- $(CC) $(CFLAGS) -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 + # Create a static library (try windows, then unix) +- lib.exe /out:uSockets.a *.o || $(AR) rvs uSockets.a *.o ++ lib.exe /out:uSockets.lib *.obj || $(AR) rvs libuSockets.a *.o + + # BoringSSL needs cmake and golang + .PHONY: boringssl +@@ -87,7 +87,7 @@ boringssl: + # Builds all examples + .PHONY: examples + examples: default +- for f in examples/*.c; do $(CC) -O3 $(CFLAGS) -o $$(basename "$$f" ".c")$(EXEC_SUFFIX) "$$f" $(LDFLAGS); done ++ for f in examples/*.c; do $(CC) $(CPPFLAGS) -O3 $(CFLAGS) -o $$(basename "$$f" ".c")$(EXEC_SUFFIX) "$$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/config.yml b/recipes/usockets/config.yml index 76b81d9ebd6902..c4f53d0a2aff05 100644 --- a/recipes/usockets/config.yml +++ b/recipes/usockets/config.yml @@ -1,4 +1,8 @@ versions: + "0.8.5": + folder: all + "0.8.3": + folder: all "0.8.2": folder: all "0.8.1": diff --git a/recipes/utfcpp/all/conandata.yml b/recipes/utfcpp/all/conandata.yml index 42cbfd5cf50185..f435f56f7acf1c 100644 --- a/recipes/utfcpp/all/conandata.yml +++ b/recipes/utfcpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.3": + url: "https://github.com/nemtrif/utfcpp/archive/v3.2.3.tar.gz" + sha256: "3ba9b0dbbff08767bdffe8f03b10e596ca351228862722e4c9d4d126d2865250" "3.2.2": url: "https://github.com/nemtrif/utfcpp/archive/v3.2.2.tar.gz" sha256: "6f81e7cb2be2a6a9109a8a0cb7dc39ec947f1bcdb5dfa4a660e11a23face19f5" diff --git a/recipes/utfcpp/all/conanfile.py b/recipes/utfcpp/all/conanfile.py index 63d01a72ddc947..2d5820625e1764 100644 --- a/recipes/utfcpp/all/conanfile.py +++ b/recipes/utfcpp/all/conanfile.py @@ -61,9 +61,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "utf8cpp") self.cpp_info.includedirs.append(os.path.join("include", "utf8cpp")) 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.names["cmake_find_package"] = "utf8cpp" diff --git a/recipes/utfcpp/all/test_v1_package/CMakeLists.txt b/recipes/utfcpp/all/test_v1_package/CMakeLists.txt index d476d50d29d2f9..be00a8c7f57c71 100644 --- a/recipes/utfcpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/utfcpp/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(utf8cpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE utf8cpp) -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/utfcpp/config.yml b/recipes/utfcpp/config.yml index 6d247e5ee81476..00df0fb881cb8a 100644 --- a/recipes/utfcpp/config.yml +++ b/recipes/utfcpp/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.3": + folder: all "3.2.2": folder: all "3.2.1": diff --git a/recipes/vorbis/all/conanfile.py b/recipes/vorbis/all/conanfile.py index 007a900f3ab52b..4e074b9f2cd877 100644 --- a/recipes/vorbis/all/conanfile.py +++ b/recipes/vorbis/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import apply_conandata_patches, copy, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class VorbisConan(ConanFile): @@ -34,7 +34,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") try: del self.settings.compiler.libcxx except Exception: @@ -45,7 +45,7 @@ def configure(self): pass def requirements(self): - self.requires("ogg/1.3.5") + self.requires("ogg/1.3.5", transitive_headers=True) def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/vulkan-loader/all/conandata.yml b/recipes/vulkan-loader/all/conandata.yml index d804f7c0e91a69..423603885003db 100644 --- a/recipes/vulkan-loader/all/conandata.yml +++ b/recipes/vulkan-loader/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "157d2230b50bb5be3ef9b9467aa90d1c109d5f188a49b11f741246d7ca583bf3" "1.3.231.1": url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "5226fbc6a90e4405200c8cfdd5733d5e0c6a64e64dcc614c485ea06e03d66578" @@ -48,17 +51,20 @@ sources: url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/sdk-1.2.154.0.tar.gz" sha256: "418017d7bab907e72291476df231dd0e7dc7fe20b97e55389c975bcfc48d6433" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch" + patch_description: "Do not use features of CMake 3.16, back to 3.10 as min version" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/Vulkan-Loader/pull/1102" "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/1.2.182-0001-fix-mingw.patch" patch_description: "Fix MinGW" patch_type: "portability" - sha256: "a05375c60b7f4a91f48df2278518be27e578e38190034bfcc887e5ceaa289c25" "1.2.154.0": - patch_file: "patches/1.2.154.0-0001-fix-mingw.patch" patch_description: "Fix MinGW" @@ -67,4 +73,3 @@ patches: - "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 ec8208aa8c4409..e1a6db65c0bf0e 100644 --- a/recipes/vulkan-loader/all/conanfile.py +++ b/recipes/vulkan-loader/all/conanfile.py @@ -75,12 +75,12 @@ def requirements(self): self.requires("wayland/1.21.0") def validate(self): - if self.info.options.get_safe("with_wsi_directfb"): + if self.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: + if not is_apple_os(self) and not self.options.shared: raise ConanInvalidConfiguration(f"Static builds are not supported on {self.settings.os}") - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < 15: + if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < 15: # FIXME: It should build but Visual Studio 2015 container in CI of CCI seems to lack some Win SDK headers raise ConanInvalidConfiguration("Visual Studio < 2017 not yet supported in this recipe") # TODO: to replace by some version range check @@ -134,9 +134,10 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - 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") + if Version(self.version) < "1.3.234": + 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") # Honor settings.compiler.runtime replace_in_file(self, os.path.join(self.source_folder, "loader", "CMakeLists.txt"), "if(${configuration} MATCHES \"/MD\")", diff --git a/recipes/vulkan-loader/all/patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch b/recipes/vulkan-loader/all/patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch new file mode 100644 index 00000000000000..fe88588420cd9f --- /dev/null +++ b/recipes/vulkan-loader/all/patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch @@ -0,0 +1,24 @@ +--- a/loader/CMakeLists.txt ++++ b/loader/CMakeLists.txt +@@ -160,9 +160,7 @@ if(WIN32) + target_link_libraries(asm_offset PRIVATE loader_specific_options) + # If not cross compiling, run asm_offset to generage gen_defines.asm + if (NOT CMAKE_CROSSCOMPILING) +- add_custom_command(TARGET asm_offset POST_BUILD +- COMMAND asm_offset MASM +- BYPRODUCTS gen_defines.asm) ++ add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset MASM) + else() + # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. + target_compile_options(asm_offset PRIVATE "/Fa$/asm_offset.asm" /FA) +@@ -236,9 +234,7 @@ else() # i.e.: Linux + target_link_libraries(asm_offset loader_specific_options) + # If not cross compiling, run asm_offset to generage gen_defines.asm + if (NOT CMAKE_CROSSCOMPILING) +- add_custom_command(TARGET asm_offset POST_BUILD +- COMMAND asm_offset GAS +- BYPRODUCTS gen_defines.asm) ++ add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset GAS) + else() + # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. + target_compile_options(asm_offset PRIVATE -save-temps=obj) diff --git a/recipes/vulkan-loader/config.yml b/recipes/vulkan-loader/config.yml index 9392c7d1f760b1..14679d8e7f0e5a 100644 --- a/recipes/vulkan-loader/config.yml +++ b/recipes/vulkan-loader/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.231": diff --git a/recipes/vulkan-memory-allocator/all/conanfile.py b/recipes/vulkan-memory-allocator/all/conanfile.py index 39e07acab27929..5920e7735e9041 100644 --- a/recipes/vulkan-memory-allocator/all/conanfile.py +++ b/recipes/vulkan-memory-allocator/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.layout import basic_layout from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class VulkanMemoryAllocatorConan(ConanFile): @@ -22,11 +22,13 @@ def _min_cppstd(self): return "11" if Version(self.version) < "3.0.0" else "14" 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 layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("vulkan-headers/1.3.224.0") + self.requires("vulkan-headers/1.3.236.0") def package_id(self): self.info.clear() @@ -35,9 +37,6 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - 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) @@ -55,6 +54,4 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/vulkan-memory-allocator/all/test_package/conanfile.py b/recipes/vulkan-memory-allocator/all/test_package/conanfile.py index d120a992c06a69..0a6bc68712d901 100644 --- a/recipes/vulkan-memory-allocator/all/test_package/conanfile.py +++ b/recipes/vulkan-memory-allocator/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-memory-allocator/all/test_v1_package/CMakeLists.txt b/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt index ead56f86c0f5a6..925ecbe19e448d 100644 --- a/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt +++ b/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt @@ -1,15 +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-memory-allocator REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE vulkan-memory-allocator::vulkan-memory-allocator) -if(vulkan-memory-allocator_VERSION VERSION_LESS "3.0.0") - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -else() - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/vulkan-validationlayers/all/CMakeLists.txt b/recipes/vulkan-validationlayers/all/CMakeLists.txt deleted file mode 100644 index 3206840c13b9fd..00000000000000 --- a/recipes/vulkan-validationlayers/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -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(src) diff --git a/recipes/vulkan-validationlayers/all/conandata.yml b/recipes/vulkan-validationlayers/all/conandata.yml index 9df896ac76970a..f251df5a89323f 100644 --- a/recipes/vulkan-validationlayers/all/conandata.yml +++ b/recipes/vulkan-validationlayers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "68f2cf70b1960f85e931ef56935e6ceda1beeb214f8fa319e6b95128b02b485a" "1.3.231.1": url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.231.1.tar.gz" sha256: "ea40af0f499e7e97a86ee54410c5c78e7f7bac40f65ae09a1549773b6501bf4d" @@ -23,23 +26,43 @@ sources: "1.2.182": url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/v1.2.182.tar.gz" sha256: "5a1f7027c06a8e5ae777d9053b5ce46f10ca623806a43332eb2da06fe46476d4" - "1.2.154.0": - url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/sdk-1.2.154.0.tar.gz" - sha256: "8898ab05d0d8dec04fbba03d0ed2e79a1eb5c0382e5c89d4c737b45a6648f7f9" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.3.231.1": - - patch_file: "patches/1.3.231.1-cmake-no-werror.patch" + - patch_file: "patches/1.3.231.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + - patch_file: "patches/1.3.231.1-0002-cmake-no-werror.patch" patch_description: "Allow to disable Werror for old gcc/clang versions" patch_type: "portability" - sha256: "14678800b649c54dee25ee06d8c379f7abca2ae8a580a7fa64d4eb06b5080ecd" + "1.3.224.1": + - patch_file: "patches/1.3.224.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.216.0": + - patch_file: "patches/1.3.204.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.211.0": + - patch_file: "patches/1.3.204.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.204.1": + - patch_file: "patches/1.3.204.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.2.198.0": - - patch_file: "patches/0005-fix-cmake-1.2.198.0.patch" + - patch_file: "patches/1.2.198.0-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.2.189.2": - - patch_file: "patches/0005-fix-cmake-1.2.189.2.patch" + - patch_file: "patches/1.2.189.2-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.2.182": - - patch_file: "patches/0005-fix-cmake-1.2.182.patch" - "1.2.154.0": - - patch_file: "patches/0001-duplicated-declaration.patch" - - patch_file: "patches/0002-fix-mingw.patch" - - patch_file: "patches/0003-disable-nortti-and-warnings-as-errors.patch" - - patch_file: "patches/0004-fix-installation.patch" + - patch_file: "patches/1.2.182-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" diff --git a/recipes/vulkan-validationlayers/all/conanfile.py b/recipes/vulkan-validationlayers/all/conanfile.py index cf06f5e8ad1355..aac6abc4171510 100644 --- a/recipes/vulkan-validationlayers/all/conanfile.py +++ b/recipes/vulkan-validationlayers/all/conanfile.py @@ -60,11 +60,29 @@ def _needs_pkg_config(self): self.options.get_safe("with_wsi_xlib") or \ self._needs_wayland_for_build + @property + def _min_cppstd(self): + if Version(self.version) >= "1.3.235": + return "17" + return "11" + + @property + def _compilers_minimum_version(self): + return { + "11": {}, + "17": { + "apple-clang": "9", + "clang": "6", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15.7", + }, + }[self._min_cppstd] + 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) export_conandata_patches(self) def config_options(self): @@ -77,12 +95,10 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): + self.requires("robin-hood-hashing/3.11.5") # 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 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._needs_wayland_for_build: @@ -94,13 +110,25 @@ def _require(self, recipe_name): return f"{recipe_name}/{self._dependencies_versions[recipe_name]}" def validate(self): - if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + 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.info.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) if self.dependencies["spirv-tools"].options.shared: raise ConanInvalidConfiguration("vulkan-validationlayers can't depend on shared spirv-tools") - if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 is not supported") def build_requirements(self): @@ -116,7 +144,8 @@ def generate(self): env.generate() tc = CMakeToolchain(self) - tc.variables["VULKAN_HEADERS_INSTALL_DIR"] = self.dependencies["vulkan-headers"].package_folder.replace("\\", "/") + if Version(self.version) < "1.3.234": + 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 @@ -142,22 +171,17 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - 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)", "") + # Vulkan-ValidationLayers relies on Vulkan-Headers version from CMake config file + # to set api_version in its manifest file, but this value MUST have format x.y.z (no extra number). + # FIXME: find a way to force correct version in CMakeDeps of vulkan-headers recipe? + if Version(self.version) >= "1.3.235": + vk_version = Version(self.dependencies["vulkan-headers"].ref.version) + sanitized_vk_version = f"{vk_version.major}.{vk_version.minor}.{vk_version.patch}" + replace_in_file( + self, os.path.join(self.source_folder, "layers", "CMakeLists.txt"), + "set(JSON_API_VERSION ${VulkanHeaders_VERSION})", + f"set(JSON_API_VERSION \"{sanitized_vk_version}\")", + ) # 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(os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake")): @@ -169,13 +193,14 @@ def _patch_sources(self): def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.configure() cmake.build() def package(self): copy(self, "LICENSE.txt", 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")) if self.settings.os == "Windows": # import lib is useless, validation layers are loaded at runtime lib_dir = os.path.join(self.package_folder, "lib") diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.154.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.154.0.yml deleted file mode 100644 index 89220f11bfbe08..00000000000000 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.154.0.yml +++ /dev/null @@ -1,2 +0,0 @@ -spirv-tools: "2020.5" -vulkan-headers: "1.2.154.0" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml new file mode 100644 index 00000000000000..830bb842e9002f --- /dev/null +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml @@ -0,0 +1,2 @@ +spirv-tools: "1.3.236.0" +vulkan-headers: "1.3.236.0" diff --git a/recipes/vulkan-validationlayers/all/patches/0001-duplicated-declaration.patch b/recipes/vulkan-validationlayers/all/patches/0001-duplicated-declaration.patch deleted file mode 100644 index ef1e6f9cb33eac..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0001-duplicated-declaration.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/layers/range_vector.h -+++ b/layers/range_vector.h -@@ -141,8 +141,6 @@ class range_view { - const Range &range_; - }; - --template --using const_correct_iterator = decltype(std::declval().begin()); - - // Type parameters for the range_map(s) - struct insert_range_no_split_bounds { diff --git a/recipes/vulkan-validationlayers/all/patches/0002-fix-mingw.patch b/recipes/vulkan-validationlayers/all/patches/0002-fix-mingw.patch deleted file mode 100644 index 8a5be818754e98..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0002-fix-mingw.patch +++ /dev/null @@ -1,34 +0,0 @@ -see https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2549 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -287,6 +287,9 @@ add_library(VkLayer_utils - target_link_libraries(VkLayer_utils PUBLIC Vulkan::Headers) - if(WIN32) - target_compile_definitions(VkLayer_utils PUBLIC _CRT_SECURE_NO_WARNINGS) -+ if(MINGW) -+ target_compile_definitions(VkLayer_utils PUBLIC "_WIN32_WINNT=0x0600") -+ endif() - endif() - install(TARGETS VkLayer_utils DESTINATION ${CMAKE_INSTALL_LIBDIR}) - set_target_properties(VkLayer_utils PROPERTIES LINKER_LANGUAGE CXX) ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -139,7 +139,7 @@ endif() - - include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/generated ${VulkanHeaders_INCLUDE_DIR}) - --if(WIN32) -+if(MSVC) - # Applies to all configurations - add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX) - # Avoid: fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj -@@ -150,6 +150,9 @@ if(WIN32) - # that constructor initializers are now fixed to clear the struct members. - add_compile_options("$<$,$,19>>:/wd4351>") - else() -+ if(MINGW) -+ add_compile_options("-Wa,-mbig-obj") -+ endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") - endif() diff --git a/recipes/vulkan-validationlayers/all/patches/0003-disable-nortti-and-warnings-as-errors.patch b/recipes/vulkan-validationlayers/all/patches/0003-disable-nortti-and-warnings-as-errors.patch deleted file mode 100644 index d9c8bd409372ff..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0003-disable-nortti-and-warnings-as-errors.patch +++ /dev/null @@ -1,34 +0,0 @@ -rtti enabled: -https://github.com/KhronosGroup/Vulkan-ValidationLayers/commit/3a0631bd11f25113d28c65d9984d3f3b486026b4 -no warnings as errors submitted to upstream project: -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2300 -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2552 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -118,12 +118,14 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") - -fvisibility=hidden) - - # 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) - if((CMAKE_COMPILER_IS_GNUCXX AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.3.0)) OR - (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND - (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0.0) AND - (CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 7.0.0))) - add_compile_options(-Werror) - endif() -+ endif() - - set(CMAKE_C_STANDARD 99) - set(CMAKE_CXX_STANDARD 11) -@@ -136,9 +138,9 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") - endif() - elseif(MSVC) - # Treat warnings as errors -+ if(BUILD_WERROR) - add_compile_options("/WX") -- # Disable RTTI -- add_compile_options("/GR-") -+ endif() - # Warn about nested declarations - add_compile_options("/w34456") - # Warn about potentially uninitialized variables diff --git a/recipes/vulkan-validationlayers/all/patches/0004-fix-installation.patch b/recipes/vulkan-validationlayers/all/patches/0004-fix-installation.patch deleted file mode 100644 index 2fe7804510f4bd..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0004-fix-installation.patch +++ /dev/null @@ -1,37 +0,0 @@ -see: -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2307 -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2551 ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -72,7 +72,7 @@ if(BUILD_LAYER_SUPPORT_FILES) - generated/vk_object_types.h - generated/vk_extension_helper.h - generated/vk_typemap_helper.h) -- install(FILES ${LAYER_UTIL_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -+ install(FILES ${LAYER_UTIL_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vulkan) - endif() - - set(TARGET_NAMES -@@ -83,11 +83,11 @@ if(BUILD_LAYERS) - if(WIN32) - if(CMAKE_GENERATOR MATCHES "^Visual Studio.*") - foreach(TARGET_NAME ${TARGET_NAMES}) -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES $/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endforeach() - else() - foreach(TARGET_NAME ${TARGET_NAMES}) -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES $/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endforeach() - endif() - elseif(UNIX) # UNIX includes APPLE -@@ -124,7 +127,7 @@ elseif(APPLE) - "-Wl" - INSTALL_RPATH - "@loader_path/") -- install(TARGETS VkLayer_${target} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -+ install(TARGETS VkLayer_${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endmacro() - else(UNIX AND NOT APPLE) # i.e.: Linux - macro(AddVkLayer target LAYER_COMPILE_DEFINITIONS) diff --git a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.182.patch b/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.182.patch deleted file mode 100644 index 23f54090508e93..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.182.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -237,10 +237,7 @@ option(BUILD_LAYERS "Build layers" ON) - option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers - option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) - if (USE_ROBIN_HOOD_HASHING) -- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) -- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") -- endif() -- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") -+ find_package(robin_hood REQUIRED CONFIG) - endif() - - if(BUILD_TESTS OR BUILD_LAYERS) -@@ -389,7 +386,7 @@ target_include_directories(VkLayer_utils - ${VulkanHeaders_INCLUDE_DIR}) - - if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -+ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) - target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) - endif() - ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -291,9 +291,6 @@ if(BUILD_LAYERS) - if(INSTRUMENT_OPTICK) - target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) - endif() -- if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -- endif() - target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) - - # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.189.2.patch b/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.189.2.patch deleted file mode 100644 index 3f250cc259e56c..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.189.2.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -240,10 +240,7 @@ option(BUILD_LAYERS "Build layers" ON) - option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers - option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) - if (USE_ROBIN_HOOD_HASHING) -- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) -- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") -- endif() -- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") -+ find_package(robin_hood REQUIRED CONFIG) - endif() - - if(BUILD_TESTS) -@@ -375,7 +372,7 @@ target_include_directories(VkLayer_utils - ${VulkanHeaders_INCLUDE_DIR}) - - if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -+ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) - target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) - endif() - ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -297,9 +297,6 @@ if(BUILD_LAYERS) - if(INSTRUMENT_OPTICK) - target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) - endif() -- if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -- endif() - target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) - - # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.198.0.patch b/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.198.0.patch deleted file mode 100644 index 00e8fb562f304e..00000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.198.0.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -237,10 +237,7 @@ option(BUILD_LAYERS "Build layers" ON) - option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers - option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) - if (USE_ROBIN_HOOD_HASHING) -- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) -- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") -- endif() -- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") -+ find_package(robin_hood REQUIRED CONFIG) - endif() - - if(BUILD_TESTS) -@@ -372,7 +369,7 @@ target_include_directories(VkLayer_utils - ${VulkanHeaders_INCLUDE_DIR}) - - if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -+ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) - target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) - endif() - ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -301,9 +301,6 @@ if(BUILD_LAYERS) - if(INSTRUMENT_OPTICK) - target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) - endif() -- if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -- endif() - target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) - - # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.2.182-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.2.182-0001-fix-cmake.patch new file mode 100644 index 00000000000000..1df1151c343670 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.2.182-0001-fix-cmake.patch @@ -0,0 +1,83 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -102,7 +102,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -154,7 +154,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +@@ -237,13 +237,10 @@ option(BUILD_LAYERS "Build layers" ON) + option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers + option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) + if (USE_ROBIN_HOOD_HASHING) +- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) +- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") +- endif() +- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") ++ find_package(robin_hood REQUIRED CONFIG) + endif() + +-if(BUILD_TESTS OR BUILD_LAYERS) ++if(BUILD_TESTS) + + set(GLSLANG_INSTALL_DIR "GLSLANG-NOTFOUND" CACHE PATH "Absolute path to a glslang install directory") + if(NOT GLSLANG_INSTALL_DIR AND NOT DEFINED ENV{GLSLANG_INSTALL_DIR} AND NOT TARGET glslang) +@@ -302,8 +299,14 @@ if(BUILD_TESTS OR BUILD_LAYERS) + set(GLSLANG_SPIRV_INCLUDE_DIR "${glslang_SOURCE_DIR}" CACHE PATH "Path to glslang spirv headers") + set(GLSLANG_LIBRARIES glslang SPIRV SPVRemapper) + endif() ++endif() + ++if(BUILD_TESTS OR BUILD_LAYERS) + # spirv-tools ++ find_package(SPIRV-Tools REQUIRED CONFIG) ++ if(NOT TARGET SPIRV-Tools-opt) ++ find_package(SPIRV-Tools-opt REQUIRED CONFIG) ++ endif() + if (NOT TARGET SPIRV-Tools) + if(NOT SPIRV_TOOLS_INSTALL_DIR) + set(SPIRV_TOOLS_INSTALL_DIR "${GLSLANG_INSTALL_DIR}") +@@ -389,7 +392,7 @@ target_include_directories(VkLayer_utils + ${VulkanHeaders_INCLUDE_DIR}) + + if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) ++ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) + target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) + endif() + +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -291,9 +291,6 @@ if(BUILD_LAYERS) + if(INSTRUMENT_OPTICK) + target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) + endif() +- if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) +- endif() + target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.2.189.2-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.2.189.2-0001-fix-cmake.patch new file mode 100644 index 00000000000000..a5cb883c9cc3ae --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.2.189.2-0001-fix-cmake.patch @@ -0,0 +1,75 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -111,7 +111,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -163,7 +163,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +@@ -240,10 +240,7 @@ option(BUILD_LAYERS "Build layers" ON) + option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers + option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) + if (USE_ROBIN_HOOD_HASHING) +- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) +- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") +- endif() +- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") ++ find_package(robin_hood REQUIRED CONFIG) + endif() + + if(BUILD_TESTS) +@@ -307,6 +304,10 @@ endif() + + if(BUILD_TESTS OR BUILD_LAYERS) + # spirv-tools ++ find_package(SPIRV-Tools REQUIRED CONFIG) ++ if(NOT TARGET SPIRV-Tools-opt) ++ find_package(SPIRV-Tools-opt REQUIRED CONFIG) ++ endif() + if (NOT TARGET SPIRV-Tools) + if(NOT SPIRV_TOOLS_INSTALL_DIR) + set(SPIRV_TOOLS_INSTALL_DIR "${GLSLANG_INSTALL_DIR}") +@@ -375,7 +376,7 @@ target_include_directories(VkLayer_utils + ${VulkanHeaders_INCLUDE_DIR}) + + if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) ++ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) + target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) + endif() + +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -297,9 +297,6 @@ if(BUILD_LAYERS) + if(INSTRUMENT_OPTICK) + target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) + endif() +- if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) +- endif() + target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.2.198.0-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.2.198.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..e482c6be482cfa --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.2.198.0-0001-fix-cmake.patch @@ -0,0 +1,75 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -108,7 +108,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -160,7 +160,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +@@ -237,10 +237,7 @@ option(BUILD_LAYERS "Build layers" ON) + option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers + option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) + if (USE_ROBIN_HOOD_HASHING) +- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) +- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") +- endif() +- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") ++ find_package(robin_hood REQUIRED CONFIG) + endif() + + if(BUILD_TESTS) +@@ -304,6 +301,10 @@ endif() + + if(BUILD_TESTS OR BUILD_LAYERS) + # spirv-tools ++ find_package(SPIRV-Tools REQUIRED CONFIG) ++ if(NOT TARGET SPIRV-Tools-opt) ++ find_package(SPIRV-Tools-opt REQUIRED CONFIG) ++ endif() + if (NOT TARGET SPIRV-Tools) + if(NOT SPIRV_TOOLS_INSTALL_DIR) + set(SPIRV_TOOLS_INSTALL_DIR "${GLSLANG_INSTALL_DIR}") +@@ -372,7 +373,7 @@ target_include_directories(VkLayer_utils + ${VulkanHeaders_INCLUDE_DIR}) + + if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) ++ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) + target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) + endif() + +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -301,9 +301,6 @@ if(BUILD_LAYERS) + if(INSTRUMENT_OPTICK) + target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) + endif() +- if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) +- endif() + target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.204.1-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.204.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..319efad89dcde6 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.204.1-0001-fix-cmake.patch @@ -0,0 +1,31 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,7 +122,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -174,7 +174,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.224.1-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.224.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..76ce4f2ef3df39 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.224.1-0001-fix-cmake.patch @@ -0,0 +1,31 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,7 +122,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -174,7 +174,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -63,7 +63,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_DEFAULT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) + else() diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0001-fix-cmake.patch new file mode 100644 index 00000000000000..dc7286044497fb --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0001-fix-cmake.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -103,7 +103,7 @@ if (GOOGLETEST_INSTALL_DIR) + list(APPEND CMAKE_PREFIX_PATH ${GOOGLETEST_INSTALL_DIR}) + endif() + +-find_package(VulkanHeaders REQUIRED) ++find_package(VulkanHeaders REQUIRED MODULE) + add_library(Vulkan-Headers INTERFACE) + target_include_directories(Vulkan-Headers INTERFACE ${VulkanHeaders_INCLUDE_DIRS}) + add_library(Vulkan::Headers ALIAS Vulkan-Headers) +@@ -229,7 +229,6 @@ if(BUILD_LAYERS OR BUILD_TESTS) + endif() + + # VVLGenerateSourceCode depends on spirv/unified1 +- include(VVLGenerateSourceCode) + + if (NOT TARGET SPIRV-Tools-opt) + find_package(SPIRV-Tools-opt REQUIRED CONFIG) +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -63,7 +63,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_DEFAULT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) + else() 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-0002-cmake-no-werror.patch similarity index 100% rename from recipes/vulkan-validationlayers/all/patches/1.3.231.1-cmake-no-werror.patch rename to recipes/vulkan-validationlayers/all/patches/1.3.231.1-0002-cmake-no-werror.patch diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.236.0-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.236.0-0001-fix-cmake.patch new file mode 100644 index 00000000000000..f63003f30dac55 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.236.0-0001-fix-cmake.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -230,7 +230,6 @@ endif() + if(BUILD_LAYERS OR BUILD_TESTS) + find_package(SPIRV-Headers REQUIRED CONFIG QUIET) + +- include(VVLGenerateSourceCode) + + find_package(SPIRV-Tools-opt REQUIRED CONFIG QUIET) + diff --git a/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt b/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt index 29405b4177fbec..f968d5c77f9777 100644 --- a/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt +++ b/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(vulkan-validationlayers REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE vulkan-validationlayers::vulkan-validationlayers) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(vulkan-validationlayers_VERSION VERSION_GREATER_EQUAL "1.3.235") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() diff --git a/recipes/vulkan-validationlayers/config.yml b/recipes/vulkan-validationlayers/config.yml index cc5317034e1207..8da325f5c1293b 100644 --- a/recipes/vulkan-validationlayers/config.yml +++ b/recipes/vulkan-validationlayers/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.236.0": + folder: all "1.3.231.1": folder: all "1.3.224.1": @@ -15,5 +17,3 @@ versions: folder: all "1.2.182": folder: all - "1.2.154.0": - folder: all diff --git a/recipes/wasmtime/all/conandata.yml b/recipes/wasmtime/all/conandata.yml index a30b87d1de7eb5..ebf6258c632da3 100644 --- a/recipes/wasmtime/all/conandata.yml +++ b/recipes/wasmtime/all/conandata.yml @@ -1,4 +1,34 @@ sources: + "4.0.0": + Windows: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-windows-c-api.zip" + sha256: "b2874ab0e2f7588dacef433bd1f9c4cd958243ef4cbbc5886b328cd14eab5d48" + MinGW: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-mingw-c-api.zip" + sha256: "68c0a5fccdd875c0d653110af94bceb2d8e35b0d836f8784bccea2d5b5b88108" + Linux: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-linux-c-api.tar.xz" + sha256: "174166c8c2294d66844fe9736543e9edc8a28ff8db18b26e8b74f5a27024f8c5" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-aarch64-linux-c-api.tar.xz" + sha256: "f3017e9272068a264234efec5df822b619299e138bd2fdab2eca43c73d8e7d26" + "s390x": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-s390x-linux-c-api.tar.xz" + sha256: "9243404037187900ed85188744d28501c786abba1098a933a8c80363d3763350" + Macos: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-macos-c-api.tar.xz" + sha256: "41d0d2fd9c9942f0b00eac3da6ddfaca5a660a61c6220bc608d2e15d5adfbdd4" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-aarch64-macos-c-api.tar.xz" + sha256: "2761ee87f265e520a2ed1d82188c958f5dc244ad6fed94a80f6af33f705a320d" + Android: + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-aarch64-linux-c-api.tar.xz" + sha256: "f3017e9272068a264234efec5df822b619299e138bd2fdab2eca43c73d8e7d26" "3.0.0": Windows: "x86_64": diff --git a/recipes/wasmtime/config.yml b/recipes/wasmtime/config.yml index 30c740d2e0859f..77c35aceade8ed 100644 --- a/recipes/wasmtime/config.yml +++ b/recipes/wasmtime/config.yml @@ -1,4 +1,6 @@ versions: + "4.0.0": + folder: all "3.0.0": folder: all "2.0.0": diff --git a/recipes/watcher/all/conandata.yml b/recipes/watcher/all/conandata.yml index 93e1e2ddd653fd..5edbc5be3e8cd8 100644 --- a/recipes/watcher/all/conandata.yml +++ b/recipes/watcher/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.5.5": + url: "https://github.com/e-dant/watcher/archive/release/0.5.4.tar.gz" + sha256: "0dac1d89886252bb0b999c2dad85aff283022a2b4393922a993459b180b8c663" + "0.5.4": + url: "https://github.com/e-dant/watcher/archive/release/0.5.4.tar.gz" + sha256: "0dac1d89886252bb0b999c2dad85aff283022a2b4393922a993459b180b8c663" "0.5.2": url: "https://github.com/e-dant/watcher/archive/release/0.5.2.tar.gz" sha256: "e18e663f9a72a59fca3e7a9e125ca77823b03a3388aa569398965777c5671173" diff --git a/recipes/watcher/all/conanfile.py b/recipes/watcher/all/conanfile.py index 583d57f7ba78b5..2aa7718f44b002 100644 --- a/recipes/watcher/all/conanfile.py +++ b/recipes/watcher/all/conanfile.py @@ -3,7 +3,6 @@ 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 @@ -28,6 +27,8 @@ def _compilers_minimum_version(self): "gcc": "11", "clang": "13", "apple-clang": "13.1", + "Visual Studio": "16", + "msvc": "192", } def export_sources(self): @@ -42,7 +43,6 @@ def package_id(self): 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(".")] diff --git a/recipes/watcher/config.yml b/recipes/watcher/config.yml index 8e8a861574ec08..363df7be271c25 100644 --- a/recipes/watcher/config.yml +++ b/recipes/watcher/config.yml @@ -1,4 +1,8 @@ versions: + "0.5.5": + folder: all + "0.5.4": + folder: all "0.5.2": folder: all "0.4.3": diff --git a/recipes/wayland-protocols/all/conandata.yml b/recipes/wayland-protocols/all/conandata.yml index 57bce2d3e5da6a..1caa67f91c85d5 100644 --- a/recipes/wayland-protocols/all/conandata.yml +++ b/recipes/wayland-protocols/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.31": + url: "https://github.com/wayland-project/wayland-protocols/archive/1.31.tar.gz" + sha256: "04d3f66eca99d638ec8dbfdfdf79334290e22028f7d0b04c7034d9ef18a3248a" "1.27": url: "https://github.com/wayland-project/wayland-protocols/archive/1.27.tar.gz" sha256: "6dd6ee86478adf4347f3b8b4f3da62dbe9e44912c9cef21cf99abfe692313df4" diff --git a/recipes/wayland-protocols/all/conanfile.py b/recipes/wayland-protocols/all/conanfile.py index a31c28b9bbce55..d2ce51903263dd 100644 --- a/recipes/wayland-protocols/all/conanfile.py +++ b/recipes/wayland-protocols/all/conanfile.py @@ -27,7 +27,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.0.0") def layout(self): basic_layout(self, src_folder="src") diff --git a/recipes/wayland-protocols/all/test_package/conanfile.py b/recipes/wayland-protocols/all/test_package/conanfile.py index 37e15e8b2c559e..19d2d810117117 100644 --- a/recipes/wayland-protocols/all/test_package/conanfile.py +++ b/recipes/wayland-protocols/all/test_package/conanfile.py @@ -20,7 +20,7 @@ def requirements(self): self.requires("wayland/1.21.0") def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.0.0") 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") diff --git a/recipes/wayland-protocols/all/test_v1_package/conanfile.py b/recipes/wayland-protocols/all/test_v1_package/conanfile.py index 1edcdad3ee8ef6..37376c21380771 100644 --- a/recipes/wayland-protocols/all/test_v1_package/conanfile.py +++ b/recipes/wayland-protocols/all/test_v1_package/conanfile.py @@ -10,7 +10,7 @@ class TestPackageConan(ConanFile): def build_requirements(self): self.build_requires("wayland/1.21.0") - self.build_requires("meson/0.64.1") + self.build_requires("meson/1.0.0") def requirements(self): self.requires("wayland/1.21.0") diff --git a/recipes/wayland-protocols/config.yml b/recipes/wayland-protocols/config.yml index 5a8aa4a9bbac3b..81aded41c98221 100644 --- a/recipes/wayland-protocols/config.yml +++ b/recipes/wayland-protocols/config.yml @@ -1,4 +1,6 @@ versions: + "1.31": + folder: all "1.27": folder: all "1.26": diff --git a/recipes/wayland/all/conanfile.py b/recipes/wayland/all/conanfile.py index 69f0aecd1c118b..ded4c6dd57c883 100644 --- a/recipes/wayland/all/conanfile.py +++ b/recipes/wayland/all/conanfile.py @@ -54,7 +54,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.0.0") 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): diff --git a/recipes/winflexbison/all/conanfile.py b/recipes/winflexbison/all/conanfile.py index 5bec8a823d53f5..96dfb9c1906e92 100644 --- a/recipes/winflexbison/all/conanfile.py +++ b/recipes/winflexbison/all/conanfile.py @@ -1,10 +1,10 @@ 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, get, rename, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, save import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class WinflexbisonConan(ConanFile): @@ -17,19 +17,20 @@ class WinflexbisonConan(ConanFile): settings = "os", "arch", "compiler", "build_type" 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) - - def validate(self): - if self.info.settings.os != "Windows": - raise ConanInvalidConfiguration("winflexbison is only supported on Windows.") + export_conandata_patches(self) def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + del self.info.settings.compiler + + def validate(self): + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("winflexbison is only supported on Windows.") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -84,8 +85,6 @@ def package_info(self): self.buildenv_info.define_path("YACC", yacc_path) # TODO: to remove in conan v2 - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) self.env_info.LEX = lex_path self.env_info.YACC = yacc_path diff --git a/recipes/winflexbison/all/test_package/conanfile.py b/recipes/winflexbison/all/test_package/conanfile.py index be1250f9b3a7bb..30f93d42368f95 100644 --- a/recipes/winflexbison/all/test_package/conanfile.py +++ b/recipes/winflexbison/all/test_package/conanfile.py @@ -7,23 +7,23 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" - - def build_requirements(self): - self.tool_requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): + self.run("win_flex --version") + self.run("win_bison --version") if not cross_building(self): - self.run("win_flex --version", env="conanbuild") - self.run("win_bison --version", env="conanbuild") - bison_test = os.path.join(self.cpp.build.bindirs[0], "bison_test_package") self.run(bison_test, env="conanrun") flex_test = os.path.join(self.cpp.build.bindirs[0], "flex_test_package") diff --git a/recipes/winflexbison/all/test_v1_package/CMakeLists.txt b/recipes/winflexbison/all/test_v1_package/CMakeLists.txt index 94d419f8a1bddd..0d20897301b68b 100644 --- a/recipes/winflexbison/all/test_v1_package/CMakeLists.txt +++ b/recipes/winflexbison/all/test_v1_package/CMakeLists.txt @@ -1,54 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES C CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -# Flex - -set(FLEX_TARGET_COMPILE_FLAGS "") -if(MSVC) - set(FLEX_TARGET_COMPILE_FLAGS "--wincompat") -endif() - -find_package(FLEX REQUIRED) -set(FLEX_VARS - FLEX_FOUND - FLEX_EXECUTABLE - FLEX_LIBRARIES - FLEX_INCLUDE_DIRS -) - -foreach(FLEX_VAR ${FLEX_VARS}) - message("${FLEX_VAR}: ${${FLEX_VAR}}") - if(NOT ${FLEX_VAR}) - message(WARNING "${FLEX_VAR} NOT FOUND") - endif() -endforeach() - -FLEX_TARGET(TestParser ../test_package/basic_nr.l "${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp" COMPILE_FLAGS "${FLEX_TARGET_COMPILE_FLAGS}") -add_executable(flex_test_package ${FLEX_TestParser_OUTPUTS}) -target_compile_features(flex_test_package PRIVATE cxx_std_11) - -# Bison - -find_package(BISON) - -set(BISON_VARS - BISON_FOUND - BISON_EXECUTABLE - BISON_VERSION -) - -foreach(BISON_VAR ${BISON_VARS}) - message("${BISON_VAR}: ${${BISON_VAR}}") - if(NOT ${BISON_VAR}) - message(WARNING "${BISON_VAR} NOT FOUND") - endif() -endforeach() - -bison_target(bison_parser_target ../test_package/mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp") - -add_executable(bison_test_package "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp" ../test_package/dummy_lex.c) -target_compile_features(bison_test_package PRIVATE cxx_std_11) -target_include_directories(bison_test_package PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/winflexbison/all/test_v1_package/conanfile.py b/recipes/winflexbison/all/test_v1_package/conanfile.py index 41351eeed660f8..744b30cd87048c 100644 --- a/recipes/winflexbison/all/test_v1_package/conanfile.py +++ b/recipes/winflexbison/all/test_v1_package/conanfile.py @@ -5,19 +5,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake" + test_type = "explicit" + + def build_requirements(self): + self.build_requires(self.tested_reference_str) def build(self): - if not tools.cross_building(self, skip_x64_x86=True): - with tools.run_environment(self): - cmake = CMake(self) - cmake.configure() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): + self.run("win_flex --version") + self.run("win_bison --version") if not tools.cross_building(self, skip_x64_x86=True): - self.run("win_flex --version", run_environment=True) - self.run("win_bison --version", run_environment=True) - bison_test = os.path.join("bin", "bison_test_package") self.run(bison_test, run_environment=True) flex_test = os.path.join("bin", "flex_test_package") diff --git a/recipes/xkbcommon/all/conandata.yml b/recipes/xkbcommon/all/conandata.yml index eb163931d34012..dcff369379c64c 100644 --- a/recipes/xkbcommon/all/conandata.yml +++ b/recipes/xkbcommon/all/conandata.yml @@ -1,16 +1,13 @@ sources: + "1.5.0": + url: "https://xkbcommon.org/download/libxkbcommon-1.5.0.tar.xz" + sha256: "560f11c4bbbca10f495f3ef7d3a6aa4ca62b4f8fb0b52e7d459d18a26e46e017" "1.4.1": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.4.1.tar.gz" sha256: "3b86670dd91441708dedc32bc7f684a034232fd4a9bb209f53276c9783e9d40e" - "1.4.0": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.4.0.tar.gz" - sha256: "51b5a732d6d6976da9d52b8f136850c193c68a31a9bdf28965a81cf8e62e919e" "1.3.1": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.3.1.tar.gz" sha256: "8eda6782c6ed4b83296521f2f7e6bea88aba76d49c39fb4fce0f8d355a9181ce" - "1.3.0": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.3.0.tar.gz" - sha256: "e1b79838256549d72f42c824f720b4f14603374cfbe5587942e35a0cbb13ff9e" "1.2.1": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.2.1.tar.gz" sha256: "50684541c11686203650f6ac8fe9b4b0343158fb7c54fbb0c86147f1ff5a5dbc" @@ -20,9 +17,6 @@ sources: "1.0.3": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.0.3.tar.gz" sha256: "5d10a57ab65daad7d975926166770eca1d2c899131ab96c23845df1c42da5c31" - "1.0.1": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.0.1.tar.gz" - sha256: "270e2ad4ce5699f633e49042114cb68a5697fa1ed45b65c1d96a833cfac20954" "0.10.0": url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-0.10.0.tar.gz" sha256: "9b4635cf5d9fc0fb9611ceec1780aafc0944299e9a29ab09c18ec2633923b9c3" diff --git a/recipes/xkbcommon/all/conanfile.py b/recipes/xkbcommon/all/conanfile.py index 7b84051dc4c69d..496e5461699444 100644 --- a/recipes/xkbcommon/all/conanfile.py +++ b/recipes/xkbcommon/all/conanfile.py @@ -10,7 +10,7 @@ from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.53.0" class XkbcommonConan(ConanFile): @@ -52,18 +52,9 @@ def config_options(self): 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 + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def requirements(self): self.requires("xkeyboard-config/system") @@ -81,7 +72,7 @@ def validate(self): raise ConanInvalidConfiguration(f"{self.ref} is only compatible with Linux and FreeBSD") def build_requirements(self): - self.tool_requires("meson/0.64.1") + self.tool_requires("meson/1.0.0") 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") @@ -120,6 +111,12 @@ def build(self): if self.options.get_safe("with_wayland"): meson_build_file = os.path.join(self.source_folder, "meson.build") # Patch the build system to use the pkg-config files generated for the build context. + + if Version(self.version) >= "1.5.0": + get_pkg_config_var = "get_variable(pkgconfig: " + else: + get_pkg_config_var = "get_pkgconfig_variable(" + if self._has_build_profile: replace_in_file(self, meson_build_file, "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", @@ -137,7 +134,7 @@ def build(self): "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'))", + f"wayland_scanner = find_program(wayland_scanner_dep.{get_pkg_config_var}'wayland_scanner'))", "wayland_scanner = find_program('wayland-scanner')") meson = Meson(self) diff --git a/recipes/xkbcommon/all/test_package/CMakeLists.txt b/recipes/xkbcommon/all/test_package/CMakeLists.txt index 0b0b6cb9fe82d0..713779fc019238 100644 --- a/recipes/xkbcommon/all/test_package/CMakeLists.txt +++ b/recipes/xkbcommon/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES CXX) find_package(xkbcommon REQUIRED COMPONENTS libxkbcommon) diff --git a/recipes/xkbcommon/all/test_package/conanfile.py b/recipes/xkbcommon/all/test_package/conanfile.py index b521c572cd6837..0bd86fa64260a5 100644 --- a/recipes/xkbcommon/all/test_package/conanfile.py +++ b/recipes/xkbcommon/all/test_package/conanfile.py @@ -2,8 +2,7 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake -from conan.tools.layout import cmake_layout +from conan.tools.cmake import CMake, cmake_layout class TestPackageConan(ConanFile): diff --git a/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt b/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt index 578486105d7d3b..925ecbe19e448d 100644 --- a/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt +++ b/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/xkbcommon/all/test_v1_package/conanfile.py b/recipes/xkbcommon/all/test_v1_package/conanfile.py index e49d2fb75e7048..e9bf8aa5f82dd0 100644 --- a/recipes/xkbcommon/all/test_v1_package/conanfile.py +++ b/recipes/xkbcommon/all/test_v1_package/conanfile.py @@ -6,7 +6,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) diff --git a/recipes/xkbcommon/config.yml b/recipes/xkbcommon/config.yml index b1ae06a7c3ea80..aa62b1dc6f7812 100644 --- a/recipes/xkbcommon/config.yml +++ b/recipes/xkbcommon/config.yml @@ -1,19 +1,15 @@ versions: - "1.4.1": + "1.5.0": folder: all - "1.4.0": + "1.4.1": folder: all "1.3.1": folder: all - "1.3.0": - folder: all "1.2.1": folder: all "1.1.0": folder: all "1.0.3": folder: all - "1.0.1": - folder: all "0.10.0": folder: all diff --git a/recipes/xkeyboard-config/all/conanfile.py b/recipes/xkeyboard-config/all/conanfile.py index a9f2fc053956cc..ec1b8c4a6f2edc 100644 --- a/recipes/xkeyboard-config/all/conanfile.py +++ b/recipes/xkeyboard-config/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.system import package_manager from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class XkeyboardConfigConan(ConanFile): @@ -20,7 +20,7 @@ def validate(self): raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): - self.info.header_only() + self.info.clear() def system_requirements(self): apt = package_manager.Apt(self) diff --git a/recipes/xorg/all/conanfile.py b/recipes/xorg/all/conanfile.py index 6182a830106182..f4ca0dad278fac 100644 --- a/recipes/xorg/all/conanfile.py +++ b/recipes/xorg/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.system import package_manager from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class XorgConan(ConanFile): @@ -20,7 +20,7 @@ def validate(self): raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): - self.info.header_only() + self.info.clear() def system_requirements(self): apt = package_manager.Apt(self) diff --git a/recipes/xorg/all/test_package/conanfile.py b/recipes/xorg/all/test_package/conanfile.py index 603eba58719ec2..f414ecd075ee74 100644 --- a/recipes/xorg/all/test_package/conanfile.py +++ b/recipes/xorg/all/test_package/conanfile.py @@ -2,9 +2,8 @@ from conan import ConanFile from conan.tools.build import cross_building -from conan.tools.cmake import CMake +from conan.tools.cmake import CMake, cmake_layout from conan.tools.gnu import PkgConfigDeps -from conan.tools.layout import cmake_layout class TestPackageConan(ConanFile): diff --git a/recipes/xtensor/all/conanfile.py b/recipes/xtensor/all/conanfile.py index 52e5e886788308..8d9d0a5f992157 100644 --- a/recipes/xtensor/all/conanfile.py +++ b/recipes/xtensor/all/conanfile.py @@ -56,7 +56,7 @@ def requirements(self): if Version(self.version) < "0.24.0": self.requires("xsimd/7.5.0") else: - self.requires("xsimd/9.0.1") + self.requires("xsimd/10.0.0") if self.options.tbb: self.requires("onetbb/2021.7.0") diff --git a/recipes/xxhash/all/conandata.yml b/recipes/xxhash/all/conandata.yml index e7a7396a165a66..a0b4d68deb6b49 100644 --- a/recipes/xxhash/all/conandata.yml +++ b/recipes/xxhash/all/conandata.yml @@ -8,3 +8,10 @@ sources: patches: "0.8.1": - patch_file: "patches/0.8.1-fix-cmakelists.patch" + patch_description: "Update CMakeLists.txt to properly install manuals" + patch_type: conan + + - patch_file: "patches/0.8.1-fix-static-assert-link-error.patch" + patch_source: "https://github.com/Cyan4973/xxHash/commit/6189ecd3d44a693460f86280ccf49d33cb4b18e1" + patch_description: "Backport fix for link error" + patch_type: bugfix diff --git a/recipes/xxhash/all/patches/0.8.1-fix-static-assert-link-error.patch b/recipes/xxhash/all/patches/0.8.1-fix-static-assert-link-error.patch new file mode 100644 index 00000000000000..82773a37fe366f --- /dev/null +++ b/recipes/xxhash/all/patches/0.8.1-fix-static-assert-link-error.patch @@ -0,0 +1,14 @@ +diff --git a/xxhash.h b/xxhash.h +index 08ab794..511c4d1 100644 +--- a/xxhash.h ++++ b/xxhash.h +@@ -1546,8 +1546,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) + /* note: use after variable declarations */ + #ifndef XXH_STATIC_ASSERT + # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ +-# include +-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) ++# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { _Static_assert((c),m); } while(0) + # elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */ + # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) + # else diff --git a/recipes/xz_utils/all/conandata.yml b/recipes/xz_utils/all/conandata.yml index c91700d02c91bc..ef364b8d899803 100644 --- a/recipes/xz_utils/all/conandata.yml +++ b/recipes/xz_utils/all/conandata.yml @@ -1,7 +1,18 @@ sources: + "5.4.0": + url: "https://tukaani.org/xz/xz-5.4.0.tar.gz" + sha256: "7471ef5991f690268a8f2be019acec2e0564b7b233ca40035f339fe9a07f830b" + "5.2.10": + url: "https://tukaani.org/xz/xz-5.2.10.tar.gz" + sha256: "eb7a3b2623c9d0135da70ca12808a214be9c019132baaa61c9e1d198d1d9ded3" "5.2.5": url: "https://tukaani.org/xz/xz-5.2.5.tar.gz" sha256: "f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10" "5.2.4": url: "https://tukaani.org/xz/xz-5.2.4.tar.gz" sha256: "b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145" +patches: + "5.2.4": + - patch_file: "patches/0001-relax_windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" diff --git a/recipes/xz_utils/all/conanfile.py b/recipes/xz_utils/all/conanfile.py index 6c9f4438989260..fe3bbefd8b9d09 100644 --- a/recipes/xz_utils/all/conanfile.py +++ b/recipes/xz_utils/all/conanfile.py @@ -1,19 +1,18 @@ from conan import ConanFile -from conan.errors import ConanException from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import VirtualBuildEnv -from conan.tools.files import collect_libs, copy, get, rename, replace_in_file, rm, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir, save 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, MSBuild, MSBuildToolchain, unix_path +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuild, MSBuildToolchain from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.52.0" +required_conan_version = ">=1.54.0" -class XZUtils(ConanFile): +class XZUtilsConan(ConanFile): name = "xz_utils" description = ( "XZ Utils is free general-purpose data compression software with a high " @@ -48,30 +47,31 @@ def _effective_msbuild_type(self): "MT" if is_msvc_static_runtime(self) and self.settings.build_type != "Debug" else "", ) + @property + def _msbuild_target(self): + return "liblzma_dll" if self.options.shared else "liblzma" + + 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: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): basic_layout(self, src_folder="src") def build_requirements(self): if self._settings_build.os == "Windows" and not is_msvc(self): - if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): - self.tool_requires("msys2/cci.latest") self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -80,92 +80,60 @@ def source(self): def generate(self): if is_msvc(self): tc = MSBuildToolchain(self) + tc.configuration = self._effective_msbuild_type tc.generate() else: + env = VirtualBuildEnv(self) + env.generate() tc = AutotoolsToolchain(self) tc.configure_args.append("--disable-doc") if self.settings.build_type == "Debug": tc.configure_args.append("--enable-debug") tc.generate() - env = VirtualBuildEnv(self) - env.generate() - def _fix_msvc_platform_toolset(self, vcxproj_file, old_toolset): - platform_toolset = { - "Visual Studio": { - "8": "v80", - "9": "v90", - "10": "v100", - "11": "v110", - "12": "v120", - "14": "v140", - "15": "v141", - "16": "v142", - "17": "v143", - }, - "msvc": { - "170": "v110", - "180": "v120", - "190": "v140", - "191": "v141", - "192": "v142", - "193": "v143", - } - }.get(str(self.settings.compiler), {}).get(str(self.settings.compiler.version)) - if not platform_toolset: - raise ConanException( - f"Unkown platform toolset for {self.settings.compiler} {self.settings.compiler.version}", - ) - replace_in_file( - self, - vcxproj_file, - f"{old_toolset}", - f"{platform_toolset}", - ) + @property + def _msvc_sln_folder(self): + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler) >= "191"): + return "vs2017" + return "vs2013" def _build_msvc(self): - if Version(self.version) == "5.2.4": - # Relax Windows SDK restriction - # Workaround is required only for 5.2.4 because since 5.2.5 WindowsTargetPlatformVersion is dropped from vcproj file - # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html - windows_target_platform_version_old = "10.0.15063.0" - replace_in_file(self, os.path.join(self.source_folder, "windows", "vs2017", "liblzma.vcxproj"), - windows_target_platform_version_old, "") - replace_in_file(self, os.path.join(self.source_folder, "windows", "vs2017", "liblzma_dll.vcxproj"), - windows_target_platform_version_old, "") - - # TODO: Find a way to inject conantoolchain.props content from MSBuildToolchain - # For the moment all the logic below is a big trick & doesn't honor custom cflags, cxxflags & ldflags from profile - # and arch different than x86 & x86_64 - - # windows\INSTALL-MSVC.txt - if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ - (self.settings.compiler == "msvc" and Version(self.settings.compiler) >= "191"): - msvc_version = "vs2017" + build_script_folder = os.path.join(self.source_folder, "windows", self._msvc_sln_folder) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client. + vcxproj_files = [ + os.path.join(build_script_folder, "liblzma.vcxproj"), + os.path.join(build_script_folder, "liblzma_dll.vcxproj"), + ] + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler) >= "191"): old_toolset = "v141" else: - msvc_version = "vs2013" old_toolset = "v120" - build_script_folder = os.path.join(self.source_folder, "windows", msvc_version) - - # TODO: replace by some conan helper function (https://github.com/conan-io/conan/issues/12155)? - liblzma_vcxproj = os.path.join(build_script_folder, "liblzma.vcxproj") - liblzma_dll_vcxproj = os.path.join(build_script_folder, "liblzma_dll.vcxproj") - self._fix_msvc_platform_toolset(liblzma_vcxproj, old_toolset) - self._fix_msvc_platform_toolset(liblzma_dll_vcxproj, old_toolset) - - # Patch Debug configuration if runtime is MT since there is no DebugMT configuration in upstream vcxproj - if self.settings.build_type == "Debug" and is_msvc_static_runtime(self): - replace_in_file(self, liblzma_vcxproj, "MultiThreadedDebugDLL", "MultiThreadedDebug") - replace_in_file(self, liblzma_dll_vcxproj, "MultiThreadedDebugDLL", "MultiThreadedDebug") + new_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + f"{old_toolset}", + f"{new_toolset}", + ) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + #============================== - target = "liblzma_dll" if self.options.shared else "liblzma" msbuild = MSBuild(self) msbuild.build_type = self._effective_msbuild_type msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform - msbuild.build(os.path.join(build_script_folder, "xz_win.sln"), targets=[target]) + msbuild.build(os.path.join(build_script_folder, "xz_win.sln"), targets=[self._msbuild_target]) def build(self): + apply_conandata_patches(self) if is_msvc(self): self._build_msvc() else: @@ -177,25 +145,15 @@ def package(self): copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): inc_dir = os.path.join(self.source_folder, "src", "liblzma", "api") - copy(self, "*.h", src=inc_dir, dst=os.path.join(self.package_folder, "include"), keep_path=True) - arch = {"x86": "Win32", "x86_64": "x64"}.get(str(self.settings.arch)) - target = "liblzma_dll" if self.options.shared else "liblzma" - if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ - (self.settings.compiler == "msvc" and Version(self.settings.compiler) >= "191"): - msvc_version = "vs2017" - else: - msvc_version = "vs2013" - bin_dir = os.path.join(self.source_folder, "windows", msvc_version, - self._effective_msbuild_type, arch, target) - copy(self, "*.lib", src=bin_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) - if self.options.shared: - copy(self, "*.dll", src=bin_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.h", src=inc_dir, dst=os.path.join(self.package_folder, "include")) + output_dir = os.path.join(self.source_folder, "windows") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) rename(self, os.path.join(self.package_folder, "lib", "liblzma.lib"), os.path.join(self.package_folder, "lib", "lzma.lib")) else: 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)}"]) + autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "share")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) @@ -232,14 +190,13 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "LibLZMA::LibLZMA") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.set_property("pkg_config_name", "liblzma") + self.cpp_info.libs = ["lzma"] if not self.options.shared: self.cpp_info.defines.append("LZMA_API_STATIC") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - self.cpp_info.libs = collect_libs(self) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "LibLZMA" self.cpp_info.names["cmake_find_package_multi"] = "LibLZMA" self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.names["pkg_config"] = "liblzma" diff --git a/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch b/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch new file mode 100644 index 00000000000000..d9680984def658 --- /dev/null +++ b/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/windows/vs2017/liblzma.vcxproj ++++ b/windows/vs2017/liblzma.vcxproj +@@ -29,7 +29,6 @@ + + {12728250-16EC-4DC6-94D7-E21DD88947F8} + Win32Proj +- 10.0.15063.0 + + + +--- a/windows/vs2017/liblzma_dll.vcxproj ++++ b/windows/vs2017/liblzma_dll.vcxproj +@@ -29,7 +29,6 @@ + + {E0F247DB-EF12-4755-8DF9-F74BCD1348F7} + Win32Proj +- 10.0.15063.0 + + + diff --git a/recipes/xz_utils/all/test_v1_package/CMakeLists.txt b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt index 971f2caf78d9a1..0d20897301b68b 100644 --- a/recipes/xz_utils/all/test_v1_package/CMakeLists.txt +++ b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt @@ -1,29 +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(LibLZMA REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE LibLZMA::LibLZMA) - -# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibLZMA.html -# are properly defined in conan generators -set(_custom_vars - LIBLZMA_FOUND - LIBLZMA_INCLUDE_DIRS - LIBLZMA_LIBRARIES - LIBLZMA_VERSION_MAJOR - LIBLZMA_VERSION_MINOR - LIBLZMA_VERSION_PATCH - LIBLZMA_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() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xz_utils/config.yml b/recipes/xz_utils/config.yml index 4afb08d7749cba..908e8205eebe4e 100644 --- a/recipes/xz_utils/config.yml +++ b/recipes/xz_utils/config.yml @@ -1,4 +1,8 @@ versions: + "5.4.0": + folder: all + "5.2.10": + folder: all "5.2.5": folder: all "5.2.4": diff --git a/recipes/yaclib/all/conandata.yml b/recipes/yaclib/all/conandata.yml new file mode 100644 index 00000000000000..4a51c82916ec82 --- /dev/null +++ b/recipes/yaclib/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + '2022.10.31': + url: 'https://github.com/YACLib/YACLib/archive/refs/tags/v2022.10.31.tar.gz' + sha256: '81761b1c8e53e6eaeb36fa00183cae66068b85d24c910c0584d0b29b371e143c' +patches: + '2022.10.31': + - patch_file: 'patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch' + patch_description: 'Set 17 standard if not stated otherwise' + patch_type: 'conan' + - patch_file: 'patches/0002-Add-install-commands.patch' + patch_description: 'Add install commands' + patch_type: 'conan' diff --git a/recipes/yaclib/all/conanfile.py b/recipes/yaclib/all/conanfile.py new file mode 100644 index 00000000000000..9c4ce332ffd74a --- /dev/null +++ b/recipes/yaclib/all/conanfile.py @@ -0,0 +1,114 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.scm import Version +from conan.tools.files import copy, get, export_conandata_patches, apply_conandata_patches +from conan.tools.layout import cmake_layout +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + + +class YACLibConan(ConanFile): + name = "yaclib" + description = "lightweight C++ library for concurrent and parallel task execution" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/YACLib/YACLib" + license = "MIT" + topics = ("async", "parallel", "concurrency") + settings = "os", "arch", "compiler", "build_type" + + _yaclib_flags = { + "warn": [True, False], + "coro": [True, False], + "disable_futex": [True, False], + "disable_unsafe_futex": [True, False], + "disable_symmetric_transfer": [True, False], + "disable_final_suspend_transfer": [True, False], + } + + options = { + "fPIC": [True, False], + **_yaclib_flags, + } + + default_options = { + "fPIC": True, + **{k: False for k in _yaclib_flags}, + } + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "Visual Studio": "14.20", + "msvc": "192", + "clang": "8", + "apple-clang": "12", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables['YACLIB_INSTALL'] = True + if self.settings.compiler.get_safe("cppstd"): + tc.variables["YACLIB_CXX_STANDARD"] = self.settings.compiler.cppstd + + flags = [] + for flag in self._yaclib_flags: + if self.options.get_safe(flag): + flags.append(flag.upper()) + + if flags: + tc.variables["YACLIB_FLAGS"] = ";".join(flags) + + tc.generate() + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def validate(self): + required_cpp_standard = 20 if self.options.coro else 17 + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, required_cpp_standard) + else: + if self._compilers_minimum_version.get(str(self.settings.compiler)): + if Version(self.settings.compiler.version) < self._compilers_minimum_version.get(str(self.settings.compiler)): + raise ConanInvalidConfiguration( + f"yaclib requires a compiler supporting c++{required_cpp_standard}") + else: + self.output.warn( + f"yaclib recipe does not recognize the compiler. yaclib requires a compiler supporting c++{required_cpp_standard}. Assuming it does.") + + 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) + 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() + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "yaclib") + self.cpp_info.set_property("cmake_target_name", "yaclib") + self.cpp_info.set_property("pkg_config_name", "yaclib") + self.cpp_info.libs = ["yaclib"] + if self.options.get_safe("coro"): + if self.settings.compiler.libcxx == "libstdc++11": + self.cpp_info.cxxflags.append("-fcoroutines") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/yaclib/all/patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch b/recipes/yaclib/all/patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch new file mode 100644 index 00000000000000..4bdeb1041a9287 --- /dev/null +++ b/recipes/yaclib/all/patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 13c28b2..53cbb9b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,6 +14,12 @@ endif () + + if (YACLIB_CXX_STANDARD) + set(CMAKE_CXX_STANDARD ${YACLIB_CXX_STANDARD}) ++elseif (NOT CORO IN_LIST YACLIB_FLAGS) ++ message("Set default standard to c++17") ++ set(CMAKE_CXX_STANDARD 17) ++else () ++message("Set default standard to c++20") ++ set(CMAKE_CXX_STANDARD 20) + endif () + + set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/recipes/yaclib/all/patches/0002-Add-install-commands.patch b/recipes/yaclib/all/patches/0002-Add-install-commands.patch new file mode 100644 index 00000000000000..8e97ed67b0c962 --- /dev/null +++ b/recipes/yaclib/all/patches/0002-Add-install-commands.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 53cbb9b..ca46fe1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,6 +32,13 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + list(APPEND CMAKE_MODULE_PATH "${YACLIB_SOURCE_DIR}/cmake") + include(yaclib_flags) + ++if (YACLIB_INSTALL) ++ include(GNUInstallDirs) ++ install(DIRECTORY ${YACLIB_SOURCE_DIR}/include/yaclib TYPE INCLUDE) ++ install(DIRECTORY ${YACLIB_SOURCE_DIR}/include/yaclib_std TYPE INCLUDE) ++ install(DIRECTORY ${YACLIB_BINARY_DIR}/include/yaclib TYPE INCLUDE) ++endif() ++ + add_subdirectory(src) # Create static library + + if (YACLIB_TEST) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index c3d624f..80715cb 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -56,3 +56,7 @@ target_include_directories(yaclib + PUBLIC ${YACLIB_BINARY_DIR}/include # for config.hpp + PRIVATE ${YACLIB_SOURCE_DIR}/src + ) ++ ++if (YACLIB_INSTALL) ++ install(TARGETS yaclib) ++endif () diff --git a/recipes/yaclib/all/test_package/CMakeLists.txt b/recipes/yaclib/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..219058ab228202 --- /dev/null +++ b/recipes/yaclib/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) + +project(TestPackage LANGUAGES CXX) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_CXX_STANDARD 20) + +find_package(yaclib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE yaclib) diff --git a/recipes/yaclib/all/test_package/conanfile.py b/recipes/yaclib/all/test_package/conanfile.py new file mode 100644 index 00000000000000..6fa6864719164c --- /dev/null +++ b/recipes/yaclib/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): + test_type = 'explicit' + generators = 'CMakeDeps', 'CMakeToolchain', 'VirtualRunEnv' + settings = 'os', 'arch', 'compiler', 'build_type' + + 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], 'TestPackage') + self.run(bin_path, env="conanrun") diff --git a/recipes/yaclib/all/test_package/main.cpp b/recipes/yaclib/all/test_package/main.cpp new file mode 100644 index 00000000000000..d834e92b5b3cf6 --- /dev/null +++ b/recipes/yaclib/all/test_package/main.cpp @@ -0,0 +1,25 @@ +#include + +#include "yaclib/async/contract.hpp" +#include "yaclib/util/result.hpp" + +int main() +{ + auto [f, p] = yaclib::MakeContract(); + + std::move(p).Set(42); + + if (!f.Ready()) + { + return EXIT_FAILURE; + } + + yaclib::Result result = std::move(f).Get(); + + if (std::move(result).Ok() != 42) + { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/yaclib/all/test_v1_package/CMakeLists.txt b/recipes/yaclib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..219058ab228202 --- /dev/null +++ b/recipes/yaclib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) + +project(TestPackage LANGUAGES CXX) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_CXX_STANDARD 20) + +find_package(yaclib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE yaclib) diff --git a/recipes/yaclib/all/test_v1_package/conanfile.py b/recipes/yaclib/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..6fa6864719164c --- /dev/null +++ b/recipes/yaclib/all/test_v1_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): + test_type = 'explicit' + generators = 'CMakeDeps', 'CMakeToolchain', 'VirtualRunEnv' + settings = 'os', 'arch', 'compiler', 'build_type' + + 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], 'TestPackage') + self.run(bin_path, env="conanrun") diff --git a/recipes/yaclib/all/test_v1_package/main.cpp b/recipes/yaclib/all/test_v1_package/main.cpp new file mode 100644 index 00000000000000..d834e92b5b3cf6 --- /dev/null +++ b/recipes/yaclib/all/test_v1_package/main.cpp @@ -0,0 +1,25 @@ +#include + +#include "yaclib/async/contract.hpp" +#include "yaclib/util/result.hpp" + +int main() +{ + auto [f, p] = yaclib::MakeContract(); + + std::move(p).Set(42); + + if (!f.Ready()) + { + return EXIT_FAILURE; + } + + yaclib::Result result = std::move(f).Get(); + + if (std::move(result).Ok() != 42) + { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/yaclib/config.yml b/recipes/yaclib/config.yml new file mode 100644 index 00000000000000..4a9e1f685c4e37 --- /dev/null +++ b/recipes/yaclib/config.yml @@ -0,0 +1,3 @@ +versions: + "2022.10.31": + folder: all diff --git a/recipes/zimg/all/conandata.yml b/recipes/zimg/all/conandata.yml index 401a58d84be23c..6f58da26deae39 100644 --- a/recipes/zimg/all/conandata.yml +++ b/recipes/zimg/all/conandata.yml @@ -9,46 +9,25 @@ sources: url: "https://github.com/sekrit-twc/zimg/archive/release-3.0.2.tar.gz" sha256: "b9eadf1df12ae8395ba781f2468965d411b21abbebbebeae3651d492227d4633" "3.0.1": - sha256: "c50a0922f4adac4efad77427d13520ed89b8366eef0ef2fa379572951afcc73f" url: "https://github.com/sekrit-twc/zimg/archive/release-3.0.1.tar.gz" + sha256: "c50a0922f4adac4efad77427d13520ed89b8366eef0ef2fa379572951afcc73f" "2.9.3": - sha256: "a15c0483fbe945ffe695a1a989bc43b3381c8bf33e2d1760464ec21d32cdf30b" url: "https://github.com/sekrit-twc/zimg/archive/release-2.9.3.tar.gz" + sha256: "a15c0483fbe945ffe695a1a989bc43b3381c8bf33e2d1760464ec21d32cdf30b" patches: "3.0.4": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "3.0.3": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "3.0.2": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "3.0.1": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "2.9.3": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-include-stddef.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-msvc-remove-toolset-2.9.3.patch" - base_path: "source_subfolder" diff --git a/recipes/zimg/all/conanfile.py b/recipes/zimg/all/conanfile.py index 21a47de5a95932..6332a7e16ebe2e 100644 --- a/recipes/zimg/all/conanfile.py +++ b/recipes/zimg/all/conanfile.py @@ -1,17 +1,20 @@ -from conan.tools.files import rename -from conan.tools.microsoft import is_msvc -from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import stdcpp_library +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 Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.54.0" class ZimgConan(ConanFile): name = "zimg" description = "Scaling, colorspace conversion, and dithering library" - topics = ("zimg", "image", "manipulation") + topics = ("image", "manipulation") homepage = "https://github.com/sekrit-twc/zimg" url = "https://github.com/conan-io/conan-center-index" license = "WTFPL" @@ -26,17 +29,16 @@ class ZimgConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + 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,106 +46,103 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.build_type not in ("Release", "Debug"): - raise ConanInvalidConfiguration("zimg does not support the build type '{}'.".format(self.settings.build_type)) - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "15": - raise ConanInvalidConfiguration("zimg requires at least Visual Studio 15 2017") + check_min_vs(self, 191) def build_requirements(self): if not is_msvc(self): - 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") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", 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) - - @functools.lru_cache(1) - def _configure_autools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return autotools - - def _build_autotools(self): - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - autotools = self._configure_autools() - autotools.make() - - _sln_platforms = { - "x86": "Win32", - "x86_64": "x64", - "armv6": "ARM", - "armv7": "ARM", - "armv7hf": "ARM", - "armv7s": "ARM", - "armv7k": "ARM", - "armv8_32": "ARM", - "armv8": "ARM64", - "armv8.3": "ARM64", - } - - def _build_msvc(self): - msbuild = MSBuild(self) - msbuild.build(os.path.join(self._source_subfolder, "_msvc", "zimg.sln"), - targets=["dll" if self.options.shared else "zimg"], - platforms=self._sln_platforms) - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): if is_msvc(self): - self._build_msvc() + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() else: - self._build_autotools() - - def _package_autotools(self): - autotools = self._configure_autools() - 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") - - def _package_msvc(self): - self.copy("zimg.h", src=os.path.join(self._source_subfolder, "src", "zimg", "api"), dst="include") - self.copy("zimg++.hpp", src=os.path.join(self._source_subfolder, "src", "zimg", "api"), dst="include") + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + tc.generate() - sln_dir = os.path.join(self._source_subfolder, "_msvc", self._sln_platforms[str(self.settings.arch)], str(self.settings.build_type)) - if self.options.shared: - self.copy("z_imp.lib", src=sln_dir, dst="lib") - self.copy("z.dll", src=sln_dir, dst="bin") - rename(self, os.path.join(self.package_folder, "lib", "z_imp.lib"), - os.path.join(self.package_folder, "lib", "zimg.lib")) + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + #========================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_files = [ + os.path.join(self.source_folder, "_msvc", "zimg", "zimg.vcxproj"), + os.path.join(self.source_folder, "_msvc", "dll", "dll.vcxproj"), + ] + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + "true", + "" + ) + platform_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + "v142", + f"{platform_toolset}", + ) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + #========================== + + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self.source_folder, "_msvc", "zimg.sln"), + targets=["dll" if self.options.shared else "zimg"]) else: - self.copy("z.lib", src=sln_dir, dst="lib") - rename(self, os.path.join(self.package_folder, "lib", "z.lib"), - os.path.join(self.package_folder, "lib", "zimg.lib")) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - self._package_msvc() + src_include_dir = os.path.join(self.source_folder, "src", "zimg", "api") + copy(self, "zimg.h", src=src_include_dir, dst=os.path.join(self.package_folder, "include")) + copy(self, "zimg++.hpp", src=src_include_dir, dst=os.path.join(self.package_folder, "include")) + output_dir = os.path.join(self.source_folder, "_msvc") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + old_lib = "z_imp.lib" if self.options.shared else "z.lib" + rename(self, os.path.join(self.package_folder, "lib", old_lib), + os.path.join(self.package_folder, "lib", "zimg.lib")) else: - self._package_autotools() + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "zimg") self.cpp_info.libs = ["zimg"] if not self.options.shared: if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs = ["m"] - stdcpp = tools.stdcpp_library(self) - if stdcpp: - self.cpp_info.system_libs.append(stdcpp) + self.cpp_info.system_libs.append("m") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/zimg/all/patches/0001-msvc-remove-toolset-common.patch b/recipes/zimg/all/patches/0001-msvc-remove-toolset-common.patch deleted file mode 100644 index 4379125fd4c4a4..00000000000000 --- a/recipes/zimg/all/patches/0001-msvc-remove-toolset-common.patch +++ /dev/null @@ -1,630 +0,0 @@ ---- _msvc/_example_api/_example_api.vcxproj -+++ _msvc/_example_api/_example_api.vcxproj 2020-08-03 17:07:28.593014100 +0200 -@@ -40,58 +40,58 @@ - - {66EEC0BD-2C32-4B40-A180-B4C25B484D23} - _example_api -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_api_c/_example_api_c.vcxproj -+++ _msvc/_example_api_c/_example_api_c.vcxproj 2020-08-03 17:07:28.608645400 +0200 -@@ -40,58 +40,58 @@ - - {A8C79983-2F34-4E94-A86C-C44130FAB928} - _example_api_c -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_hdr/_example_hdr.vcxproj -+++ _msvc/_example_hdr/_example_hdr.vcxproj 2020-08-03 17:07:28.624263600 +0200 -@@ -37,58 +37,58 @@ - - {613FBE86-C438-4F7C-AB69-4C024C5305D5} - _example_hdr -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_interlace/_example_interlace.vcxproj -+++ _msvc/_example_interlace/_example_interlace.vcxproj 2020-08-03 17:07:28.646395600 +0200 -@@ -40,58 +40,58 @@ - - {6D8D14B2-6D32-45E3-A205-AA74DE2FBE7F} - _example_interlace -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_tile/_example_tile.vcxproj -+++ _msvc/_example_tile/_example_tile.vcxproj 2020-08-03 17:07:28.662027800 +0200 -@@ -38,58 +38,58 @@ - 15.0 - {53972BF2-7BFE-4A09-81E0-DC6EAF065D94} - exampletile -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/dll/dll.vcxproj -+++ _msvc/dll/dll.vcxproj 2020-08-03 17:07:28.508393400 +0200 -@@ -43,58 +43,58 @@ - - {96822C64-B0B6-49F3-A24C-F9C5FDB02DD3} - dll -- 10.0 -+ - - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - ---- _msvc/testapp/testapp.vcxproj -+++ _msvc/testapp/testapp.vcxproj 2020-08-03 17:07:28.524017800 +0200 -@@ -57,58 +57,58 @@ - - {B85E6CC0-ED80-487D-805A-DA3597A15CE6} - TestApp -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/testcommon/testcommon.vcxproj -+++ _msvc/testcommon/testcommon.vcxproj 2020-08-03 17:07:28.546136800 +0200 -@@ -37,58 +37,58 @@ - - {3849AF96-797C-4322-AD39-810D8367684D} - TestCommon -- 10.0 -+ - - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - ---- _msvc/zimg/zimg.vcxproj -+++ _msvc/zimg/zimg.vcxproj 2020-08-03 17:07:28.577392500 +0200 -@@ -37,58 +37,58 @@ - - {C8629E57-4D6F-40FA-82FC-B39824195932} - zimg -- 10.0 -+ - - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - diff --git a/recipes/zimg/all/patches/0001-msvc-remove-windows-target-platform.patch b/recipes/zimg/all/patches/0001-msvc-remove-windows-target-platform.patch new file mode 100644 index 00000000000000..f445b3e2da987f --- /dev/null +++ b/recipes/zimg/all/patches/0001-msvc-remove-windows-target-platform.patch @@ -0,0 +1,22 @@ +--- a/_msvc/dll/dll.vcxproj ++++ b/_msvc/dll/dll.vcxproj +@@ -43,7 +43,7 @@ + + {96822C64-B0B6-49F3-A24C-F9C5FDB02DD3} + dll +- 10.0 ++ + + + +--- a/_msvc/zimg/zimg.vcxproj ++++ b/_msvc/zimg/zimg.vcxproj +@@ -37,7 +37,7 @@ + + {C8629E57-4D6F-40FA-82FC-B39824195932} + zimg +- 10.0 ++ + + + diff --git a/recipes/zimg/all/patches/0004-msvc-remove-toolset-2.9.3.patch b/recipes/zimg/all/patches/0004-msvc-remove-toolset-2.9.3.patch deleted file mode 100644 index 7f3bd48e5a6a5d..00000000000000 --- a/recipes/zimg/all/patches/0004-msvc-remove-toolset-2.9.3.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- _msvc/_example_alpha/_example_alpha.vcxproj -+++ _msvc/_example_alpha/_example_alpha.vcxproj 2020-08-03 17:07:28.593014100 +0200 -@@ -37,58 +37,58 @@ - - {3C822249-7551-4086-AF0B-F43871F36191} - _example_alpha -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/unit_test/unit_test.vcxproj -+++ _msvc/unit_test/unit_test.vcxproj 2020-08-03 17:07:28.561767900 +0200 -@@ -108,32 +108,32 @@ - - {DDD98DB2-2ABE-4550-9F8C-0E4E4E991D73} - _unit_test -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - diff --git a/recipes/zimg/all/patches/0005-msvc-remove-toolset-3.0.1.patch b/recipes/zimg/all/patches/0005-msvc-remove-toolset-3.0.1.patch deleted file mode 100644 index c0335fb34d0f83..00000000000000 --- a/recipes/zimg/all/patches/0005-msvc-remove-toolset-3.0.1.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- a/_msvc/unit_test/unit_test.vcxproj -+++ b/_msvc/unit_test/unit_test.vcxproj -@@ -183,58 +183,49 @@ - - {DDD98DB2-2ABE-4550-9F8C-0E4E4E991D73} - _unit_test -- 10.0 - - - - Application - true -- v142 - Unicode - - - Application - true -- v142 - Unicode - - - Application - false -- v142 - true - Unicode - - - Application - false -- v142 - true - Unicode - - - Application - true -- v142 - Unicode - - - Application - true -- v142 - Unicode - - - Application - false -- v142 - true - Unicode - - - Application - false -- v142 - true - Unicode - diff --git a/recipes/zimg/all/test_package/CMakeLists.txt b/recipes/zimg/all/test_package/CMakeLists.txt index 1141754d91b5ed..0b744ea607a1f4 100644 --- a/recipes/zimg/all/test_package/CMakeLists.txt +++ b/recipes/zimg/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(zimg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} zimg::zimg) +target_link_libraries(${PROJECT_NAME} PRIVATE zimg::zimg) diff --git a/recipes/zimg/all/test_package/conanfile.py b/recipes/zimg/all/test_package/conanfile.py index 38f4483872d47f..98ab55852ad565 100644 --- a/recipes/zimg/all/test_package/conanfile.py +++ b/recipes/zimg/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 = "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,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/zimg/all/test_v1_package/CMakeLists.txt b/recipes/zimg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d20897301b68b --- /dev/null +++ b/recipes/zimg/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/zimg/all/test_v1_package/conanfile.py b/recipes/zimg/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..38f4483872d47f --- /dev/null +++ b/recipes/zimg/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/zpp_throwing/all/conandata.yml b/recipes/zpp_throwing/all/conandata.yml new file mode 100644 index 00000000000000..063b5be845f319 --- /dev/null +++ b/recipes/zpp_throwing/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0": + url: "https://github.com/eyalz800/zpp_throwing/archive/refs/tags/v1.0.tar.gz" + sha256: "e02ef0e028e436ed4382b14796550f48c1d2b5ae02910f10b5b9fe097981ea2f" diff --git a/recipes/zpp_throwing/all/conanfile.py b/recipes/zpp_throwing/all/conanfile.py new file mode 100644 index 00000000000000..6cfaa18e3dd020 --- /dev/null +++ b/recipes/zpp_throwing/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 get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.52.0" + +class ZppThrowingConan(ConanFile): + name = "zpp_throwing" + description = "Using coroutines to implement C++ exceptions for freestanding environments" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/eyalz800/zpp_throwing" + topics = ("coroutines", "exceptions", "header-only") + 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": "17", + "msvc": "193", + "gcc": "11", + "clang": "12", + "apple-clang": "13.1", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + # TODO: currently msvc isn't suppported + # see https://github.com/eyalz800/zpp_throwing/issues/7 + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC (yet). See https://github.com/eyalz800/zpp_throwing/issues/7") + + 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] + + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) + + 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._min_cppstd}, which your compiler ({compiler}-{version}) does not support.", + ) + + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "14" and self.settings.compiler.get_safe("libcxx") != "libc++": + raise ConanInvalidConfiguration(f"{self.ref} requires libc++ with 'coroutines' supported on your compiler.") + + 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="*.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 = [] + + if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": + self.cpp_info.cxxflags.append("-fcoroutines-ts") + diff --git a/recipes/zpp_throwing/all/test_package/CMakeLists.txt b/recipes/zpp_throwing/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..0d33f96e054b55 --- /dev/null +++ b/recipes/zpp_throwing/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(zpp_throwing REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zpp_throwing::zpp_throwing) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/zpp_throwing/all/test_package/conanfile.py b/recipes/zpp_throwing/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e845ae751a3017 --- /dev/null +++ b/recipes/zpp_throwing/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/zpp_throwing/all/test_package/test_package.cpp b/recipes/zpp_throwing/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..c723a245f1637c --- /dev/null +++ b/recipes/zpp_throwing/all/test_package/test_package.cpp @@ -0,0 +1,28 @@ +#include +#include + +#include "zpp_throwing.h" + +zpp::throwing foo(bool success) { + if (!success) { + // Throws an exception. + co_yield std::runtime_error("My runtime error"); + } + + // Returns a value. + co_return 1337; +} + +int main() { + return zpp::try_catch([]() -> zpp::throwing { + std::cout << "Hello World\n"; + std::cout << co_await foo(false) << '\n';; + co_return 0; + }, [&](const std::exception & error) { + std::cout << "std exception caught: " << error.what() << '\n'; + return 0; + }, [&]() { + std::cout << "Unknown exception\n"; + return 0; + }); +} diff --git a/recipes/zpp_throwing/all/test_v1_package/CMakeLists.txt b/recipes/zpp_throwing/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/zpp_throwing/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +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/zpp_throwing/all/test_v1_package/conanfile.py b/recipes/zpp_throwing/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..0f735b51a26422 --- /dev/null +++ b/recipes/zpp_throwing/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +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.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/zpp_throwing/config.yml b/recipes/zpp_throwing/config.yml new file mode 100644 index 00000000000000..edab1ee152d366 --- /dev/null +++ b/recipes/zpp_throwing/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0": + folder: all diff --git a/recipes/zstr/all/conandata.yml b/recipes/zstr/all/conandata.yml index f563402cf65a8d..d912b849c0a5fd 100644 --- a/recipes/zstr/all/conandata.yml +++ b/recipes/zstr/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.7": + url: "https://github.com/mateidavid/zstr/archive/refs/tags/v1.0.7.tar.gz" + sha256: "8d2ddae68ff7bd0a6fce6150a8f52ad9ce1bed2c4056c8846f4dec4f2dc60819" "1.0.6": url: "https://github.com/mateidavid/zstr/archive/refs/tags/v1.0.6.tar.gz" sha256: "548f3fed81029defc3567d1902f7306eb0aa19f205ce9e06075b7349a3875f32" diff --git a/recipes/zstr/all/test_v1_package/CMakeLists.txt b/recipes/zstr/all/test_v1_package/CMakeLists.txt index 629a41f38d6f89..9d54a092e0a67e 100644 --- a/recipes/zstr/all/test_v1_package/CMakeLists.txt +++ b/recipes/zstr/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ 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) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zstr/config.yml b/recipes/zstr/config.yml index c32b2b7161197a..86728f7f3bec41 100644 --- a/recipes/zstr/config.yml +++ b/recipes/zstr/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.7": + folder: all "1.0.6": folder: all "1.0.5": diff --git a/recipes/zulu-openjdk/all/conandata.yml b/recipes/zulu-openjdk/all/conandata.yml index 5243fbdebc8c0e..516a7ae7f4098c 100644 --- a/recipes/zulu-openjdk/all/conandata.yml +++ b/recipes/zulu-openjdk/all/conandata.yml @@ -1,64 +1,40 @@ sources: - "11.0.8": - "Windows": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-win_x64.zip", - "sha256": "3602ed7bae52898c540c2d3ae3230c081cf061b219d14fb9ac15a47f4226d307", - } - "Linux": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-linux_x64.tar.gz", - "sha256": "f8aee4ab30ca11ab3c8f401477df0e455a9d6b06f2710b2d1b1ddcf06067bc79", - } - "Macos": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-macosx_x64.tar.gz", - "sha256": "1ed070ea9a27030bcca4d7c074dec1d205d3f3506166d36faf4d1b9e083ab365", - } - "11.0.12": "Windows": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-win_x64.zip", - "sha256": "42ae65e75d615a3f06a674978e1fa85fdf078cad94e553fee3e779b2b42bb015", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-win_x64.zip" + sha256: "42ae65e75d615a3f06a674978e1fa85fdf078cad94e553fee3e779b2b42bb015" "Linux": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz", - "sha256": "b8e8a63b79bc312aa90f3558edbea59e71495ef1a9c340e38900dd28a1c579f3", - } - "armv8": { - "url": "https://cdn.azul.com/zulu-embedded/bin/zulu11.50.19-ca-jdk11.0.12-linux_aarch64.tar.gz", - "sha256": "61254688067454d3ccf0ef25993b5dcab7b56c8129e53b73566c28a8dd4d48fb", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz" + sha256: "b8e8a63b79bc312aa90f3558edbea59e71495ef1a9c340e38900dd28a1c579f3" + "armv8": + url: "https://cdn.azul.com/zulu-embedded/bin/zulu11.50.19-ca-jdk11.0.12-linux_aarch64.tar.gz" + sha256: "61254688067454d3ccf0ef25993b5dcab7b56c8129e53b73566c28a8dd4d48fb" "Macos": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_x64.tar.gz", - "sha256": "0b8c8b7cf89c7c55b7e2239b47201d704e8d2170884875b00f3103cf0662d6d7", - } - "armv8" : { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_aarch64.tar.gz", - "sha256": "e908a0b4c0da08d41c3e19230f819b364ff2e5f1dafd62d2cf991a85a34d3a17", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_x64.tar.gz" + sha256: "0b8c8b7cf89c7c55b7e2239b47201d704e8d2170884875b00f3103cf0662d6d7" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_aarch64.tar.gz" + sha256: "e908a0b4c0da08d41c3e19230f819b364ff2e5f1dafd62d2cf991a85a34d3a17" "11.0.15": "Windows": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip", - "sha256": "a106c77389a63b6bd963a087d5f01171bd32aa3ee7377ecef87531390dcb9050", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip" + sha256: "a106c77389a63b6bd963a087d5f01171bd32aa3ee7377ecef87531390dcb9050" "Linux": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz", - "sha256": "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247", - } - "armv8": { - "url": "https://cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz", - "sha256": "fc7c41a0005180d4ca471c90d01e049469e0614cf774566d4cf383caa29d1a97", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz" + sha256: "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247" + "armv8": + url: "https://cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz" + sha256: "fc7c41a0005180d4ca471c90d01e049469e0614cf774566d4cf383caa29d1a97" "Macos": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz", - "sha256": "2614e5c5de8e989d4d81759de4c333aa5b867b17ab9ee78754309ba65c7f6f55", - } - "armv8" : { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz", - "sha256": "6bb0d2c6e8a29dcd9c577bbb2986352ba12481a9549ac2c0bcfd00ed60e538d2", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz" + sha256: "2614e5c5de8e989d4d81759de4c333aa5b867b17ab9ee78754309ba65c7f6f55" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz" + sha256: "6bb0d2c6e8a29dcd9c577bbb2986352ba12481a9549ac2c0bcfd00ed60e538d2" diff --git a/recipes/zulu-openjdk/all/conanfile.py b/recipes/zulu-openjdk/all/conanfile.py index df269044c419f6..05d28945d8c9ab 100644 --- a/recipes/zulu-openjdk/all/conanfile.py +++ b/recipes/zulu-openjdk/all/conanfile.py @@ -1,7 +1,8 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version -import os, glob +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy class ZuluOpenJDK(ConanFile): @@ -11,11 +12,8 @@ class ZuluOpenJDK(ConanFile): homepage = "https://www.azul.com" license = "https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/" topics = ("java", "jdk", "openjdk") - settings = "os", "arch", "build_type", "compiler" - - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "arch" + package_type = "application" @property def _settings_build(self): @@ -26,42 +24,39 @@ def _jni_folder(self): folder = {"Linux": "linux", "Macos": "darwin", "Windows": "win32"}.get(str(self._settings_build.os)) return os.path.join("include", folder) - def package_id(self): - del self.info.settings.build_type - del self.info.settings.compiler def validate(self): - if Version(self.version) < Version("11.0.12"): - supported_archs = ["x86_64"] - if self._settings_build.arch not in supported_archs: - raise ConanInvalidConfiguration(f"Unsupported Architecture ({self._settings_build.arch}). The version {self.version} currently only supports {supported_archs}.") - elif Version(self.version) >= Version("11.0.12"): - supported_archs = ["x86_64", "armv8"] - if self._settings_build.arch not in supported_archs: - raise ConanInvalidConfiguration(f"Unsupported Architecture ({self._settings_build.arch}). This version {self.version} currently only supports {supported_archs}.") + supported_archs = ["x86_64", "armv8"] + if self._settings_build.arch not in supported_archs: + raise ConanInvalidConfiguration(f"Unsupported Architecture ({self._settings_build.arch}). " + "This version {self.version} currently only supports {supported_archs}.") supported_os = ["Windows", "Macos", "Linux"] if self._settings_build.os not in supported_os: - raise ConanInvalidConfiguration(f"Unsupported os ({self._settings_build.os}). This package currently only support {supported_os}.") + raise ConanInvalidConfiguration(f"Unsupported os ({self._settings_build.os}). " + "This package currently only support {supported_os}.") def build(self): - if Version(self.version) < Version("11.0.12"): - tools.get(**self.conan_data["sources"][self.version][str(self._settings_build.os)], - destination=self._source_subfolder, strip_root=True) - else: - tools.get(**self.conan_data["sources"][self.version][str(self._settings_build.os)][str(self._settings_build.arch)], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][str(self._settings_build.os)][str(self._settings_build.arch)], strip_root=True) def package(self): - self.copy(pattern="*", dst="bin", src=os.path.join(self._source_subfolder, "bin"), excludes=("msvcp140.dll", "vcruntime140.dll")) - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="*", dst="lib", src=os.path.join(self._source_subfolder, "lib")) - self.copy(pattern="*", dst="res", src=os.path.join(self._source_subfolder, "conf")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.source_folder, "bin"), + excludes=("msvcp140.dll", "vcruntime140.dll")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.source_folder, "lib")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "res"), + src=os.path.join(self.source_folder, "conf")) # conf folder is required for security settings, to avoid # java.lang.SecurityException: Can't read cryptographic policy directory: unlimited # https://github.com/conan-io/conan-center-index/pull/4491#issuecomment-774555069 - self.copy(pattern="*", dst="conf", src=os.path.join(self._source_subfolder, "conf")) - self.copy(pattern="*", dst="licenses", src=os.path.join(self._source_subfolder, "legal")) - self.copy(pattern="*", dst=os.path.join("lib", "jmods"), src=os.path.join(self._source_subfolder, "jmods")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "conf"), + src=os.path.join(self.source_folder, "conf")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "legal")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "lib", "jmods"), + src=os.path.join(self.source_folder, "jmods")) def package_info(self): self.cpp_info.includedirs.append(self._jni_folder) @@ -72,6 +67,8 @@ def package_info(self): self.output.info("Creating JAVA_HOME environment variable with : {0}".format(java_home)) self.env_info.JAVA_HOME = java_home + self.buildenv_info.define_path("JAVA_HOME", java_home) + self.runenv_info.define_path("JAVA_HOME", java_home) self.output.info("Appending PATH environment variable with : {0}".format(bin_path)) self.env_info.PATH.append(bin_path) diff --git a/recipes/zulu-openjdk/all/test_package/conanfile.py b/recipes/zulu-openjdk/all/test_package/conanfile.py index 59867bd3e396dd..e80eb25a7acac0 100644 --- a/recipes/zulu-openjdk/all/test_package/conanfile.py +++ b/recipes/zulu-openjdk/all/test_package/conanfile.py @@ -1,26 +1,29 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import cross_building from io import StringIO class TestPackage(ConanFile): settings = "os", "arch" + test_type = "explicit" + generators = "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): pass # nothing to build, but tests should not warn def test(self): - if tools.cross_building(self): + if cross_building(self): return # OK, this needs some explanation # You basically do not crosscompile that package, never # But C3I does, Macos x86_64 to M1, # and this is why there is some cross compilation going on # The test will not work in that environment, so .... don't test - test_cmd = ['java', '--version'] output = StringIO() - self.run(test_cmd, output=output, run_environment=True) + self.run("java --version", output, env="conanrun") version_info = output.getvalue() - if "Zulu" in version_info: - pass - else: + if "Zulu" not in version_info: raise Exception("java call seems not use the Zulu bin") diff --git a/recipes/zulu-openjdk/all/test_v1_package/conanfile.py b/recipes/zulu-openjdk/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..e80eb25a7acac0 --- /dev/null +++ b/recipes/zulu-openjdk/all/test_v1_package/conanfile.py @@ -0,0 +1,29 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from io import StringIO + + +class TestPackage(ConanFile): + settings = "os", "arch" + test_type = "explicit" + generators = "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + pass # nothing to build, but tests should not warn + + def test(self): + if cross_building(self): + return + # OK, this needs some explanation + # You basically do not crosscompile that package, never + # But C3I does, Macos x86_64 to M1, + # and this is why there is some cross compilation going on + # The test will not work in that environment, so .... don't test + output = StringIO() + self.run("java --version", output, env="conanrun") + version_info = output.getvalue() + if "Zulu" not in version_info: + raise Exception("java call seems not use the Zulu bin") diff --git a/recipes/zulu-openjdk/config.yml b/recipes/zulu-openjdk/config.yml index aeba9022820bca..41d345875e1e8b 100644 --- a/recipes/zulu-openjdk/config.yml +++ b/recipes/zulu-openjdk/config.yml @@ -1,6 +1,4 @@ versions: - "11.0.8": - folder: all "11.0.12": folder: all "11.0.15": diff --git a/recipes/zxing-cpp/all/CMakeLists.txt b/recipes/zxing-cpp/all/CMakeLists.txt deleted file mode 100644 index a465612005359a..00000000000000 --- a/recipes/zxing-cpp/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) diff --git a/recipes/zxing-cpp/all/conandata.yml b/recipes/zxing-cpp/all/conandata.yml index 69d8a5f6261801..061a1e5e1b6467 100644 --- a/recipes/zxing-cpp/all/conandata.yml +++ b/recipes/zxing-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.0": + url: "https://github.com/nu-book/zxing-cpp/archive/v1.4.0.tar.gz" + sha256: "126767bb56f8a1f25ae84d233db2e9b9be50d71f5776092d0e170ca0f0ed1862" "1.4.0": url: "https://github.com/nu-book/zxing-cpp/archive/v1.4.0.tar.gz" sha256: "126767bb56f8a1f25ae84d233db2e9b9be50d71f5776092d0e170ca0f0ed1862" @@ -13,13 +16,18 @@ patches: # core/ByteArray checks `__cpp_lib_string_view` for using string_view. # But some compilers(ex. gcc 7.2) don't support `__cpp_lib_string_view` but support string_view. - patch_file: "patches/1.4.0-0001-fix-string-view.patch" - base_path: "source_subfolder" + patch_description: "fix compilation error for string_view on several compilers" + patch_type: "portability" "1.0.8": - patch_file: "patches/1.0.8-0001-Fix-C2327-for-MSVC-2015.patch" - base_path: "source_subfolder" + patch_description: "fix compilation error C2327 on MSVC 2015" + patch_type: "portability" - patch_file: "patches/1.0.8-0002-include-limits.patch" - base_path: "source_subfolder" + patch_description: "include limits" + patch_type: "portability" - patch_file: "patches/1.0.8-0003-include-stdexcept.patch" - base_path: "source_subfolder" + patch_description: "include stdexcept" + patch_type: "portability" - patch_file: "patches/1.0.8-0004-include-cstddef.patch" - base_path: "source_subfolder" + patch_description: "include cstddef" + patch_type: "portability" diff --git a/recipes/zxing-cpp/all/conanfile.py b/recipes/zxing-cpp/all/conanfile.py index b5e0b276dbb875..aef63f3e7475fb 100644 --- a/recipes/zxing-cpp/all/conanfile.py +++ b/recipes/zxing-cpp/all/conanfile.py @@ -1,11 +1,13 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc_static_runtime, 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, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class ZXingCppConan(ConanFile): name = "zxing-cpp" @@ -29,37 +31,27 @@ class ZXingCppConan(ConanFile): "enable_decoders": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _compiler_cpp_support(self): return { "14" : { "gcc": "5", "Visual Studio": "14", + "msvc": "190", "clang": "3.4", "apple-clang": "3.4", }, "17" : { - "gcc": "7", + "gcc": "7" if Version(self.version) < "2.0.0" else "8", "Visual Studio": "16", - "clang": "5", - "apple-clang": "5", + "msvc": "192", + "clang": "5" if Version(self.version) < "2.0.0" else "7", + "apple-clang": "5" if Version(self.version) < "2.0.0" else "12", } } 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,62 +59,61 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - cpp_version = 17 if tools.Version(self.version) >= "1.2.0" else 14 + cpp_version = 17 if Version(self.version) >= "1.2.0" else 14 if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, cpp_version) + check_min_cppstd(self, cpp_version) min_version = self._compiler_cpp_support.get(str(cpp_version)).get(str(self.settings.compiler)) - - if min_version and tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration( - "This compiler is too old. {} needs a compiler with c++{} support".format(self.name, cpp_version) - ) + if min_version and Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"This compiler is too old. {self.ref} needs a compiler with c++{cpp_version} support") # FIXME: This is a workaround for "The system cannot execute the specified program." - if tools.Version(self.version) >= "1.3.0" and is_msvc_static_runtime(self) and self.settings.build_type == "Debug": - raise ConanInvalidConfiguration("{}/{} doesn't support MT + Debug.".format(self.name, self.version)) + if Version(self.version) >= "1.3.0" and is_msvc_static_runtime(self) and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MT + Debug.") 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) - if tools.Version(self.version) < "1.1": - cmake.definitions["ENABLE_ENCODERS"] = self.options.enable_encoders - cmake.definitions["ENABLE_DECODERS"] = self.options.enable_decoders + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if Version(self.version) < "1.1": + tc.variables["ENABLE_ENCODERS"] = self.options.enable_encoders + tc.variables["ENABLE_DECODERS"] = self.options.enable_decoders + tc.variables["BUILD_SHARED_LIBRARY"] = self.options.shared else: - cmake.definitions["BUILD_WRITERS"] = self.options.enable_encoders - cmake.definitions["BUILD_READERS"] = self.options.enable_decoders - cmake.definitions["BUILD_EXAMPLES"] = False - cmake.definitions["BUILD_BLACKBOX_TESTS"] = False + tc.variables["BUILD_WRITERS"] = self.options.enable_encoders + tc.variables["BUILD_READERS"] = self.options.enable_decoders + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_BLACKBOX_TESTS"] = False if is_msvc(self): - cmake.definitions["LINK_CPP_STATICALLY"] = "MT" in str(self.settings.compiler.runtime) - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["LINK_CPP_STATICALLY"] = is_msvc_static_runtime(self) + 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(pattern="LICENSE*", src=self._source_subfolder, dst="licenses") - 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")) - 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")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "ZXing") self.cpp_info.set_property("cmake_target_name", "ZXing::ZXing") self.cpp_info.set_property("pkg_config_name", "zxing") - self.cpp_info.libs = ["ZXingCore" if tools.Version(self.version) < "1.1" else "ZXing"] + self.cpp_info.libs = ["ZXingCore" if Version(self.version) < "1.1" else "ZXing"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "m"] diff --git a/recipes/zxing-cpp/all/test_package/CMakeLists.txt b/recipes/zxing-cpp/all/test_package/CMakeLists.txt index 45f25b99a6fd5f..8e4b0111b8b7e0 100644 --- a/recipes/zxing-cpp/all/test_package/CMakeLists.txt +++ b/recipes/zxing-cpp/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ 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(ZXing REQUIRED CONFIG) find_package(stb REQUIRED CONFIG) @@ -12,5 +9,5 @@ if (ZXing_VERSION VERSION_LESS "1.1.0") else() add_executable(${PROJECT_NAME} test_package_1.1.cpp) endif() -target_link_libraries(${PROJECT_NAME} ZXing::ZXing stb::stb) +target_link_libraries(${PROJECT_NAME} PRIVATE ZXing::ZXing stb::stb) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/zxing-cpp/all/test_package/conanfile.py b/recipes/zxing-cpp/all/test_package/conanfile.py index 617b69931fb4c1..9ba1684044ebff 100644 --- a/recipes/zxing-cpp/all/test_package/conanfile.py +++ b/recipes/zxing-cpp/all/test_package/conanfile.py @@ -1,13 +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("stb/cci.20210910") + self.requires("stb/cci.20220909") + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -15,12 +21,12 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): try: os.unlink("output.png") except FileNotFoundError: pass - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") assert os.path.isfile("output.png") diff --git a/recipes/zxing-cpp/all/test_v1_package/CMakeLists.txt b/recipes/zxing-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 00000000000000..be00a8c7f57c71 --- /dev/null +++ b/recipes/zxing-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +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/zxing-cpp/all/test_v1_package/conanfile.py b/recipes/zxing-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 00000000000000..030ecca50ee45f --- /dev/null +++ b/recipes/zxing-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +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 requirements(self): + self.requires("stb/cci.20220909") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + try: + os.unlink("output.png") + except FileNotFoundError: + pass + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + + assert os.path.isfile("output.png") diff --git a/recipes/zxing-cpp/config.yml b/recipes/zxing-cpp/config.yml index 778dac07cb8fa6..a4e6ca74f0f314 100644 --- a/recipes/zxing-cpp/config.yml +++ b/recipes/zxing-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.0": + folder: all "1.4.0": folder: all "1.3.0":