diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index 3c20b5b172cd0..b82bcf03f12e7 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -931,3 +931,32 @@ authorized_users: - "JorgenPo" - "AlexRamallo" - "kissandras" + - "scandyna" + - "jave27" + - "mark0n" + - "kayoub5" + - "topheg" + - "curoky" + - "datalogics-saharay" + - "sproberts92" + - "madhat1" + - "vince-cheung" + - "mariopil" + - "PikachuHyA" + - "System-Arch" + - "sorny92" + - "cubanpit" + - "winterz" + - "Kidsunbo" + - "antony-jr" + - "tankeco" + - "ElliotMugner" + - "jfaust" + - "morningstar1" + - "lrineau" + - "jwidauer" + - "partiallyderived" + - "Ahajha" + - "mjimenofluendo" + - "jiaoew1991" + - "ramin-raeisi" diff --git a/.c3i/config_v1.yml b/.c3i/config_v1.yml index 0495513380bba..df0cd98446adc 100644 --- a/.c3i/config_v1.yml +++ b/.c3i/config_v1.yml @@ -3,7 +3,7 @@ id: 'conan-io/conan-center-index' conan: - version: 1.51.3 + version: 1.52.0 artifactory: url: "https://c3i.jfrog.io/c3i" diff --git a/.c3i/reviewers.yml b/.c3i/reviewers.yml index bc47c10472b07..9be2aca6c9794 100644 --- a/.c3i/reviewers.yml +++ b/.c3i/reviewers.yml @@ -10,8 +10,8 @@ reviewers: type: "team" request_reviews: false - user: "jgsogo" - type: "team" - request_reviews: true + type: "community" + request_reviews: false - user: "czoido" type: "team" request_reviews: false @@ -75,3 +75,6 @@ reviewers: - user: "paulocoutinhox" type: "community" request_reviews: false + - user: "jwillikers" + type: "community" + request_reviews: false diff --git a/.github/ISSUE_TEMPLATE/package_bug.yml b/.github/ISSUE_TEMPLATE/package_bug.yml index 8d4162d3beef4..5ac1a60d6437d 100644 --- a/.github/ISSUE_TEMPLATE/package_bug.yml +++ b/.github/ISSUE_TEMPLATE/package_bug.yml @@ -3,16 +3,22 @@ description: 'Report a bug, something does not work as it supposed to' title: '[package] /: SHORT DESCRIPTION' labels: bug body: -- type: markdown +- type: textarea attributes: + label: Description + description: What is not working? What were you expecting? Are there any workarounds? value: | - Please don't forget to update the issue title. - Include all applicable information to help us reproduce your problem. + _Please don't forget to update the issue title._ + + Missing profile or a short log will make extremely difficult to investigate your case or provide any help, + please, include all applicable information with details to help us reproduce your problem. + validations: + required: true - type: textarea attributes: label: Package and Environment Details - description: include every applicable attribute) + description: (include every applicable attribute) value: | * Package Name/Version: **zlib/1.2.8** * Operating System+version: **Linux Ubuntu 18.04** @@ -20,24 +26,49 @@ body: * Docker image: **conanio/gcc8** * Conan version: **conan 1.18.0** * Python version: **Python 3.7.4** + placeholder: | + cat /etc/lsb-release | grep + gcc --version + docker info + cmake --version + conan -v + python3 --version validations: required: true - - type: textarea attributes: label: Conan profile description: output of `conan profile show default` or `conan profile show ` if custom profile is in use + value: | + [settings] + os=Macos + os_build=Macos + arch=armv8 + arch_build=armv8 + compiler=apple-clang + compiler.version=14 + compiler.libcxx=libc++ + build_type=Release + [options] + [conf] + [build_requires] + [env] + validations: + required: true - type: textarea attributes: label: Steps to reproduce - description: Include if Applicable + description: Which commands did you run? + value: conan install -r conancenter foobar/0.1.0@ -pr:b=default -pr:h=default + validations: + required: true - type: textarea attributes: label: Logs - description: Include/Attach if Applicable + description: Include/Attach the entire command output here. value: |
Click to expand log @@ -46,3 +77,5 @@ body: ```
+ validations: + required: true diff --git a/.github/workflows/linter-conan-v2.yml b/.github/workflows/linter-conan-v2.yml index d1f78543433e7..7a00231462537 100644 --- a/.github/workflows/linter-conan-v2.yml +++ b/.github/workflows/linter-conan-v2.yml @@ -29,7 +29,7 @@ jobs: uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed_files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} @@ -97,7 +97,7 @@ jobs: uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed-files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} @@ -132,7 +132,7 @@ jobs: uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed-files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} diff --git a/.github/workflows/linter-yaml.yml b/.github/workflows/linter-yaml.yml index 511e654ab8bb0..59e73e83b163c 100644 --- a/.github/workflows/linter-yaml.yml +++ b/.github/workflows/linter-yaml.yml @@ -26,11 +26,11 @@ jobs: files: | linter/** - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed_files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} - + - name: Install dependencies if: steps.changed_files.outputs.any_changed == 'true' run: pip install yamllint @@ -53,10 +53,10 @@ jobs: with: fetch-depth: 2 - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 with: python-version: ${{ env.PYVER }} - + - name: Install dependencies run: pip install yamllint @@ -68,7 +68,7 @@ jobs: with: files: | ${{ env.CONFIG_FILES_PATH }} - + - name: Run linter (config.yml) if: steps.changed_files_config.outputs.any_changed == 'true' && always() run: | @@ -84,7 +84,7 @@ jobs: with: files: | ${{ env.CONANDATA_FILES_PATH }} - + - name: Run linter (conandata.yml) if: steps.changed_files_conandata.outputs.any_changed == 'true' && always() run: | diff --git a/.github/workflows/marldown-links.yml b/.github/workflows/marldown-links.yml new file mode 100644 index 0000000000000..63b30bcfe82a8 --- /dev/null +++ b/.github/workflows/marldown-links.yml @@ -0,0 +1,25 @@ +name: Check Markdown links + +on: [push, pull_request] + +jobs: + markdown-link-check-push: + if: github.event_name == 'push' && github.repository_owner != 'conan-io' # We do not want to see red in CCI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + config-file: .github/workflows/mlc_config.json + + markdown-link-check-pr: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + config-file: .github/workflows/mlc_config.json + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + check-modified-files-only: 'yes' diff --git a/.github/workflows/mlc_config.json b/.github/workflows/mlc_config.json new file mode 100644 index 0000000000000..d16005bb86641 --- /dev/null +++ b/.github/workflows/mlc_config.json @@ -0,0 +1,13 @@ +{ + "retryOn429": true, + "retryCount": 5, + "fallbackRetryDelay": "30s", + "httpHeaders": [ + { + "urls": ["https://github.com/", "https://guides.github.com/", "https://help.github.com/", "https://docs.github.com/"], + "headers": { + "Accept-Encoding": "zstd, br, gzip, deflate" + } + } + ] +} diff --git a/.github/workflows/on-push-do-doco.yml b/.github/workflows/on-push-do-doco.yml index fe33f4984dfb3..f5206b720d4a9 100644 --- a/.github/workflows/on-push-do-doco.yml +++ b/.github/workflows/on-push-do-doco.yml @@ -22,7 +22,7 @@ jobs: --toc-level 5 shell: bash - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: branch: bot/action-doc-toc commit-message: "[docs] Regenerate tables of contents" diff --git a/.gitignore b/.gitignore index d4f0278522f81..4ecc58bbd7d32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,15 @@ # Conan specific test_package/build/ +test_package/test_output/ conan.lock conanbuildinfo.txt conaninfo.txt graph_info.json build/ +# CMake +CMakeUserPresets.json + # IDEs .idea .vscode diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22027379ce53b..6cf9d3245b80c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,27 +11,29 @@ The following summarizes the process for contributing to the CCI (Conan Center I ## Community -Conan Center Index is an Open Source MIT licensed project. -Conan Center Index is developed by the Conan maintainers and a great community of contributors. +ConanCenterIndex is an Open Source MIT licensed project; it is developed by the Conan maintainers and a great community of contributors. ## Dev-flow & Pull Requests CCI follows the ["GitFlow"](https://datasift.github.io/gitflow/IntroducingGitFlow.html) branching model. Issues are triaged and categorized mainly by type (package request, bug...) and priority (high, medium...) using GitHub - labels. +labels. To contribute follow the next steps: 1. Comment in the corresponding issue that you want to contribute the package/fix proposed. If there is no open issue, we strongly suggest - to open one to gather feedback. -2. Check the [how_to_add_packages.md](docs/how_to_add_packages.md) if are - contributing for a new package. -3. Fork the [CCI repository](https://github.com/conan-io/conan-center-index) and create a `package/xxx` branch from the `master` branch and develop + opening one to gather feedback. +2. Make sure to [request access](docs/how_to_add_packages.md#request-access) and be aware there is a [CLA](docs/CONTRIBUTOR_LICENSE_AGREEMENT.md). +3. Get setup by following the [Developing Recipes](docs/developing_recipes_locally.md) guide and learn the basic commands. +4. Check the [How To Add Packages](docs/how_to_add_packages.md) page for the break down of ConanCenterIndex specific conventions and practices. +5. In your fork create a `package/xxx` branch from the `master` branch and develop your fix/packages as discussed in previous step. -4. Try to keep your branch updated with the `master` branch to avoid conflicts. -5. Add the text (besides other comments): "fixes #IssueNumber" in the body of the PR, referring to the issue of step 1. +6. [Submit a pull request](docs/how_to_add_packages.md#submitting-a-package) once you are ready. This can be when you + got everything working or even if you need help. Add the text to the issue body (besides other comments): "fixes #IssueNumber" + in the body of the PR, referring to the issue of step 1. -The ``conan-io`` organization maintainers will review and help with the packaging. +The Conan Community works hard to review all the pull requests and provided assistance where need. +The [Review Process](docs/review_process.md) is partially automated with the help of @conan-center-index-bot :rocket: ## Issues @@ -50,10 +52,5 @@ For any suggestion, feature request or question open an issue indicating the fol - Try to explain the motivation, what are you trying to do, what is the pain it tries to solve. - What do you expect from CCI. -We use the following tags to control the status of the issues: - -- **infrastructure**: Waiting on tools or services belonging to the infra. -- **library request**: Request a new package to be created. -- **question**: Further information is requested . -- **upstream update**: Bump a new package version. -- **conan.io/center**: Issues and features related to Web UI . +We use the following tags to control the status of the issues and pull requests, you can learn more in [Labels](docs/labels.md) document +which details the important one and their roles. diff --git a/docs/CONTRIBUTOR_LICENSE_AGREEMENT.md b/docs/CONTRIBUTOR_LICENSE_AGREEMENT.md new file mode 100644 index 0000000000000..39acf20a7aebd --- /dev/null +++ b/docs/CONTRIBUTOR_LICENSE_AGREEMENT.md @@ -0,0 +1,23 @@ +Conan-Center-Index project Contributor License Agreement +-------------------------------------------------------- + +The following terms are used throughout this agreement: + +- You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it. +- Contribution - any type of work that is submitted to the repository, including any modifications or additions to existing work. +- Project - Conan-Center-Index project (https://github.com/conan-io/conan-center-index) +- Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with the copyright owner, contributors or maintainers. + +1. Grant of Copyright License. + + Subject to the terms and conditions of this agreement, You grant to JFrog LTD, a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute your contributions and such derivative works. + +2. Grant of Patent License. + + Subject to the terms and conditions of this agreement, You grant to JFrog LTD, a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer your contributions, where such license applies only to those patent claims licensable by you that are necessarily infringed by your contribution or by combination of your contribution with the project to which this contribution was submitted. + + If any entity institutes patent litigation - including cross-claim or counterclaim in a lawsuit - against You alleging that your contribution or any project it was submitted to constitutes or is responsible for direct or contributory patent infringement, then any patent licenses granted to that entity under this agreement shall terminate as of the date such litigation is filed. + +3. Source of Contribution. + + Your contribution is either your original creation, based upon previous work that, to the best of your knowledge, is covered under an appropriate open source license and you have the right under that license to submit that work with modifications, whether created in whole or in part by you, or you have clearly identified the source of the contribution and any license or other restriction (like related patents, trademarks, and license agreements) of which you are personally aware. diff --git a/docs/README.md b/docs/README.md index bd72287edf75b..fa7ea9eebb77b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,9 @@ +This repository, ConanCenterIndex, contains recipes for the remote [JFrog ConanCenter](https://conan.io/center/). +This remote is added by default to a clean installation of the Conan client. Recipes are contributed by opening pull requests as explained in the sections below. +When pull requests are merged, the CI will upload the generated packages to the [ConanCenter](https://conan.io/center/) remote. + # Documentation * [Code of conduct](code_of_conduct.md) @@ -7,14 +11,13 @@ * User documentation + [Contributing to Conan Center Index](../CONTRIBUTING.md) - + [Adding Packages to ConanCenter](how_to_add_packages.md) - + [Policy about patching](policy_patching.md) + + [Developing Recipes Locally](developing_recipes_locally.md) + + [Adding Packages to ConanCenter](how_to_add_packages.md) :point_left: Best place to learn how to contribute + + [Errors from the conan-center hook (KB-Hxxx)](error_knowledge_base.md) + [Review Process](review_process.md) - + [Packaging policy](packaging_policy.md) + + [Labels](labels.md) + [Supported platforms and configurations](supported_platforms_and_configurations.md) - + [Errors from the conan-center hook (KB-Hxxx)](error_knowledge_base.md) - + [FAQs](faqs.md) + + [Consuming Recipes](consuming_recipes.md) :information_source: Learn how to limit the impact of recipe changes + [Community Resources](community_resources.md) - + [Review Guidelines](reviewing.md) - + [Labels](labels.md) + [Preparing recipes for Conan 2.0](v2_migration.md) + + [FAQs](faqs.md) diff --git a/docs/changelog.md b/docs/changelog.md index 335787481aa1e..020830e28edf7 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,31 @@ # Changelog +### 17-October-2022 - 10:33 CEST + +- [feature] Improve management of GitHub labels on pull requests. +- [feature] New EpochsSummary job to show epoch status for each reference. +- [feature] Save bot comments as labels as job artifacts for easier user feedback. +- [feature] Ability to wait for a job and merge bot messages from another pipeline: Allows to provide feedback to users in PRs from the Conan v2 pipeline in the future. +- [feature] Add timeout to AutomaticMerge job. +- [feature] Add note about Windows SDK on supported platforms documentation. +- [fix] Fix getting package IDs from Artifactory in the Conan v2 pipeline. +- [fix] Bump dependencies pull requests should only consider modified comments. +- [fix] ValidateInfrastructure job parameter for macos executors. + +### 20-September-2022 - 14:27 CEST + +- [feature] Handle scenarios where some files are removed. +- [feature] Simplify logic to detect references to be built in a pull request. +- [feature] Workaround in Conan v2 commands to list package IDs in a pull request. +- [feature] Bump minimum required Conan client version. +- [fix] When merging a pull request, check recipe revisions only against the pull-request repository. +- [fix] Do not consider GitHub check runs for pull requests opened by a bot. +- [fix] Consider files renamed in pull requests as "added" and "removed". +- [fix] Cover use-case when a pull request adds just one conanfile.py. +- [fix] Simplify assignment of GitHub labels. +- [fix] Use backquotes in GitHub comments. +- [fix] Fix promotion of packages with Conan v2. + ### 1-September-2022 - 10:21 CEST - [feature] Avoid `test_v?_package` folders that don't match the Conan version. diff --git a/docs/community_resources.md b/docs/community_resources.md index 6a09713749810..265ae610b3327 100644 --- a/docs/community_resources.md +++ b/docs/community_resources.md @@ -13,6 +13,8 @@ This is a curated list of various bots and helpful tools that aim to making appr The community is very active on the [Cpplang's Slack channel](https://cpplang.slack.com/archives/C41CWV9HA), it's a great place to get help. +If you are looking to stay up to date with the last Conan news, follow us on Twitter [@conan_io](https://twitter.com/conan_io) + ## Bots - [Updatable Recipes](https://github.com/qchateau/conan-center-bot): Automatically scans available recipes and checked for new upstream releases and tests one configuration diff --git a/docs/conandata_yml_format.md b/docs/conandata_yml_format.md index a1222e4125c92..fed5e9e464396 100644 --- a/docs/conandata_yml_format.md +++ b/docs/conandata_yml_format.md @@ -212,7 +212,7 @@ Usually, the following kind of problems are good candidates for backports: - Data corruption. - Use of outdated or deprecated API or library. -As sources with backports don't act exactly the same as the version officially released, it may be a source of confusion for the consumers who are relying on the buggy behavior (even if it's completely wrong). Therefore, it's required to introduce a new `cci.` version for such backports, so consumers may choose to use either official version, or modified version with backport(s) included. +As sources with backports don't act exactly the same as the version officially released, it may be a source of confusion for the consumers who are relying on the buggy behavior (even if it's completely wrong). Therefore, it's required to introduce a new `cci.` version for such backports, so consumers may choose to use either official version, or modified version with backport(s) included. ##### portability diff --git a/docs/consuming_recipes.md b/docs/consuming_recipes.md index c58bbc2e2991c..ee80883fc7130 100644 --- a/docs/consuming_recipes.md +++ b/docs/consuming_recipes.md @@ -1,128 +1,68 @@ # Consuming recipes -Recipes in this repository are evolving continuously, contributors are creating pull-requests -fixing issues and adding new features every day. It is expected that from time to time these -new recipe revisions stop to work in your project. +ConanCenter has always maintained recipes consumers need to have an up to date client for the best experience. +The reason is there are constantly improvements and fixes being made, sometimes those require new Conan features +to be possible. There are usually waves of new features, patches and fixes that allow for even better quality recipes. ## Contents * [Breaking changes](#breaking-changes) - * [Isolate your project from upstream changes](#isolate-your-project-from-upstream-changes) - * [Use your own Artifactory instance](#use-your-own-artifactory-instance) - * [Use recipe revisions and lockfiles](#use-recipe-revisions-and-lockfiles) + * [Isolate your project from upstream changes](#isolate-your-project-from-upstream-changes) ## Breaking changes -There can be several root causes if a recipe (a new revision) stopped to work in your project: +There can be several causes if a recipe (a new revision) might stopped to work in your project: - * **Fixes in recipes** that modify the libraries they are creating: exported symbols, +- **Fixes in recipes** that modify the libraries they are creating: exported symbols, compiler flags, generated files for your build system, CMake target names,... Every contributor tries to do their best and reviewers do an amazing work checking that the changes are really improving recipes. - - * **New Conan features (breaking syntax)**: sometimes Conan introduces a new feature that - requires new attributes or statements in recipes. If your Conan client is not new enough, +- **New Conan features (breaking syntax)** sometimes requires new attributes or statements in recipes. + If your Conan client is not new enough, Conan will fail to parse the recipe and will raise a cryptic Python syntax error. - This use case is covered by the [`required_conan_version`](https://docs.conan.io/en/latest/reference/conanfile/other.html?highlight=required_conan_version#requiring-a-conan-version-for-the-recipe) feature. It will - substitute the syntax error by one nicer error provided by Conan client. - - * **New Conan features**: Conan keeps evolving and adding new features in its road to Conan v2, - and ConanCenter is committed in this roadmap as well, and tries to push the user base to these +- **New Conan Version**: Conan keeps evolving and adding new features, especially on its road to Conan 2.0, + and ConanCenter is committed in this [roadmap](v2_roadmap.md) as well, and tries to prepare the user base to these new features in order to ease the migration to new versions. New recipe revisions can take into account changes that are introduced in new Conan client version, sometimes these changes modify some experimental behavior without modifying recipe syntax. - When these changes are in the critical path to Conan v2 we can introduce the - `required_conan_version` statement to be sure that people using these new experimental - features are using the required Conan version and testing the actual behavior of those - features (feedback about them is very important to Conan). - -## Isolate your project from upstream changes - -There are two main ways you can isolate your project from changes in recipes: - - * **Cache recipes in your own Artifactory**: your project should use only this remote and - new recipe revisions are only pushed to your Artifactory after they have been validated - in your project. - * **Pin the version of every reference you consume in your project** using recipe revisions - and lockfiles. - -### Use your own Artifactory instance - -Using your own Artifactory instance is not as complicated as it sounds. You can [deploy it -on-premise](https://conan.io/downloads.html) or use a [cloud provided solution](https://jfrog.com/start-free/?isConan=true) for free. - -Once you have configured your Artifactory instance, you should ensure that your project is -using only that remote (`conan remote list`). Conan makes it easy to use different configurations -per project (check `CONAN_USER_HOME` env variable) or to store the configuration in some external -file or repository so you can shared and install it using one command (`conan config install ...`). +This use case is covered by the [`required_conan_version`](https://docs.conan.io/en/latest/reference/conanfile/other.html?highlight=required_conan_version#requiring-a-conan-version-for-the-recipe) feature. It will +substitute the syntax error by one nicer error provided by Conan client. -### Use recipe revisions and lockfiles +To be sure that people using these new experimental features are using the required Conan version and testing the actual behavior +of those features (feedback about them is very important to Conan). -If you don't want to deploy and maintain your own Artifactory instance, you can isolate from -changes in upstream recipes in ConanCenter using [recipe revisions](https://docs.conan.io/en/latest/versioning/revisions.html) -and [lockfiles](https://docs.conan.io/en/latest/versioning/lockfiles.html) (please, read linked Conan documentation for more detailed -explanation). - -Recipe revisions and lockfiles can be used to define exactly the binary you want to use in -your project. **Nothing is removed from ConanCenter**, even if the recipe is modified and new -binaries are generated for the same configurations, existing binaries are still there, you -just need to instruct Conan to use them even if new ones are available. - -**Recipe revisions** are the way to tell Conan to use a specific snapshot of the recipe. It -is a hash added to the reference and can be used in Conan at the same place as regular -revisions: - - * In the command line: - - ```sh - conan install openssl/3.0.1@#1955937e88f13a02aa4fdae98c3f9fb8 - ``` - - * In a `conanfile.txt` file: - - ```txt - [requires] - openssl/3.0.1@#1955937e88f13a02aa4fdae98c3f9fb8 - ``` - -If you use explicit recipe revisions in your project you can be sure that Conan will always use -the same recipe revision of those references. You might get new binaries if the same -configuration (same packageID) is built again for the same recipe revision, but that is not -going to be a _compatibility problem_. +## Isolate your project from upstream changes -This might not be enough for some projects, where you want -to be sure nothing is modified, not just the revisions you are listing explicitly but also any -other transitive dependency, this is what lockfiles are for. +This has always been a concern from ConanCenter consumers. -**Lockfiles** are files where all the information about requirements is written: recipe -revisions, package IDs and package revisions. You can create a lockfile with all the -dependencies for your project once you are happy with them, and use that same lockfile -with every Conan command. Conan will always build the same graph (the locked one) and -will always retrieve the same recipes and binaries. +Conan is very flexible; you can add your own remote or modify your client’s configuration for more granularity. We see the majority of Conan users hosting their own remote, and only consuming packages from there. For production this is the recommended way to add some infrastructure to ensure stability. This is generally a good practice when relying on package managers - not just Conan. -Then, it would be up to you to generate a new lockfile if you want to introduce new revisions -for existing references. +Here are a few choices: -The two basic commands you need to know ([full docs here](https://docs.conan.io/en/latest/versioning/lockfiles.html)): +- [Running your own Conan Server](https://docs.conan.io/en/latest/uploading_packages/running_your_server.html) - great for local ad-hoc setups +- [Cache recipes in your own ArtifactoryCE](https://docs.conan.io/en/latest/uploading_packages/using_artifactory.html) - recommended for production environments - * Create lockfile from `conanfile.txt` file: +Using your own ArtifactoryCE instance is easy. You can [deploy it on-premise](https://conan.io/downloads.html) or use a +[cloud provided solution](https://jfrog.com/community/start-free) for **free**. Your project should +[use only this remote](https://docs.conan.io/en/latest/reference/commands/misc/remote.html?highlight=add%20new) and new recipe +revisions are only pushed to your Artifactory after they have been validated in your project. - ```sh - conan lock create conanfile.txt --lockfile-out=locks/project.lock - ``` +The minimum solution, if still choosing to rely on ConanCenter directly, involves small changes to your client configuration by pinning the revision of every reference you consume in your project using using: - * Consume a lockfile: +- [recipe revision (RREV)](https://docs.conan.io/en/latest/versioning/revisions.html) can be added to each requirement. + Instead of `fmt/9.1.0` you can add a pound (or hashtag) to the end followed by the revision `fmt/9.1.0#c93359fba9fd21359d8db6f875d8a233`. + This feature needs to be enabled in Conan 1.x, see the [Activation Instructions](https://docs.conan.io/en/latest/versioning/revisions.html#how-to-activate-the-revisions) for details. +- [Lockfiles](https://docs.conan.io/en/latest/versioning/lockfiles.html) can be created with the `conan lock create` and read with by + adding `--lockfile=conan.lock` to `conan install` or `conan create` commands. See the [lockfile introduction](https://docs.conan.io/en/latest/versioning/lockfiles/introduction.html#) for more information. - ```sh - conan install conanfile.txt --lockfile=locks/project.lock - ``` +> **Warning** Please, be aware there are some known bugs related to lockfiles that are not being fixed in Conan v1.x - we are really excited for the 2.0 improvements to be widely used. -If your project is managing several configurations, you would probably like to have a look to [base lockfiles](https://docs.conan.io/en/latest/versioning/lockfiles/configurations.html#base-lockfiles) and [lockfile bundles](https://docs.conan.io/en/latest/versioning/lockfiles/bundle.html) in the documentation. +Both of these give you better control and will allow you to choose when to upgrade your Conan client. --- diff --git a/docs/developing_recipes_locally.md b/docs/developing_recipes_locally.md new file mode 100644 index 0000000000000..57d98ecb3a216 --- /dev/null +++ b/docs/developing_recipes_locally.md @@ -0,0 +1,222 @@ +# Developing Recipes Locally + +Before you can contribute any code changes, you'll need to make sure you are familiar with the Conan client and have an environment that is conducive to developing recipes. + +This file is intended to provide all the commands you need to run in order to be an expert ConanCenter contributor. + + +## Contents + + * [Clone your fork](#clone-your-fork) + * [Setup your environment](#setup-your-environment) + * [Installing the ConanCenter Hooks](#installing-the-conancenter-hooks) + * [Updating conan hooks on your machine](#updating-conan-hooks-on-your-machine) + * [Basic Commands](#basic-commands) + * [Try it yourself](#try-it-yourself) + * [Debugging Failed Builds](#debugging-failed-builds) + * [Running the Python Linters](#running-the-python-linters) + * [Testing the different `test__package`](#testing-the-different-test__package) + * [Testing more environments](#testing-more-environments) + * [Using Conan 2.0](#using-conan-20) + * [Installing Conan 2.0 beta](#installing-conan-20-beta) + * [Trying it out](#trying-it-out) + +## Clone your fork + +1. Follow the GitHub UI to [fork this repository](https://github.com/conan-io/conan-center-index/fork) +2. [Clone your fork](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) + +## Setup your environment + +1. Install a C++ development toolchain - ConanCenter's [build images](#testing-more-environments) are available +2. [Install the Conan client](https://docs.conan.io/en/latest/installation.html) - make sure to keep it up to date! +3. Install CMake - this is the only tool which is assumed to be present + [see FAQ](faqs.md#why-recipes-that-use-build-tools-like-cmake-that-have-packages-in-conan-center-do-not-use-it-as-a-build-require-by-default) for details. + +> **Note**: It's recommended to use a dedicated Python virtualenv when installing with `pip`. + +### Installing the ConanCenter Hooks + +The system will use the [conan-center hooks](https://github.com/conan-io/hooks) to perform some quality checks. You can install the hooks by running: + +```sh +conan config install https://github.com/conan-io/hooks.git -sf hooks -tf hooks +conan config set hooks.conan-center +``` + +The hooks will show error messages but the `conan create` won’t fail unless you export the environment variable `CONAN_HOOK_ERROR_LEVEL=40`. +All hooks checks will print a similar message: + +```txt +[HOOK - conan-center.py] post_source(): [LIBCXX MANAGEMENT (KB-H011)] OK +[HOOK - conan-center.py] post_package(): ERROR: [PACKAGE LICENSE] No package licenses found +``` + +#### Updating conan hooks on your machine + +The hooks are updated from time to time, so it's worth keeping your own copy of the hooks updated regularly. To do this, simply run: + +```sh +conan config install +``` + +## Basic Commands + +We recommend working from the `recipes/project` folder itself. You can learn about the [recipe file structure](how_to_add_packages.md#recipe-files-structure) to understand the folder and files located there. + +> **Note**: You can only change one recipe per pull request, and working from the [_recipe folder_](how_to_add_packages.md#the-recipe-folder-conanfilepy) will help prevent making a few mistakes. The default for this folder is `all`, follow the link above to learn more. + +The [entire workflow of a recipe](https://docs.conan.io/en/latest/developing_packages/package_dev_flow.html) can be execute with the [`conan create`](https://docs.conan.io/en/latest/reference/commands/creator/create.html). This should look like: + +* `conan create all/conanfile.py 0.0.0@ -pr:b=default -pr:h=default` + +ConanCenter also has a few [support settings and options](supported_platforms_and_configurations.md) which highly recommend to test. For example +`conan create all/conanfile.py 0.0.0@ -o project:shared=True -s build_type=Debug` is a easy way to test more configurations ensuring the package is correct. + +### Try it yourself + +For instance you can create packages for `fmt` in various supported configurations by running: + +```sh +cd recipes/fmt +conan create all/conanfile.py fmt/9.0.0@ -pr:b=default -pr:h=default +conan create all/conanfile.py fmt/9.0.0@ -o fmt:header_only=True -pr:b=default -pr:h=default +conan create all/conanfile.py fmt/9.0.0@ -s build_type=Debug -o fmt:shared=True -pr:b=default -pr:h=default +``` + +## Debugging Failed Builds + +Some common errors related to Conan can be found on [troubleshooting](https://docs.conan.io/en/latest/faq/troubleshooting.html) section. +For ConanCenter Hook errors, go to the [Error Knowledge Base](error_knowledge_base.md) page to know more about those. + +To test with the same environment, the [build images](supported_platforms_and_configurations.md#build-images) are available. +Instructions for using these images can be found in [Testing more environments](#testing-more-environments) section. + +In ConanCenterIndex, the most common failure point is upstream +build script that are tailored to their specific use cases. It's not uncommon to [patch build scripts](policy_patching.md#policy-about-patching) but make sure to read the [patch policy](policy_patching.md). You are encouraged to submit pull requests upstream. + +## Running the Python Linters + +Linters are always executed by Github actions to validate parts of your recipe, for instance, if it uses migrated Conan tools imports. + +It is possible to run the linter locally the same way it is being run [using Github actions](../.github/workflows/linter-conan-v2.yml) by: + +* (Recommended) Use a dedicated Python virtualenv. +* Ensure you have required tools installed: `conan` and `pylint` (better to uses fixed versions) + + ```sh + pip install conan~=1.0 pylint==2.14 + ``` + +* Set environment variable `PYTHONPATH` to the root of the repository + + ```sh + export PYTHONPATH=your/path/conan-center-index + ``` + +* Now you just need to execute the `pylint` commands: + + ```sh + # Lint a recipe: + pylint --rcfile=linter/pylintrc_recipe recipes/fmt/all/conanfile.py + + # Lint the test_package + pylint --rcfile=linter/pylintrc_testpackage recipes/fmt/all/test_package/conanfile.py + ``` + +## Testing the different `test_*_package` + +This can be selected when calling `conan create` or separately with `conan test` + +```sh +# By adding the `-tf` argument +conan create recipes/fmt/all/conanfile.py 9.0.0@ -tf test_v1_package/ -pr:b=default -pr:h=default +``` + +```sh +# Passing test package's conanfile directly (make sure to export first) +conan test recipes/fmt/all/test_v1_package/conanfile.py fmt/9.0.0@ -pr:h=default -pr:b=default +``` + +## Testing more environments + +This can be difficult for some platforms given virtualization support. + +For Windows and MacOS users, you can test the Linux build environments with the Docker build images. + +Assuming you've already tested it locally and it's been successfully exported to your cache, you can: + +1. Creating a new profile. + * You can also download them from CCI build summary +2. Build missing packages + +Example. + +```sh +docker run -v/Users/barbarian/.conan:/home/conan/.conan conanio/gcc8 bash -c "conan profile new --detect gcc8" +docker run -v/Users/barbarian/.conan:/home/conan/.conan conanio/gcc8 bash -c "conan install -pr gcc8 fmt/9.0.0@ --build missing" +``` + +> **Note**: If you are running on Mac M1, the follow Docker argument is required: `--platform=linux/amd64` + +If you are working with packages that have system dependencies that are managed by Conan + +```sh +docker run -e CONAN_SYSREQUIRES_MODE=enabled conanio/gcc11-ubuntu16.04 conan install fmt/9.0.0@ -if build --build missing -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=yes +``` + +## Using Conan 2.0 + +Everything you need to know about the methods, commands line, outputs can be found in the +[Conan 2.0 Migrations](https://docs.conan.io/en/latest/conan_v2.html) docs. + +This should be non-intrusive. Conan 2.0 by default has a different `CONAN_USER_HOME` location, which means that it has separate caches, profiles, and settings. +This will leave your Conan 1.0 setup completely intact when using Conan 2.0. + +> **Note**: There are substantial changes to the CLI so very few of the commands will remain the same. +> The new [Unified Command Pattern](https://docs.conan.io/en/latest/migrating_to_2.0/commands.html#unified-patterns-in-command-arguments), +> as an example, changes how settings and options are passed. + +### Installing Conan 2.0 beta + +Simply install Conan 2.0 with `pip install conan --upgrade --pre`. + +You can confirm the installation with: + +```sh +$ conan --version +Conan version 2.0.0-beta3 +$ conan config home +Current Conan home: /Users/barbarian/.conan2 +``` + +> **Note**: You will most likely see +> +> ```sh +> Initialized file: '/Users/barbarian/.conan2/settings.yml' +> Initialized file: '/Users/barbarian/.conan2/extensions/plugins/compatibility/compatibility.py' +> Initialized file: '/Users/barbarian/.conan2/extensions/plugins/compatibility/app_compat.py' +> Initialized file: '/Users/barbarian/.conan2/extensions/plugins/compatibility/cppstd_compat.py' +> Initialized file: '/Users/barbarian/.conan2/extensions/plugins/profile.py' +> ``` +> +> When running the client for the first time. + +You will need to setup profiles. This is one of the changes in 2.0. The default profile is now opt-in and no longer generated automatically. + +```sh +conan profile detect +``` + +> **Warning**: This is a best guess, you need to make sure it's correct. + +### Trying it out + +Try building an existing recipe. We'll repeat the 1.x example with `fmt` to build the same configurations: + +```sh +cd recipes/fmt +conan create all/conanfile.py --version 9.0.0 +conan create all/conanfile.py --version 9.0.0 -o fmt/9.0.0:header_only=True +conan create all/conanfile.py --version 9.0.0 -s build_type=Debug -o fmt/9.0.0:shared=True +``` diff --git a/docs/error_knowledge_base.md b/docs/error_knowledge_base.md index bbea3128fdd97..8b08e5b00ee35 100644 --- a/docs/error_knowledge_base.md +++ b/docs/error_knowledge_base.md @@ -463,6 +463,14 @@ def package_info(self): self.cpp_info.includedirs = [] ``` +#### **#KB-H072: "PYLINT EXECUTION"** + +Pylint is executed by default over all `conanfile.py` files in ConanCenterIndex and it should not be skipped. It's an important tool which helps us keep a standard level of acceptance. Otherwise, it would be incredibly hard to review all recipes and keep them to the same level of standards. + +#### **#KB-H073: "TEST V1 PACKAGE FOLDER"** + +The legacy content in test_package should not be removed. Instead, rename that folder to `test_v1_package` and create a new `test_package` folder following the [file structure](https://github.com/conan-io/conan-center-index/blob/master/docs/how_to_add_packages.md#recipe-files-structure) related to Conan v2 and v1 compatibility. Also, you can obtain good examples of Conan v2 test packages from the [template packages](https://github.com/conan-io/conan-center-index/tree/master/docs/package_templates) folder. + ## Deprecated errors The following errors from the hooks are deprecated and no longer reported: diff --git a/docs/faqs.md b/docs/faqs.md index dc593ab6cc44d..7520683aecc5e 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -15,14 +15,17 @@ This section gathers the most common questions from the community related to pac * [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) * [Why not x86 binaries?](#why-not-x86-binaries) - * [But if there are no packages available, what will the x86 validation look like?](#but-if-there-are-no-packages-available-what-will-the-x86-validation-look-like) + * [But if there are no packages available, what will the x86 validation look like?](#but-if-there-are-no-packages-available-what-will-the-x86-validation-look-like) + * [Do static libraries tend to be compiled as PIC by default?](#do-static-libraries-tend-to-be-compiled-as-pic-by-default) * [Why PDB files are not allowed?](#why-pdb-files-are-not-allowed) - * [Why is there no option for PDB, as there is for fPIC?](#why-is-there-no-option-for-pdb-as-there-is-for-fpic) + * [Why is there no option for PDB, as there is for fPIC?](#why-is-there-no-option-for-pdb-as-there-is-for-fpic) + * [Doesn't this make debug builds useless?](#doesnt-this-make-debug-builds-useless) * [Can I remove an option from a recipe?](#can-i-remove-an-option-from-a-recipe) * [Can I split a project into an installer and library package?](#can-i-split-a-project-into-an-installer-and-library-package) * [What license should I use for Public Domain?](#what-license-should-i-use-for-public-domain) * [What license should I use for a custom project specific license?](#what-license-should-i-use-for-a-custom-project-specific-license) - * [Why is a `tools.check_min_cppstd` call not enough?](#why-is-a-toolscheck_min_cppstd-call-not-enough) + * [How do I flag a problem to a recipe consumer?](#how-do-i-flag-a-problem-to-a-recipe-consumer) + * [Why is a `build.check_min_cppstd` call not enough?](#why-is-a-buildcheck_min_cppstd-call-not-enough) * [What is the policy for adding older versions of a package?](#what-is-the-policy-for-adding-older-versions-of-a-package) * [What is the policy for removing older versions of a package?](#what-is-the-policy-for-removing-older-versions-of-a-package) * [Can I install packages from the system package manager?](#can-i-install-packages-from-the-system-package-manager) @@ -33,7 +36,8 @@ This section gathers the most common questions from the community related to pac * [How to protect my project from breaking changes in recipes?](#how-to-protect-my-project-from-breaking-changes-in-recipes) * [Why are version ranges not allowed?](#why-are-version-ranges-not-allowed) * [How to consume a graph of shared libraries?](#how-to-consume-a-graph-of-shared-libraries) - * [How to watch only specific recipes?](#how-to-watch-only-specific-recipes) + * [How to watch only specific recipes?](#how-to-watch-only-specific-recipes) + * [Is it possible to disable Pylint?](#is-it-possible-to-disable-pylint) ## What is the policy on recipe name collisions? @@ -104,7 +108,7 @@ Unless they are a general and extended utility in recipes (in which case, we sho ## What version should packages use for libraries without official releases? -The notation shown below is used for publishing packages where the original library does not make official releases. Thus, we use a format which includes the datestamp corresponding to the date of a commit: `cci.`. In order to create reproducible builds, we also "commit-lock" to the latest commit on that day. Otherwise, users would get inconsistent results over time when rebuilding the package. An example of this is the [RapidJSON](https://github.com/Tencent/rapidjson) library, where its package reference is `rapidjson/cci.20200410` and its sources are locked the latest commit on that date in [config.yml](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidjson/config.yml#L4). The prefix `cci.` is mandatory to distinguish as a virtual version provided by CCI. If you are interested to know about the origin, please, read [here](https://github.com/conan-io/conan-center-index/pull/1464). +The notation shown below is used for publishing packages where the original library does not make official releases. Thus, we use a format which includes the datestamp corresponding to the date of a commit: `cci.`. In order to create reproducible builds, we also "commit-lock" to the latest commit on that day (use UTC+00). Otherwise, users would get inconsistent results over time when rebuilding the package. An example of this is the [RapidJSON](https://github.com/Tencent/rapidjson) library, where its package reference is `rapidjson/cci.20200410` and its sources are locked the latest commit on that date in [conandata.yml](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidjson/all/conandata.yml#L5). The prefix `cci.` is mandatory to distinguish as a virtual version provided by CCI. If you are interested to know about the origin, please, read [here](https://github.com/conan-io/conan-center-index/pull/1464). ## Is the Jenkins orchestration library publicly available? @@ -125,6 +129,10 @@ As stated earlier, any increase in the number of configurations will result in a We often receive new fixes and improvements to the recipes already available for x86_64, including help for other architectures like x86 and ARM. In addition, we also receive new cases of bugs, for recipes that do not work on a certain platform, but that are necessary for use, which is important to understand where we should put more effort. So we believe that the best way to maintain and add support for other architectures is through the community. +## Do static libraries tend to be compiled as PIC by default? + +Yes! You can learn more about default options in [Packaging Policy](packaging_policy.md#options). + ## Why PDB files are not allowed? The project initially decided not to support the PDB files primarily due to the size of the final package, which could add an exaggerated size and not even used by users. In addition, PDB files need the source code to perform the debugging and even follow the path in which it was created and not the one used by the user, which makes it difficult to use when compared to the regular development flow with the IDE. @@ -135,6 +143,11 @@ However, there are ways to get around this, one of them is through the [/Z7](htt Adding one more common option, it seems the most simple and obvious solution, but it contains a side effect already seen with fPIC. It is necessary to manage the entire recipe, it has become a Boilerplate. So, adding PDB would be one more point to be reviewed for each recipe. In addition, in the future new options could arise, such as sanity or benchmark, further inflating the recipes. For this reason, a new option will not be added. However, the inclusion of the PDB files is discussed in issue [#1982](https://github.com/conan-io/conan-center-index/issues/1982) and there are some ideas for making this possible through a new feature. If you want to comment on the subject, please visit issue. +### Doesn't this make debug builds useless? + +No. The PDBs are only needed to debug dependency code. By providing the libraries you are able to link and build your application and debug your own code. +This is by far the more common scenario which we want to enable. + ## Can I remove an option from a recipe? It's preferable to leave all options (ie. not removing them) because it may break other packages which require those deleted options. @@ -247,8 +260,7 @@ There are different motivations ## Why not add an option to build unit tests - Adding a testing option will change the package ID, but will not provide different packaged binaries -- Use the configuration [skip_test](packaging_policy.md#options) to define the testing behavior. - +- Use the configuration [skip_test](packaging_policy.md#options-to-avoid) to define the testing behavior. ## What is the policy for supported python versions? @@ -341,21 +353,8 @@ You should expect that latest revision of recipes can introduce breaking changes features that will be broken unless you also upgrade Conan client (and sometimes you will need to modify your project if the recipe changes the binaries, flags,... it provides). -To isolate from this changes there are different strategies you can follow: - -The minimum solution involves small changes to your Conan client configuration by - -* **Pin the version of every reference you consume in your project** using either: - * [recipe revision (RREV)](https://docs.conan.io/en/latest/versioning/revisions.html): `foo/1.0@#RREV` instead of `foo/1.0` in your conanfile. - * [lockfiles](https://docs.conan.io/en/latest/versioning/lockfiles/introduction.html) (please, be aware there are some [knowns bugs](https://github.com/conan-io/conan/issues?q=is%3Aissue+lockfile) related to lockfiles that are not being fixed in Conan v1.x). - -For larger projects and teams it is recommended to add some infrastructure to ensure stability by - - * **Cache recipes in your own Artifactory**: your project should use only this remote and - new recipe revisions are only pushed to your Artifactory after they have been validated - in your project. - -Keep reading in the [consuming recipes section](consuming_recipes.md). +To isolate from these changes there are different strategies you can follow. +Keep reading in the [consuming recipes section](consuming_recipes.md#isolate-your-project-from-upstream-changes). ## Why are version ranges not allowed? @@ -405,3 +404,8 @@ The [Code Owners](https://docs.github.com/en/repositories/managing-your-reposito write permission for any listed user in the file `.github/CODEOWNERS`, which makes it impossible to be accepted by Conan. However, that file is still important as it can be re-used in a future Github Action to parse and communicate users. Meanwhile, there is the project https://app.github-file-watcher.com/, which is able to notify users, but only after merging to the master branch. Feel free to contribute to a new Github Action that implements a file watcher feature. + +## Is it possible to disable Pylint? + +No. The [pylint](v2_linter.md) has an important role of keeping any recipe prepared for [Conan v2 migration](v2_migration.md). In case you are having +difficult to understand [linter errors](linters.md), please comment on your pull request about the problem to receive help from the community. diff --git a/docs/how_to_add_packages.md b/docs/how_to_add_packages.md index a3d58c0bb19af..778b437005387 100644 --- a/docs/how_to_add_packages.md +++ b/docs/how_to_add_packages.md @@ -1,8 +1,11 @@ # Adding Packages to ConanCenter -The [conan-center-index](https://github.com/conan-io/conan-center-index) (this repository) contains recipes for the remote [JFrog ConanCenter](https://conan.io/center/). -This remote is added by default to a clean installation of the Conan client. Recipes are contributed by opening pull requests as explained in the sections below. -When pull requests are merged, the CI will upload the generated packages to the [conancenter](https://conan.io/center/) remote. +ConanCenterIndex aims to provide the best quality packages of any open source project. +Any C/C++ project can be made available by contributing a "recipe". + +Getting started is easy. Try building an existing package with our [developing recipes](developing_recipes_locally.md) tutorial. +To deepen you understanding, start with the [How to provide a good recipe](#how-to-provide-a-good-recipe) section. +You can follow the three steps (:one: :two: :three:) described below! :tada: ## Contents @@ -26,8 +29,8 @@ When pull requests are merged, the CI will upload the generated packages to the * [Verifying Dependency Version](#verifying-dependency-version) * [Verifying Dependency Options](#verifying-dependency-options) * [Test the recipe locally](#test-the-recipe-locally) - * [Updating conan hooks on your machine](#updating-conan-hooks-on-your-machine) - * [Debugging failed builds](#debugging-failed-builds) + * [Hooks](#hooks) + * [Linters](#linters) ## Request access @@ -39,13 +42,17 @@ This process helps conan-center-index against spam and malicious code. The proce > :warning: The requests are reviewed manually, checking the GitHub profile activity of the requester to avoid a misuse of the service. In case of detecting a misuse or inappropriate behavior, the requester will be dropped from the authorized users list and at last instance even banned from the repository. +When submitting a pull request for the first time, you will be prompted to sign the [CLA](CONTRIBUTOR_LICENSE_AGREEMENT.md) for your code contributions. +You can view your signed CLA's by going to and signing in. + ## Submitting a Package :two: To contribute a package, you can submit a [Pull Request](https://github.com/conan-io/conan-center-index/pulls) to this GitHub repository https://github.com/conan-io/conan-center-index. 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. -* Create a new folder with the Conan package recipe (`conanfile.py`) in the correct folder. +* 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. * 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. @@ -84,7 +91,10 @@ This is the canonical structure of one of these folders, where the same `conanfi | +-- test_package/ | +-- conanfile.py | +-- CMakeLists.txt -| +-- main.cpp +| +-- test_package.cpp +| +-- test_v1_package/ +| +-- conanfile.py +| +-- CMakeLists.txt ``` If it becomes too complex to maintain the logic for all the versions in a single `conanfile.py`, it is possible to split the folder `all` into @@ -93,7 +103,7 @@ same structure. ### `config.yml` -This file lists the versions and the folders where they are located (if there are more than a single `all` folder): +This file lists the versions and the folders where they are located: ```yml versions: @@ -110,22 +120,21 @@ versions: ### `conandata.yml` -This file lists **all the sources that are needed to build the package**: source code, license files,... any file that will be used by the recipe +This file lists **all the sources that are needed to build the package**: source code, patch files, license files,... any file that will be used by the recipe should be listed here. The file is organized into two sections, `sources` and `patches`, each one of them contains the files that are required for each version of the library. All the files that are downloaded from the internet should include a checksum, so we can validate that they are not changed. -A detailed breakdown of all the fields can be found in [conandata_yml_format.md](conandata_yml_format.md). We strongly encourage adding the [patch fields](conandata_yml_format.md#patches-fields) to help track where patches come from and what issue they solve. +A detailed breakdown of all the fields can be found in [conandata_yml_format.md](conandata_yml_format.md). We **strongly** encourage adding the [patch fields](conandata_yml_format.md#patches-fields) to help track where patches come from and what issue they solve. Inside the `conanfile.py` recipe, this data is available in a `self.conan_data` attribute that can be used as follows: ```py +def export_sources(self): + export_conandata_patches(self) + def source(self): files.get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - -def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - files.copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def build(self): files.apply_conandata_patches(self) @@ -137,13 +146,12 @@ More details can be found in the [reviewing preference](reviewing.md) documentat ### The _recipe folder_: `conanfile.py` The main files in this repository are the `conanfile.py` ones that contain the logic to build the libraries from sources for all the configurations, -as we said before there can be one single recipe suitable for all the versions inside the `all` folder, or there can be several recipes targetting -different versions in different folders. For mainteinance reasons, we prefer to have only one recipe, but sometimes the extra effort doesn't worth +as we said before there can be one single recipe suitable for all the versions inside the `all` folder, or there can be several recipes targeting +different versions in different folders. For maintenance reasons, we prefer to have only one recipe, but sometimes the extra effort doesn't worth it and it makes sense to split and duplicate it, there is no common rule for it. -Together with the recipe, there can be other files that are needed to build the library: patches, other files related to build systems (many recipes -include a `CMakeLists.txt` to run some Conan logic before using the one from the library),... all these files will usually be listed in the -`exports_sources` attribute and used during the build process. +Together with the recipe, there can be other files that are needed to build the library: patches, other files related to build systems, +... all these files will usually be listed in `exports_sources` and used during the build process. Also, **every `conanfile.py` should be accompanied by one or several folder to test the generated packages** as we will see below. @@ -151,12 +159,14 @@ Also, **every `conanfile.py` should be accompanied by one or several folder to t All the packages in this repository need to be tested before they join ConanCenter. A `test_package` folder with its corresponding `conanfile.py` and a minimal project to test the package is strictly required. You can read about it in the -[Conan documentation](https://docs.conan.io/en/latest/creating_packages/getting_started.html#the-test-package-folder). +[Conan documentation](https://docs.conan.io/en/latest/creating_packages/getting_started.html). + Sometimes it is useful to test the package using different build systems (CMake, Autotools,...). Instead of adding complex logic to one `test_package/conanfile.py` file, it is better to add another `test_/conanfile.py` file with a minimal example for that build system. That way the examples will be short and easy to understand and maintain. In some other situations it could be useful to test different Conan generators -(`cmake_find_package`, `CMakeDeps`,...) using different folders and `conanfile.py` files ([see example](https://github.com/conan-io/conan-center-index/tree/master/recipes/fmt/all)). +(`cmake_find_package`, `CMakeDeps`,...) using different folders and `conanfile.py` files +([see example](https://github.com/conan-io/conan-center-index/tree/master/recipes/fmt/all)). When using more than one `test_` folder, create a different project for each of them to keep the content of the `conanfile.py` and the project files as simple as possible, without the need of extra logic to handle different scenarios. @@ -182,12 +192,12 @@ project files as simple as possible, without the need of extra logic to handle d The CI will explore all the folders and run the tests for the ones matching `test_*/conanfile.py` pattern. You can find the output of all of them together in the testing logs. -> **Note.-** If, for any reason, it is useful to write a test that should only be checked using Conan v1, you can do so by using the pattern +> **Note**: If, for any reason, it is useful to write a test that should only be checked using Conan v1, you can do so by using the pattern > `test_v1_*/conanfile.py` for the folder. Please, have a look to [linter notes](v2_linter.md) to know how to prevent the linter from > checking these files. > Remember that the `test_` recipes should **test the package configuration that has just been generated** for the _host_ context, otherwise -> it will fail in crossbuilding scenarios. +> it will fail in cross-building scenarios. ## How to provide a good recipe @@ -196,11 +206,12 @@ The [recipes](https://github.com/conan-io/conan-center-index/tree/master/recipes ### Header Only -If you are looking for header-only projects, you can take a look on [rapidjson](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidjson/all/conanfile.py), [rapidxml](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidxml/all/conanfile.py), and [nuklear](https://github.com/conan-io/conan-center-index/blob/master/recipes/nuklear/all/conanfile.py). Also, Conan Docs has a section about [how to package header-only libraries](https://docs.conan.io/en/latest/howtos/header_only.html). +If you are looking for header-only projects, you can take a look on [header-only template](package_templates/header_only). +Also, Conan Docs has a section about [how to package header-only libraries](https://docs.conan.io/en/latest/howtos/header_only.html). ### CMake -For C/C++ projects which use CMake for building, you can take a look on [szip](https://github.com/conan-io/conan-center-index/blob/master/recipes/szip/all/conanfile.py) and [recastnavigation](https://github.com/conan-io/conan-center-index/blob/master/recipes/recastnavigation/all/conanfile.py). +For C/C++ projects which use CMake for building, you can take a look on [cmake package template](package_templates/cmake_package). #### Components @@ -208,7 +219,7 @@ Another common use case for CMake based projects, both header only and compiled, ### Autotools -However, if you need to use autotools for building, you can take a look on [mpc](https://github.com/conan-io/conan-center-index/blob/master/recipes/mpc/all/conanfile.py), [libatomic_ops](https://github.com/conan-io/conan-center-index/blob/master/recipes/libatomic_ops/all/conanfile.py), [libev](https://github.com/conan-io/conan-center-index/blob/master/recipes/libev/all/conanfile.py). +However, if you need to use autotools for building, you can take a look on [libalsa](https://github.com/conan-io/conan-center-index/blob/master/recipes/libalsa/all/conanfile.py), [kmod](https://github.com/conan-io/conan-center-index/blob/master/recipes/kmod/all/conanfile.py), [libcap](https://github.com/conan-io/conan-center-index/blob/master/recipes/libcap/all/conanfile.py). #### Components @@ -225,67 +236,47 @@ For cases where a project only offers source files, but not a build script, you The [SystemPackageTool](https://docs.conan.io/en/latest/reference/conanfile/methods.html#systempackagetool) can easily manage a system package manager (e.g. apt, pacman, brew, choco) and install packages which are missing on Conan Center but available for most distributions. It is key to correctly fill in the `cpp_info` for the consumers of a system package to have access to whatever was installed. -As example there are [glu](https://github.com/conan-io/conan-center-index/blob/master/recipes/glu/all/conanfile.py) and [OpenGL](https://github.com/conan-io/conan-center-index/blob/master/recipes/opengl/all/conanfile.py). Also, it will require an exception rule for [conan-center hook](https://github.com/conan-io/hooks#conan-center), a [pull request](https://github.com/conan-io/hooks/pulls) should be open to allow it over the KB-H032. +As example there is [xorg](https://github.com/conan-io/conan-center-index/blob/master/recipes/xorg/all/conanfile.py). Also, it will require an exception rule for [conan-center hook](https://github.com/conan-io/hooks#conan-center), a [pull request](https://github.com/conan-io/hooks/pulls) should be open to allow it over the KB-H032. ### Verifying Dependency Version -Some project requirements need to respect a version constraint. This can be enforced in a recipe by accessing the [`deps_cpp_info`](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#deps-cpp-info) attribute. -An exaple of this can be found in the [spdlog recipe](https://github.com/conan-io/conan-center-index/blob/9618f31c4d9b4da5d06f905befe9691cf105a1fc/recipes/spdlog/all/conanfile.py#L92-L94). +Some project requirements need to respect a version constraint. This can be enforced in a recipe by accessing the [`dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html) attribute. +An example of this can be found in the [fcl recipe](https://github.com/conan-io/conan-center-index/blob/1b6b496fe9a9be4714f8a0db45274c29b0314fe3/recipes/fcl/all/conanfile.py#L80). ```py -if tools.Version(self.deps_cpp_info["liba"].version) < "7": - raise ConanInvalidConfiguration(f"The project {self.name}/{self.version} requires liba > 7.x") +def validate(self): + foobar = self.dependencies["foobar"] + if self.info.options.shared and Version(foobar.ref.version) < "1.2": + raise ConanInvalidConfiguration(f"{self.ref} requires 'foobar' >=1.2 to be built as shared.") ``` -In Conan version 1.x this needs to be done in the `build` method, in future release is should be done in the `validate` method. - ### Verifying Dependency Options Certain projects are dependant on the configuration (a.k.a options) of a dependency. This can be enforced in a recipe by accessing the [`options`](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#options) attribute. -An example of this can be found in the [kealib recipe](https://github.com/conan-io/conan-center-index/blob/9618f31c4d9b4da5d06f905befe9691cf105a1fc/recipes/kealib/all/conanfile.py#L44-L46). +An example of this can be found in the [sdl_image recipe](https://github.com/conan-io/conan-center-index/blob/1b6b496fe9a9be4714f8a0db45274c29b0314fe3/recipes/sdl_image/all/conanfile.py#L93). ```py def validate(self): - if not self.options["liba"].enable_feature: - raise ConanInvalidConfiguration(f"The project {self.name}/{self.version} requires liba.enable_feature=True.") + foobar = self.dependencies["foobar"] + if not foobar.options.enable_feature: + raise ConanInvalidConfiguration(f"The project {self.ref} requires foobar:enable_feature=True.") ``` ## Test the recipe locally -The system will use the [conan-center hook](https://github.com/conan-io/hooks) to perform some quality checks. You can install the hook running: +### Hooks -```sh -conan config install https://github.com/conan-io/hooks.git -sf hooks -tf hooks -conan config set hooks.conan-center -``` - -The hook will show error messages but the `conan create` won’t fail unless you export the environment variable `CONAN_HOOK_ERROR_LEVEL=40`. -All hook checks will print a similar message: - -``` -[HOOK - conan-center.py] post_source(): [LIBCXX MANAGEMENT (KB-H011)] OK -[HOOK - conan-center.py] post_package(): ERROR: [PACKAGE LICENSE] No package licenses found -``` - -Call `conan create . lib/1.0@` in the folder of the recipe using the profile you want to test. For instance: - -```sh -cd conan-center-index/recipes/boost/all -conan create conanfile.py boost/1.77.0@ -``` - -### Updating conan hooks on your machine - -The hooks are updated from time to time, so it's worth keeping your own copy of the hooks updated regularly. To do this: - -```sh -conan config install -``` +The system will use the [conan-center hook](https://github.com/conan-io/hooks) to perform some quality checks. These are required for the +the CI to merge any pull request. -## Debugging failed builds +Follow the [Developing Recipes Locally](developing_recipes_locally.md#installing-the-conancenter-hooks) guide for instructions. Go to the [Error Knowledge Base](error_knowledge_base.md) page to know more about Conan Center hook errors. +Some common errors related to Conan can be found on the [troubleshooting](https://docs.conan.io/en/latest/faq/troubleshooting.html) section. -Some common errors related to Conan can be found on [troubleshooting](https://docs.conan.io/en/latest/faq/troubleshooting.html) section. +### Linters -To test with the same enviroment, the [build images](supported_platforms_and_configurations.md#build-images) are available. +Linters are always executed by Github actions to validate parts of your recipe, for instance, if it uses migrated Conan tools imports. +All executed linters are documented in [linters.md](linters.md). +Check the [Developing Recipes](developing_recipes_locally.md#running-the-python-linters) page for running them locally. +Check the [Developing Recipes](developing_recipes_locally.md#running-the-python-linters) for running them locally. diff --git a/docs/labels.md b/docs/labels.md index 129664ab09538..30b4d0a7eeb46 100644 --- a/docs/labels.md +++ b/docs/labels.md @@ -12,7 +12,11 @@ special meaning: * [Infrastructure](#infrastructure) * [Stale](#stale) * [Unexpected Error](#unexpected-error) - * [User-approval pending](#user-approval-pending) + * [User-approval pending](#user-approval-pending) + * [Library Request](#library-request) + * [Question](#question) + * [Upstream Update](#upstream-update) + * [conan.io/center](#conaniocenter) ## Bump dependencies @@ -50,12 +54,32 @@ any further activity. ## Unexpected Error Label [`Unexpected Error`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3A%22Unexpected+Error%22) -is assigned by the CI when the process finishes abnormally. It tries to signal all the pull requests that failed, but -didn't provide any meaningful message to the user. Usually it is some _random_ internal error and it won't happen next -time the CI runs, don't hesitate to trigger a new build in this situation. +is assigned by the CI when the process finishes abnormally. +Usually it is some _random_ internal error and it won't happen next time the CI runs. +The CI will re-start your build automatically, the Github check `continuous-integration/jenkins/pr-merge` +will be changed to the status `Pending — This commit is being built` to signalize as running. + +> **Note**: Manually restarting a new build, by closing/opening the PR, will be added to the end of the CI build queue. ## User-approval pending Label [`User-approval pending`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3A%22User-approval+pending%22) signals the pull request that have been submitted by an user who is not yet approved in ConanCenter. Once the user is approved these pull requests will be triggered again automatically. + +## Library Request + +Request a new package to be created. + +## Question + +Further information is requested. Usually these are for issue where help is needed to solve a specific issue. These are a great way +to look for advice or recommendation about making changes to recipes. + +## Upstream Update + +Request a bump of a new package version. + +## conan.io/center + +Issues and features related to Web UI. diff --git a/docs/linters.md b/docs/linters.md new file mode 100644 index 0000000000000..8f4023733d1ba --- /dev/null +++ b/docs/linters.md @@ -0,0 +1,153 @@ +# ConanCenterIndex Linters + +Some linter configuration files are available in the folder [linter](../linter), which are executed by Github Actions to improve recipe quality. +They consume python scripts which are executed to fit CCI rules. Those scripts use [astroid](https://github.com/PyCQA/astroid) and +[pylint](https://pylint.pycqa.org/en/latest/) classes to parse Conan recipe files and manage their warnings and errors. + +Pylint by itself is not able to find ConanCenterIndex rules, so astroid is used to iterate over conanfiles content and +validate CCI conditions. Also, pylint uses [rcfile](https://pylint.pycqa.org/en/latest/user_guide/configuration/index.html) +(a configuration file based on [toml](https://toml.io/en/) format) to configure plugins, warnings and errors which should be enabled or disabled. + +Also, the Github [code review](https://github.com/features/code-review) is integrated with the pylint output, +parsed by [recipe_linter.json](../linter/recipe_linter.json), then presented to all users on the tab `Files changed`. + + +## Contents + + * [Running the linter locally](#running-the-linter-locally) + * [Pylint configuration files](#pylint-configuration-files) + * [Linter Warning and Errors](#linter-warning-and-errors) + * [E9006 - conan-import-conanfile: ConanFile should be imported from conan](#e9006---conan-import-conanfile-conanfile-should-be-imported-from-conan) + * [E9005 - conan-missing-name: Every conan recipe must contain the attribute name](#e9005---conan-missing-name-every-conan-recipe-must-contain-the-attribute-name) + * [E9004 - conan-package-name: Conan package names must be lower-case](#e9004---conan-package-name-conan-package-names-must-be-lower-case) + * [E9007 - conan-test-no-name: Do not add name attribute in test package recipes](#e9007---conan-test-no-name-do-not-add-name-attribute-in-test-package-recipes) + * [E9008 - conan-import-errors: Deprecated imports should be replaced by new imports](#e9008---conan-import-errors-deprecated-imports-should-be-replaced-by-new-imports) + * [E9009 - conan-import-error-conanexception: conans.errors is deprecated and conan.errors should be used instead](#e9009---conan-import-error-conanexception-conanserrors-is-deprecated-and-conanerrors-should-be-used-instead) + * [E9010 - conan-import-error-conaninvalidconfiguration: conans.errors is deprecated and conan.errors should be used instead](#e9010---conan-import-error-conaninvalidconfiguration-conanserrors-is-deprecated-and-conanerrors-should-be-used-instead) + * [E9011 - conan-import-tools: Importing conan.tools or conan.tools.xxx.zzz.yyy should be considered as private](#e9011---conan-import-tools-importing-conantools-or-conantoolsxxxzzzyyy-should-be-considered-as-private) + +## Running the linter locally + +Check the [Developing Recipes](developing_recipes_locally.md#running-the-python-linters) page for details. + +## Pylint configuration files + +- [Pylint Recipe](../linter/pylintrc_recipe): This `rcfile` lists plugins and rules to be executed over all recipes (not test package) and validate them. +- [Pylint Test Package Recipe](../linter/pylintrc_testpackage): This `rcfile` lists plugins and rules to be executed over all recipes in test package folders only: + +## Linter Warning and Errors + +Here is the list of current warning and errors provided by pylint, when using CCI configuration. + +### E9006 - conan-import-conanfile: ConanFile should be imported from conan + +```python +from conans import ConanFile +``` + +Should be replaced by: + +```python +from conan import Conanfile +``` + +### E9005 - conan-missing-name: Every conan recipe must contain the attribute name + +The attribute `name` is always expected. On the other hand, `version` should not be listed. + +```python +def BazConanfile(ConanFile): + name = "baz" +``` + +### E9004 - conan-package-name: Conan package names must be lower-case + +The package name is always lower-case, even when the upstream uses another format + +```python +def FoobarConanfile(ConanFile): + name = "foobar" +``` + +### E9007 - conan-test-no-name: Do not add name attribute in test package recipes + +The test package is not a recipe, thus, it should not have a name + +```python +def TestPackageConanFile(ConanFile): + name = "test_package" # Wrong! +``` + +### E9008 - conan-import-errors: Deprecated imports should be replaced by new imports + +Read [v2_linter](v2_linter.md) for a list of mappings of v1 to v2. +Regular imports from `conans.tools` are now updated: + +```python +from conans import tools +... + +tools.rmdir(os.path.join(self.package_folder, "shared")) +``` + +Should be replaced by specialized tools, prepared for Conan 2.0 + +```python +from conan.tools.files import rmdir +... + +rmdir(self, os.path.join(self.package_folder, "shared")) +``` + +### E9009 - conan-import-error-conanexception: conans.errors is deprecated and conan.errors should be used instead + +```python +from conans.errors import ConanException +``` + +Should be replaced by: + +```python +from conan.errors import ConanException +``` + +Only the namespace `conans` has been replaced by `conan`. + +### E9010 - conan-import-error-conaninvalidconfiguration: conans.errors is deprecated and conan.errors should be used instead + +```python +from conans.errors import ConanInvalidConfiguration +``` + +Should be replaced by: + +```python +from conan.errors import ConanInvalidConfiguration +``` + +Only the namespace `conans` has been replaced by `conan`. + +### E9011 - conan-import-tools: Importing conan.tools or conan.tools.xxx.zzz.yyy should be considered as private + +Documented on [conanfile.tools](https://docs.conan.io/en/latest/reference/conanfile/tools.html): +It's not allowed to use `tools.xxx` directly: + +```python +from conan import tools +... + +tools.scm.Version(self.version) +``` + +Neither sub modules: + +```python +from conan.tools.apple.apple import is_apple_os +``` + +Only modules under `conan.tools` and `conan.tools.xxx` are allowed: + +```python +from conan.tools.files import rmdir +from conan.tools import scm +```` diff --git a/docs/package_templates/README.md b/docs/package_templates/README.md new file mode 100644 index 0000000000000..76d696e57b0a0 --- /dev/null +++ b/docs/package_templates/README.md @@ -0,0 +1,27 @@ +## Package Templates + +A brief description about each template available: + +#### Autotools package + +It's listed under [autotools_package](autotools_package) folder. It fits projects which use `autotools` or `make` to be built. + +#### CMake package + +It's listed under [cmake_package](cmake_package) folder. It fits projects which use `CMake` to be built. + +#### Header only + +It's listed under [header_only](header_only) folder. It fits projects which only copy header and have the same package ID always. + +#### MSBuild package + +It's listed under [msbuild_package](msbuild_package) folder. It fits projects which use `msbuild` to be built. + +#### Prebuilt tool package + +It's listed under [prebuilt_tool_package](prebuilt_tool_package) folder. It fits projects which only copy generated binaries (executables and libraries). + +#### Meson package + +It's listed under [meson_package](meson_package) folder. It fits projects which use `Meson` to be built. diff --git a/docs/package_templates/autotools_package/all/conandata.yml b/docs/package_templates/autotools_package/all/conandata.yml index 61b769f81b6fa..a5aa8737e0c0a 100644 --- a/docs/package_templates/autotools_package/all/conandata.yml +++ b/docs/package_templates/autotools_package/all/conandata.yml @@ -20,10 +20,8 @@ patches: patch_type: "backport" patch_source: "https://github.com/owner/package/pulls/42" sha256: "________________________________________________________________" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-linux.patch" patch_description: "add missing header to support linux" patch_type: "portability" patch_source: "https://github.com/owner/package/issues/0" sha256: "________________________________________________________________" - base_path: "source_subfolder" diff --git a/docs/package_templates/autotools_package/all/conanfile.py b/docs/package_templates/autotools_package/all/conanfile.py index 27a85160acde1..31cbae159751f 100644 --- a/docs/package_templates/autotools_package/all/conanfile.py +++ b/docs/package_templates/autotools_package/all/conanfile.py @@ -1,23 +1,32 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.env import VirtualBuildEnv -from conan.tools.build import check_min_cppstd -from conan.tools.files import copy, get, rm, rmdir, apply_conandata_patches +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" + +# +# INFO: Please, remove all comments before pushing your PR! +# class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3") # no "conan" and project name in topics + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("topic1", "topic2", "topic3") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,11 +39,18 @@ class PackageConan(ConanFile): "with_foobar": True, } + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + @property + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + # no exports_sources attribute, but export_sources(self) method instead # this allows finer grain exportation of patches per version def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,82 +59,125 @@ def config_options(self): def configure(self): if self.options.shared: try: - del self.options.fPIC # once removed by config_options, need try..except for a second del + # once removed by config_options, need try..except for a second del + del self.options.fPIC except Exception: pass + # for plain C projects only try: - del self.settings.compiler.libcxx # for plain C projects only + del self.settings.compiler.libcxx except Exception: pass try: - del self.settings.compiler.cppstd # for plain C projects only + del self.settings.compiler.cppstd except Exception: pass def layout(self): - basic_layout(self, src_folder="src") # src_folder must use the same source folder name the project + # src_folder must use the same source folder name the project + basic_layout(self, src_folder="src") def requirements(self): - self.requires("dependency/0.8.1") # prefer self.requires method instead of requires attribute + # prefer self.requires method instead of requires attribute + self.requires("dependency/0.8.1") if self.options.with_foobar: self.requires("foobar/0.1.0") def validate(self): # validate the minimum cpp standard supported. Only for C++ projects - if self.info.settings.compiler.cppstd: + if self.info.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) if self.info.settings.os not in ["Linux", "FreeBSD", "MacOS"]: raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.info.settings.os}.") # if another tool than the compiler or autotools is required to build the project (pkgconf, bison, flex etc) def build_requirements(self): + # only if we have to call autoreconf self.tool_requires("libtool/x.y.z") - self.tool_requires("pkgconf/x.y.z") + # only if upstream configure.ac relies on PKG_CHECK_MODULES macro + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/x.y.z") + # required to suppport windows as a build machine + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + # for msvc support to get compile & ar-lib scripts (may be avoided if shipped in source code of the library) + if is_msvc(self): + self.tool_requires("automake/x.y.z") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): - # autotools usually uses 'yes' and 'no' to enable/disable options - yes_no = lambda v: "yes" if v else "no" + # inject tools_requires env vars in build scope (not needed if there is no tool_requires) + env = VirtualBuildEnv(self) + env.generate() + # inject requires env vars in build scope + # it's required in case of native build when there is AutotoolsDeps & at least one dependency which might be shared, because configure tries to run a test executable + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") # --fpic is automatically managed when 'fPIC'option is declared # --enable/disable-shared is automatically managed when 'shared' option is declared tc = AutotoolsToolchain(self) - tc.configure_args.append("--with-foobar=%s" % yes_no(self.options.with_foobar)) - tc.configure_args.append("--enable-tools=no") - tc.configure_args.append("--enable-manpages=no") + # autotools usually uses 'yes' and 'no' to enable/disable options + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--with-foobar={yes_no(self.options.with_foobar)}", + "--enable-tools=no", + "--enable-manpages=no", + ]) tc.generate() - # generate dependencies for pkg-config + # generate pkg-config files of dependencies (useless if upstream configure.ac doesn't rely on PKG_CHECK_MODULES macro) tc = PkgConfigDeps(self) tc.generate() # generate dependencies for autotools tc = AutotoolsDeps(self) tc.generate() - # inject tools_require env vars in build context - ms = VirtualBuildEnv(self) - ms.generate(scope="build") + + # If Visual Studio is supported + if is_msvc(self): + env = Environment() + # get compile & ar-lib from automake (or eventually lib source code if available) + # it's not always required to wrap CC, CXX & AR with these scripts, it depends on how much love was put in + # upstream build files + compile_wrapper = unix_path(self, self._user_info_build["automake"].compile) + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_msvc") def build(self): # apply patches listed in conandata.yml apply_conandata_patches(self) autotools = Autotools(self) - # run autoreconf to generate configure file + # (optional) run autoreconf to regenerate configure file (libtool should be in tool_requires) autotools.autoreconf() # ./configure + toolchain file autotools.configure() autotools.make() def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) - autotools.install() + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) # some files extensions and folders are not allowed. Please, read the FAQs to get informed. rm(self, "*.la", os.path.join(self.package_folder, "lib")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "share")) + # In shared lib/executable files, autotools set install_name (macOS) to lib dir absolute path instead of @rpath, it's not relocatable, so fix it + fix_apple_shared_install_name(self) + def package_info(self): self.cpp_info.libs = ["package_lib"] @@ -127,6 +186,4 @@ def package_info(self): # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") - self.cpp_info.system_libs.append("pthread") - self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) diff --git a/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt b/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt index dcb2919e20597..d5f12b4376cdb 100644 --- a/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt +++ b/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt @@ -1,7 +1,6 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -# project(test_package CXX) # if the project uses c++ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) # if the project is pure C +# project(test_package LANGUAGES CXX) # if the project uses c++ find_package(package REQUIRED CONFIG) diff --git a/docs/package_templates/autotools_package/all/test_package/conanfile.py b/docs/package_templates/autotools_package/all/test_package/conanfile.py index 1111583fea732..48499fa0989d9 100644 --- a/docs/package_templates/autotools_package/all/test_package/conanfile.py +++ b/docs/package_templates/autotools_package/all/test_package/conanfile.py @@ -10,12 +10,12 @@ class TestPackageConan(ConanFile): generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) - def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt b/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt index 6298d7b9a123c..ac1ad5974dd0f 100644 --- a/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt @@ -1,7 +1,6 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -# project(test_package CXX) # if the project uses c++ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) # if the project is pure C +# project(test_package LANGUAGES CXX) # if the project uses c++ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) @@ -13,4 +12,4 @@ add_executable(${PROJECT_NAME} ../test_package/test_package.c) # don't link to ${CONAN_LIBS} or CONAN_PKG::package target_link_libraries(${PROJECT_NAME} PRIVATE package::package) # in case the target project requires a C++ standard -# set_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +# target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/docs/package_templates/cmake_package/all/conandata.yml b/docs/package_templates/cmake_package/all/conandata.yml index 61b769f81b6fa..a5aa8737e0c0a 100644 --- a/docs/package_templates/cmake_package/all/conandata.yml +++ b/docs/package_templates/cmake_package/all/conandata.yml @@ -20,10 +20,8 @@ patches: patch_type: "backport" patch_source: "https://github.com/owner/package/pulls/42" sha256: "________________________________________________________________" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-linux.patch" patch_description: "add missing header to support linux" patch_type: "portability" patch_source: "https://github.com/owner/package/issues/0" sha256: "________________________________________________________________" - base_path: "source_subfolder" diff --git a/docs/package_templates/cmake_package/all/conanfile.py b/docs/package_templates/cmake_package/all/conanfile.py index ffec34ee46a8d..af351727d56bf 100644 --- a/docs/package_templates/cmake_package/all/conanfile.py +++ b/docs/package_templates/cmake_package/all/conanfile.py @@ -1,7 +1,7 @@ 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, get, copy, rm, rmdir, replace_in_file +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 @@ -9,16 +9,23 @@ import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" + +# +# INFO: Please, remove all comments before pushing your PR! +# class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3") # no "conan" and project name in topics + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("topic1", "topic2", "topic3") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,7 +45,6 @@ def _minimum_cpp_standard(self): def _compilers_minimum_version(self): return { "gcc": "7", - "Visual Studio": "15.7", "clang": "7", "apple-clang": "10", } @@ -46,8 +52,7 @@ def _compilers_minimum_version(self): # no exports_sources attribute, but export_sources(self) method instead # this allows finer grain exportation of patches per version 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": @@ -56,31 +61,39 @@ def config_options(self): def configure(self): if self.options.shared: try: - del self.options.fPIC # once removed by config_options, need try..except for a second del + # once removed by config_options, need try..except for a second del + del self.options.fPIC except Exception: pass + # for plain C projects only try: - del self.settings.compiler.libcxx # for plain C projects only + del self.settings.compiler.libcxx except Exception: pass try: - del self.settings.compiler.cppstd # for plain C projects only + del self.settings.compiler.cppstd except Exception: pass def layout(self): - cmake_layout(self, src_folder="src") # src_folder must use the same source folder name the project + # src_folder must use the same source folder name the project + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("dependency/0.8.1") # prefer self.requires method instead of requires attribute + # prefer self.requires method instead of requires attribute + self.requires("dependency/0.8.1") def validate(self): # validate the minimum cpp standard supported. For C++ projects only if self.info.settings.compiler.cppstd: check_min_cppstd(self, self._minimum_cpp_standard) - 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.") + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) # in case it does not work in another configuration, it should validated here too if is_msvc(self) and self.info.options.shared: raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on Visual Studio and msvc.") @@ -90,20 +103,21 @@ def build_requirements(self): self.tool_requires("tool/x.y.z") 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], destination=self.source_folder, strip_root=True) def generate(self): # BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE are automatically parsed when self.options.shared or self.options.fPIC exist tc = CMakeToolchain(self) # Boolean values are preferred instead of "ON"/"OFF" - tc.cache_variables["PACKAGE_CUSTOM_DEFINITION"] = True + tc.variables["PACKAGE_CUSTOM_DEFINITION"] = True if is_msvc(self): # don't use self.settings.compiler.runtime - tc.cache_variables.definitions["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) # deps_cpp_info, deps_env_info and deps_user_info are no longer used if self.dependencies["dependency"].options.foobar: - tc.cache_variables["DEPENDENCY_LIBPATH"] = self.dependencies["dependency"].cpp_info.libdirs + tc.variables["DEPENDENCY_LIBPATH"] = self.dependencies["dependency"].cpp_info.libdirs + # cache_variables should be used sparingly, example setting cmake policies + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() # In case there are dependencies listed on requirements, CMakeDeps should be used tc = CMakeDeps(self) @@ -116,16 +130,12 @@ 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"), - "...", - "", - ) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "...", "") def build(self): - self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed + self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed cmake = CMake(self) + cmake.configure() cmake.build() def package(self): @@ -137,8 +147,8 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "share")) - rm(self, "*.pdb", self, os.path.join(self.package_folder, "lib")) - rm(self, "*.la", self, os.path.join(self.package_folder, "lib")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): diff --git a/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt b/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt index e36cdfd024c40..925ecbe19e448 100644 --- a/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt @@ -1,17 +1,8 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(package REQUIRED CONFIG) - -# Re-use the same source file from test_package folder -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -# don't link to ${CONAN_LIBS} or CONAN_PKG::package -target_link_libraries(${PROJECT_NAME} PRIVATE package::package) -# in case the target project requires a C++ standard -set_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/docs/package_templates/header_only/all/conandata.yml b/docs/package_templates/header_only/all/conandata.yml index 61b769f81b6fa..a5aa8737e0c0a 100644 --- a/docs/package_templates/header_only/all/conandata.yml +++ b/docs/package_templates/header_only/all/conandata.yml @@ -20,10 +20,8 @@ patches: patch_type: "backport" patch_source: "https://github.com/owner/package/pulls/42" sha256: "________________________________________________________________" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-linux.patch" patch_description: "add missing header to support linux" patch_type: "portability" patch_source: "https://github.com/owner/package/issues/0" sha256: "________________________________________________________________" - base_path: "source_subfolder" diff --git a/docs/package_templates/header_only/all/conanfile.py b/docs/package_templates/header_only/all/conanfile.py index 4d9370bad1f91..99bcc94e5e166 100644 --- a/docs/package_templates/header_only/all/conanfile.py +++ b/docs/package_templates/header_only/all/conanfile.py @@ -1,27 +1,31 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, get, copy from conan.tools.build import check_min_cppstd -from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3", "header-only") # no "conan" and project name in topics, keep 'header-only' - settings = "os", "arch", "compiler", "build_type" # even for header only - no_copy_source = True # do not copy sources to build folder for header only projects, unless, need to apply patches + # no "conan" and project name in topics. Use topics from the upstream listed on GH + # Keep 'hearder-only' as topic + topics = ("topic1", "topic2", "topic3", "header-only") + settings = "os", "arch", "compiler", "build_type" # even for header only + no_copy_source = True # do not copy sources to build folder for header only projects, unless, need to apply patches @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 14 # in case the project requires C++14/17/20/... the minimum compiler version should be listed @@ -38,8 +42,7 @@ def _compilers_minimum_version(self): # no exports_sources attribute, but export_sources(self) method instead # this allows finer grain exportation of patches per version 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): # src_folder must use the same source folder name the project @@ -47,32 +50,34 @@ def layout(self): def requirements(self): # prefer self.requires method instead of requires attribute - self.requires("dependency/0.8.1") + # direct dependencies of header only libs are always transitive since they are included in public headers + self.requires("dependency/0.8.1", transitive_headers=True) # same package ID for any package def package_id(self): self.info.clear() + @property + def _info(self): + return self if Version(conan_version).major < 2 else self.info + def validate(self): # compiler subsettings are not available when building with self.info.clear() - if self.info.settings.get_safe("compiler.cppstd"): + if self._info.settings.compiler.get_safe("cppstd"): # validate the minimum cpp standard supported when installing the package. For C++ projects only - check_min_cppstd(self, self._minimum_cpp_standard) - minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version and Version(self.info.settings.get_safe("compiler.version")) < minimum_version: - raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + 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." + ) # in case it does not work in another configuration, it should validated here too - if self.info.settings.os == "Windows": + if self._info.settings.os == "Windows": raise ConanInvalidConfiguration(f"{self.ref} can not be used on Windows.") - # if another tool than the compiler or CMake is required to build the project (pkgconf, bison, flex etc) - def build_requirements(self): - self.tool_requires("tool/x.y.z") - def source(self): # download source package and extract to source folder - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) # not mandatory when there is no patch, but will suppress warning message about missing build() method def build(self): @@ -82,14 +87,17 @@ def build(self): # copy all files to the package folder 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=os.path.join(self.source_folder, "include")) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) def package_info(self): # folders not used for header-only self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # if package has an official FindPACKAGE.cmake listed in https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#find-modules # examples: bzip2, freetype, gdal, icu, libcurl, libjpeg, libpng, libtiff, openssl, sqlite3, zlib... @@ -103,9 +111,7 @@ def package_info(self): # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") - self.cpp_info.system_libs.append("pthread") - self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "PACKAGE" diff --git a/docs/package_templates/header_only/all/test_package/CMakeLists.txt b/docs/package_templates/header_only/all/test_package/CMakeLists.txt index d36b7fedf54ae..58ff75575bd54 100644 --- a/docs/package_templates/header_only/all/test_package/CMakeLists.txt +++ b/docs/package_templates/header_only/all/test_package/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +project(test_package LANGUAGES C) # if the project is pure C +project(test_package LANGUAGES CXX) # if the project uses c++ find_package(package REQUIRED CONFIG) diff --git a/docs/package_templates/header_only/all/test_package/conanfile.py b/docs/package_templates/header_only/all/test_package/conanfile.py index 1111583fea732..48499fa0989d9 100644 --- a/docs/package_templates/header_only/all/test_package/conanfile.py +++ b/docs/package_templates/header_only/all/test_package/conanfile.py @@ -10,12 +10,12 @@ class TestPackageConan(ConanFile): generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) - def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt b/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt index 40b3d97d7ddb2..3c858b5777694 100644 --- a/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +project(test_package LANGUAGES C) # if the project is pure C +project(test_package LANGUAGES CXX) # if the project uses c++ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) @@ -13,4 +12,4 @@ add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) # don't link to ${CONAN_LIBS} or CONAN_PKG::package target_link_libraries(${PROJECT_NAME} PRIVATE package::package) # in case the target project requires a C++ standard -set_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/docs/package_templates/meson_package/all/conandata.yml b/docs/package_templates/meson_package/all/conandata.yml new file mode 100644 index 0000000000000..a5aa8737e0c0a --- /dev/null +++ b/docs/package_templates/meson_package/all/conandata.yml @@ -0,0 +1,27 @@ +sources: + # Newer versions at the top + "1.2.0": + url: [ + "https://mirror1.net/package-1.2.0.tar.gz", + "https://mirror2.net/package-1.2.0.tar.gz", + ] + sha256: "________________________________________________________________" + "1.1.0": + url: [ + "https://mirror1.net/package-1.1.0.tar.gz", + "https://mirror2.net/package-1.1.0.tar.gz", + ] + sha256: "________________________________________________________________" +patches: + # Newer versions at the top + "1.1.0": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "correct the order of cmake min and project" + patch_type: "backport" + patch_source: "https://github.com/owner/package/pulls/42" + sha256: "________________________________________________________________" + - patch_file: "patches/0002-fix-linux.patch" + patch_description: "add missing header to support linux" + patch_type: "portability" + patch_source: "https://github.com/owner/package/issues/0" + sha256: "________________________________________________________________" diff --git a/docs/package_templates/meson_package/all/conanfile.py b/docs/package_templates/meson_package/all/conanfile.py new file mode 100644 index 0000000000000..53a839176b8f2 --- /dev/null +++ b/docs/package_templates/meson_package/all/conanfile.py @@ -0,0 +1,166 @@ +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 +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain, MesonDeps +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + +# +# INFO: Please, remove all comments before pushing your PR! +# + + +class PackageConan(ConanFile): + name = "package" + description = "short description" + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/project/package" + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("topic1", "topic2", "topic3") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + # in case the project requires C++14/17/20/... the minimum compiler version should be listed + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + # no exports_sources attribute, but export_sources(self) method instead + # this allows finer grain exportation of patches per version + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + # once removed by config_options, need try..except for a second del + del self.options.fPIC + except Exception: + pass + # for plain C projects only + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + # src_folder must use the same source folder name the project + basic_layout(self, src_folder="src") + + def requirements(self): + # prefer self.requires method instead of requires attribute + self.requires("dependency/0.8.1") + + def validate(self): + # validate the minimum cpp standard supported. For C++ projects only + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + # in case it does not work in another configuration, it should validated here too + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on Visual Studio and msvc.") + + # if another tool than the compiler or Meson is required to build the project (pkgconf, bison, flex etc) + def build_requirements(self): + # CCI policy assumes that Meson may not be installed on consumers machine + self.tool_requires("meson/0.63.3") + # pkgconf is largely used by Meson, it should be added in build requirement when there are dependencies + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + # default_library and b_staticpic are automatically parsed when self.options.shared and self.options.fpic exist + # buildtype is automatically parsed for self.settings + tc = MesonToolchain(self) + # In case need to pass definitions directly to the compiler + tc.preprocessor_definitions["MYDEFINE"] = "MYDEF_VALUE" + # Meson project options may vary their types + tc.project_options["tests"] = False + tc.generate() + # In case there are dependencies listed on requirements, PkgConfigDeps should be used + tc = PkgConfigDeps(self) + tc.generate() + # Sometimes, when PkgConfigDeps is not enough to find requirements, MesonDeps should solve it + tc = MesonDeps(self) + tc.generate() + # In case there are dependencies listed on build_requirements, VirtualBuildEnv should be used + tc = VirtualBuildEnv(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # remove bundled xxhash + rm(self, "whateer.*", os.path.join(self.source_folder, "lib")) + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "...", "") + + def build(self): + self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + meson = Meson(self) + meson.install() + + # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + # In shared lib/executable files, meson set install_name (macOS) to lib dir absolute path instead of @rpath, it's not relocatable, so fix it + fix_apple_shared_install_name(self) + + def package_info(self): + # avoid collect_libs(), prefer explicit library name instead + self.cpp_info.libs = ["package_lib"] + # if package provides a pkgconfig file (package.pc, usually installed in /lib/pkgconfig/) + self.cpp_info.set_property("pkg_config_name", "package") + # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) diff --git a/docs/package_templates/meson_package/all/test_package/conanfile.py b/docs/package_templates/meson_package/all/test_package/conanfile.py new file mode 100644 index 0000000000000..287ce44d8a78e --- /dev/null +++ b/docs/package_templates/meson_package/all/test_package/conanfile.py @@ -0,0 +1,33 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "PkgConfigDeps", "MesonToolchain", "VirtualRunEnv", "VirtualBuildEnv" + test_type = "explicit" + + def layout(self): + basic_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.tool_requires("meson/0.63.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/docs/package_templates/meson_package/all/test_package/meson.build b/docs/package_templates/meson_package/all/test_package/meson.build new file mode 100644 index 0000000000000..481f6cfd116c1 --- /dev/null +++ b/docs/package_templates/meson_package/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'cpp') +package_dep = dependency('package') +executable('test_package', + sources : ['test_package.cpp'], + dependencies : [package_dep]) diff --git a/docs/package_templates/meson_package/all/test_package/test_package.cpp b/docs/package_templates/meson_package/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..315875d954777 --- /dev/null +++ b/docs/package_templates/meson_package/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include +#include +#include "package/foobar.hpp" + + +int main(void) { + /* + * Create a minimal usage for the target project here. + * Avoid big examples, bigger than 100 lines. + * Avoid networking connections. + * Avoid background apps or servers. + * The propose is testing the generated artifacts only. + */ + + foobar.print_version(); + + return EXIT_SUCCESS; +} diff --git a/docs/package_templates/meson_package/all/test_v1_package/conanfile.py b/docs/package_templates/meson_package/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c5b074313827d --- /dev/null +++ b/docs/package_templates/meson_package/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, Meson +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "pkg_config" + + def build_requirements(self): + self.build_requires("meson/0.63.3") + self.build_requires("pkgconf/1.9.3") + + def build(self): + meson = Meson(self) + meson.configure(build_folder="bin", source_folder="../test_package") + meson.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/docs/package_templates/meson_package/config.yml b/docs/package_templates/meson_package/config.yml new file mode 100644 index 0000000000000..a885cbf942a74 --- /dev/null +++ b/docs/package_templates/meson_package/config.yml @@ -0,0 +1,6 @@ +versions: + # Newer versions at the top + "1.2.0": + folder: all + "1.1.0": + folder: all diff --git a/docs/package_templates/msbuild_package/all/conandata.yml b/docs/package_templates/msbuild_package/all/conandata.yml index 61b769f81b6fa..a5aa8737e0c0a 100644 --- a/docs/package_templates/msbuild_package/all/conandata.yml +++ b/docs/package_templates/msbuild_package/all/conandata.yml @@ -20,10 +20,8 @@ patches: patch_type: "backport" patch_source: "https://github.com/owner/package/pulls/42" sha256: "________________________________________________________________" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-linux.patch" patch_description: "add missing header to support linux" patch_type: "portability" patch_source: "https://github.com/owner/package/issues/0" sha256: "________________________________________________________________" - base_path: "source_subfolder" diff --git a/docs/package_templates/msbuild_package/all/conanfile.py b/docs/package_templates/msbuild_package/all/conanfile.py index 42c754733c1a9..5954e93a4051e 100644 --- a/docs/package_templates/msbuild_package/all/conanfile.py +++ b/docs/package_templates/msbuild_package/all/conanfile.py @@ -2,20 +2,23 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import is_msvc, MSBuildDeps, MSBuildToolchain, MSBuild, VCVars from conan.tools.layout import vs_layout -from conan.tools.files import apply_conandata_patches, get, copy, rm, replace_in_file +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3") # no "conan" and project name in topics + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("topic1", "topic2", "topic3") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +32,7 @@ class PackageConan(ConanFile): # no exports_sources attribute, but export_sources(self) method instead # this allows finer grain exportation of patches per version 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": @@ -39,23 +41,27 @@ def config_options(self): def configure(self): if self.options.shared: try: - del self.options.fPIC # once removed by config_options, need try..except for a second del + # once removed by config_options, need try..except for a second del + del self.options.fPIC except Exception: pass + # for plain C projects only try: - del self.settings.compiler.libcxx # for plain C projects only + del self.settings.compiler.libcxx except Exception: pass try: - del self.settings.compiler.cppstd # for plain C projects only + del self.settings.compiler.cppstd except Exception: pass def layout(self): - vs_layout(self, src_folder="src") # src_folder must use the same source folder name the project + # src_folder must use the same source folder name the project + vs_layout(self, src_folder="src") def requirements(self): - self.requires("dependency/0.8.1") # prefer self.requires method instead of requires attribute + # prefer self.requires method instead of requires attribute + self.requires("dependency/0.8.1") def validate(self): # in case it does not work in another configuration, it should validated here too @@ -67,8 +73,7 @@ def build_requirements(self): self.tool_requires("tool/x.y.z") 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], destination=self.source_folder, strip_root=True) def generate(self): tc = MSBuildToolchain(self) @@ -82,15 +87,10 @@ 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"), - "...", - "", - ) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "...", "") def build(self): - self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed + 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" @@ -101,9 +101,18 @@ def build(self): 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, 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"), + ) def package_info(self): self.cpp_info.libs = ["package_lib"] diff --git a/docs/package_templates/msbuild_package/all/test_v1_package/CMakeLists.txt b/docs/package_templates/msbuild_package/all/test_v1_package/CMakeLists.txt index 6b0a261eddbcc..ffce03aa1cbcf 100644 --- a/docs/package_templates/msbuild_package/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/msbuild_package/all/test_v1_package/CMakeLists.txt @@ -13,4 +13,4 @@ add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) # don't link to ${CONAN_LIBS} or CONAN_PKG::package target_link_libraries(${PROJECT_NAME} PRIVATE package::package) # in case the target project requires a C++ standard -set_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/docs/package_templates/prebuilt_tool_package/all/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/conanfile.py index b4b3859fcb0c8..92e54d11b0db4 100644 --- a/docs/package_templates/prebuilt_tool_package/all/conanfile.py +++ b/docs/package_templates/prebuilt_tool_package/all/conanfile.py @@ -11,11 +11,12 @@ class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3", "pre-built") # no "conan" and project name in topics. Use "pre-built" for tooling packages - settings = "os", "arch", "compiler", "build_type" # even for pre-built executables + # no "conan" and project name in topics. Use "pre-built" for tooling packages + topics = ("topic1", "topic2", "topic3", "pre-built") + settings = "os", "arch", "compiler", "build_type" # even for pre-built executables # not needed but supress warning message from conan commands def layout(self): @@ -37,8 +38,12 @@ def source(self): # download the source here, than copy to package folder def build(self): - get(self, **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)], - destination=self.source_folder, strip_root=True) + get( + self, + **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)], + destination=self.source_folder, + strip_root=True, + ) # copy all needed files to the package folder def package(self): diff --git a/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py index b84c922d41cb0..74e84fd25127a 100644 --- a/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py +++ b/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py @@ -5,7 +5,7 @@ # It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "VirtualRunEnv" + generators = "VirtualBuildEnv" test_type = "explicit" def build_requirements(self): @@ -15,4 +15,4 @@ def test(self): if can_run(self): # self.run checks the command exit code # the tool must be available on PATH - self.run("tool --version", env="conanrun") + self.run("tool --version") diff --git a/docs/packaging_policy.md b/docs/packaging_policy.md index 4eb95d041e21c..9c58b5482b075 100644 --- a/docs/packaging_policy.md +++ b/docs/packaging_policy.md @@ -10,7 +10,10 @@ This document gathers all the relevant information regarding the general lines t * [Build](#build) * [Package](#package) * [Settings](#settings) - * [Options](#options) + * [Options](#options) + * [Predefined Options and Known Defaults](#predefined-options-and-known-defaults) + * [Options to Avoid](#options-to-avoid) + * [Recommended feature options names](#recommended-feature-options-names) ## Sources @@ -108,29 +111,62 @@ for each combination. There are some particular cases for this general rule: ## Options Recipes can list any number of options with any meaning, and defaults are up to the recipe itself. The CI cannot enforce anything -in this direction. However, there are a couple of options that have a special meaning for the CI: +in this direction. However, there are a couple of options that have a special meaning for the CI. -* `shared` (with values `True` or `False`). The CI inspects the recipe looking for this option. If it is found, it will +### Predefined Options and Known Defaults + +ConanCenter supports many combinations, these are outline in the [supported configurations](supported_platforms_and_configurations.md) document for each platform. +By default recipes should use `shared=False` with `fPIC=True`. If support, `header_only=False` is the default. + +Usage of each option should follow the rules: + +* `shared` (with values `True` or `False`). The CI inspects the recipe looking for this option. The **default should be `shared=False`** and will generate all the configurations with values `shared=True` and `shared=False`. - > Note.- The CI applies `shared=True` only to the package being built, while every other requirement will use their defaults - > (typically `shared=False`). It's important to keep this in mind when trying to consume shared packages from ConanCenter + > **Note**: The CI applies `shared=True` only to the package being built, while every other requirement will `shared=False`. To consume everything as a shared library you will set `--build=always` and/or `-o *:shared=True`) + > It's important to keep this in mind when trying to consume shared packages from ConanCenter > as their requirements were linked inside the shared library. See [FAQs](faqs.md#how-to-consume-a-graph-of-shared-libraries) for more information. -* `header_only` (with values `True` or `False`). If the CI detects this option, it will generate all the configurations for the - value `header_only=False` and add one more configuration with `header_only=True`. **Only one - package** will be generated for `header_only=True`, so it is crucial that the package is actually a _header only_ library, with header files only (no libraries or executables inside). +* `fPIC` (with values `True` or `False`). The **default should be `fPIC=True`** and will generate all the configurations with values `fPIC=True` and `fPIC=False`. + This option does not make sense on all the support configurations so it should be removed. + + ```python + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + ``` + + Starting with Conan 1.53 this can be simplified to + + ```py + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + ``` + +* `header_only` (with values `True` or `False`). The **default should be `header_only=False`**. If the CI detects this option, it will generate all the + configurations for the value `header_only=False` and add one more configuration with `header_only=True`. **Only one package** + will be generated for `header_only=True`, so it is crucial that the package is actually a _header only_ library, with header files only (no libraries or executables inside). Recipes with such option should include the following in their `package_id` method ```python def package_id(self): if self.options.header_only: - self.info.header_only() + self.info.clear() ``` ensuring that, when the option is active, the recipe ignores all the settings and only one package ID is generated. +### Options to Avoid + * `build_testing` should not be added, nor any other related unit test option. Options affect the package ID, therefore, testing should not be part of that. Instead, use Conan config [skip_test](https://docs.conan.io/en/latest/reference/config_files/global_conf.html#tools-configurations) feature: @@ -141,3 +177,30 @@ in this direction. However, there are a couple of options that have a special me ``` The `skip_test` configuration is supported by [CMake](https://docs.conan.io/en/latest/reference/build_helpers/cmake.html#test) and [Meson](https://docs.conan.io/en/latest/reference/build_helpers/meson.html#test). + +### Recommended feature options names + +It's often needed to add options to toggle specific library features on/off. Regardless of the default, there is a strong preference for using positive naming for options. In order to avoid fragmentation, we recommend using the following naming conventions for such options: + +- enable_ / disable_ +- with_ / without_ +- use_ + +the actual recipe code then may look like: + +```py + options = {"use_tzdb": [True, False]} + default_options = {"use_tzdb": True} +``` + +```py + options = {"enable_locales": [True, False]} + default_options = {"enable_locales": True} +``` + +```py + options = {"with_zlib": [True, False]} + default_options = {"with_zlib": True} +``` + +having the same naming conventions for the options may help consumers, e.g. they will be able to specify options with wildcards: `-o *:with_threads=True`, therefore, `with_threads` options will be enabled for all packages in the graph that support it. diff --git a/docs/review_process.md b/docs/review_process.md index d746d332e894d..55eadf1bd0738 100644 --- a/docs/review_process.md +++ b/docs/review_process.md @@ -13,8 +13,6 @@ conan-center-index tries to make the process as smooth and simple as possible fo * [Avoiding conflicts](#avoiding-conflicts) * [Draft](#draft) * [Getting your pull request reviewed](#getting-your-pull-request-reviewed) - * [Official reviewers](#official-reviewers) - * [Community reviewers](#community-reviewers) * [Rule of 2 reviews](#rule-of-2-reviews) * [Reviews from others](#reviews-from-others) * [Addressing review comments](#addressing-review-comments) @@ -51,13 +49,8 @@ If you struggle to fix build errors yourself, you may want to ask for help from ### Unexpected error Sometimes, build fails with `Unexpected error` message. This indicates an infrastructure problem, and usually it's unrelated to the changes within PR itself. -Keep in mind conan-center-index is still *under development*, and there can be some instabilities. Especially, as we're using lots of external services, -which might be inaccessible (GitHub API, docker hub, etc.) and may result in intermittent failures. -So, what to do once `Unexpected error` was encountered? You may consider re-running the build by closing your pull request, waiting 15 seconds, and then re-opening it again. -Sometimes it's necessary to restart the build several times. -If an `Unexpected error` persists, tag [@jgsogo](https://github.com/jgsogo) and [@danimtb](https://github.com/danimtb) asking for the help with CI. -Alternatively, just [open a new issue](https://github.com/conan-io/conan-center-index/issues/new/choose). +To learn more, checkout the [label definition](labels.md#unexpected-error). ## Avoiding conflicts @@ -72,43 +65,17 @@ Once you're done with your changes, remember to convert from "Draft" to "Normal" ## Getting your pull request reviewed -Each PR must be reviewed by several reviewers before it will be merged. It cannot be just reviews from random people, we have two categories of reviewers: +Each PR must be reviewed by several reviewers before it will be merged. It cannot be just reviews from anyone, we have two categories of reviewers: -### Official reviewers +- Official reviewers: these are active team members who are responsible for developing Conan, ConanCenter, and ConanCenterIndex. +- Community reviewers: this list includes former Conan team members and ConanCenterIndex contributors who are very active and proven to be trusted - they frequently submit pull requests and provide their own useful reviews -The list includes only official Conan developers: - -- [@memsharded](https://github.com/memsharded) -- [@lasote](https://github.com/lasote) -- [@danimtb](https://github.com/danimtb) -- [@jgsogo](https://github.com/jgsogo) -- [@czoido](https://github.com/czoido) -- [@sse4](https://github.com/sse4) -- [@uilianries](https://github.com/uilianries) - -### Community reviewers - -The list includes conan-center-index contributors who are very active and proven to be trusted - they frequently submit pull requests and provide their own useful reviews: - -- [@madebr](https://github.com/madebr) -- [@SpaceIm](https://github.com/SpaceIm) -- [@ericLemanissier](https://github.com/ericLemanissier) -- [@prince-chrismc](https://github.com/prince-chrismc) -- [@Croydon](https://github.com/Croydon) -- [@intelligide](https://github.com/intelligide) -- [@theirix](https://github.com/theirix) -- [@gocarlos](https://github.com/gocarlos) -- [@mathbunnyru](https://github.com/mathbunnyru) -- [@ericriff](https://github.com/ericriff) -- [@toge](https://github.com/toge) -- [@AndreyMlashkin](https://github.com/AndreyMlashkin) -- [@MartinDelille](https://github.com/MartinDelille) -- [@dmn-star](https://github.com/dmn-star) - -The list, located [here](../.c3i/reviewers.yml), +The list or reviewers, located [here](../.c3i/reviewers.yml), is not constant and will change periodically based on contribution. That also means **you can be included in this list** as well - submit PRs and provide reviews, and in time you may be added as a trusted contributor. +> **Note**: GitHubs user interface does not support such custom rules so you should not rely solely on the message it provides. + ### Rule of 2 reviews At least 2 approving reviews are required, and at least one of them has to be from the official reviewers. @@ -134,7 +101,7 @@ The bot runs Automatic Merges every 20 minutes. Currently, it can only merge a s PR is selected for the merge only if: - Author is already [approved](https://github.com/conan-io/conan-center-index/issues/4). -- Author has signed CLA. +- Author has signed the [CLA](CONTRIBUTOR_LICENSE_AGREEMENT.md). - PR is not a Draft. - PR has a green status (successful build). - PR doesn't have merge conflicts with `master` branch. diff --git a/docs/reviewing.md b/docs/reviewing.md index f42f88d67438b..2abd57e16085c 100644 --- a/docs/reviewing.md +++ b/docs/reviewing.md @@ -19,7 +19,6 @@ The following policies are preferred during the review, but not mandatory: * [Test Package](#test-package) * [Minimalistic Source Code](#minimalistic-source-code) * [CMake targets](#cmake-targets) - * [Recommended feature options names](#recommended-feature-options-names) * [Supported Versions](#supported-versions) * [Removing old versions](#removing-old-versions) * [Adding old versions](#adding-old-versions) @@ -36,6 +35,9 @@ If possible, try to avoid mixing single quotes (`'`) and double quotes (`"`) in When extracting sources or performing out-of-source builds, it is preferable to use a _subfolder_ attribute, `_source_subfolder` and `_build_subfolder` respectively. +> **Note**: These are only required when using the legacy generator such as `cmake`. For the new generators like `CMakeToolchain` see +> the [2.0 Migration Guide](v2_migration.md#using-layout-with-new-generators) for more information. + For example doing this with property attributes for these variables: ```py @@ -52,26 +54,9 @@ def _build_subfolder(self): Prefer the following order of documented methods in python code (`conanfile.py`, `test_package/conanfile.py`): -- init -- set_name -- set_version -- export -- export_sources -- config_options -- configure -- layout -- requirements -- package_id -- validate -- build_id -- build_requirements -- system_requirements -- source -- generate -- imports -- build -- package -- package_info +For `conan create` the order is listed [here](https://docs.conan.io/en/latest/reference/commands/creator/create.html#methods-execution-order) +test packages recipes should append the following methods: + - deploy - test @@ -89,15 +74,14 @@ Where the SPDX guidelines do not apply, packages should do the following: ## Exporting Patches -It's ideal to minimize the number of files in a package the exactly whats required. When recipes support multiple versions with differing patches it's strongly encourged to only export the patches that are being used for that given recipe. +It's ideal to minimize the number of files in a package the exactly whats required. When recipes support multiple versions with differing patches it's strongly encouraged to only export the patches that are being used for that given recipe. Make sure the `export_sources` attribute is replaced by the following: ```py 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) ``` ## Applying Patches @@ -179,39 +163,12 @@ target_link_libraries(${PROJECT_NAME} package::package) We encourage contributors to check that not only the _global_ target works properly, but also the ones for the components. It can be done creating and linking different libraries and/or executables. -## Recommended feature options names - -It's often needed to add options to toggle specific library features on/off. Regardless of the default, there is a strong preference for using positive naming for options. In order to avoid the fragmentation, we recommend to use the following naming conventions for such options: - -- enable_ / disable_ -- with_ / without_ -- use_ - -the actual recipe code then may look like: - -```py - options = {"use_tzdb": [True, False]} - default_options = {"use_tzdb": True} -``` - -```py - options = {"enable_locales": [True, False]} - default_options = {"enable_locales": True} -``` - -```py - options = {"with_zlib": [True, False]} - default_options = {"with_zlib": True} -``` - -having the same naming conventions for the options may help consumers, e.g. they will be able to specify options with wildcards: `-o *:with_threads=True`, therefore, `with_threads` options will be enabled for all packages in the graph that support it. - ## Supported Versions In this repository we are building a subset of all the versions for a given library. This set of version changes over time as new versions -are released and old ones stop to be used. +are released and old ones stop to be used. -We always welcome latest releases as soon as they are available, and from time to time we remove old versions mainly due to technical reasons: +We always welcome latest releases as soon as they are available, and from time to time we remove old versions mainly due to technical reasons: the more versions we have, the more resources that are needed in the CI and the more time it takes to build each pull-request (also, the more chances of failing because of unexpected errors). diff --git a/docs/supported_platforms_and_configurations.md b/docs/supported_platforms_and_configurations.md index 6ca6d82cfbdc5..d246cd963f72c 100644 --- a/docs/supported_platforms_and_configurations.md +++ b/docs/supported_platforms_and_configurations.md @@ -39,6 +39,8 @@ For more information see [conan-io/conan-docker-tools](https://github.com/conan- - Python: 3.7.9 - CMake: 3.21.6 - WinSDK: 10.0.20348 + > WinSDK version is rolled periodically as [discussed previously](https://github.com/conan-io/conan-center-index/issues/4450). + > Please open an issue in case it needs to be updated. - Compilers: Visual Studio: - 2017 (19.16.27048) diff --git a/docs/v2_linter.md b/docs/v2_linter.md index 54aa81f9edcc4..a2358f657f524 100644 --- a/docs/v2_linter.md +++ b/docs/v2_linter.md @@ -1,7 +1,11 @@ # Linter to help migration to Conan v2 - +## Contents + + * [Running the linter locally](#running-the-linter-locally) + * [Import ConanFile from `conan`](#import-conanfile-from-conan) + * [Import tools from `conan`](#import-tools-from-conan) On our [path to Conan v2](v2_roadmap.md) we are leveraging on custom Pylint rules. This linter will run for every pull-request that is submitted to the repository and will @@ -17,6 +21,10 @@ if perfectly valid in Conan v1, the recipe might fail here because it is not v2- Here you can find some examples of the extra rules we are adding: +## Running the linter locally + +Check the [Developing Recipes](developing_recipes_locally.md#running-the-python-linters) for details. + ## Import ConanFile from `conan` The module `conans` is deprecated in Conan v2. Now all the imports should be done from @@ -60,45 +68,4 @@ Here is a list of different imports and their new equivalent (note that the inte | conans.errors.ConanInvalidConfiguration | [conan.errors.ConanInvalidConfiguration](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#migrating-the-recipes) | 1.47.0 | | conans.errors.ConanException | [conan.errors.ConanException](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#migrating-the-recipes) | 1.47.0 | -## Disable linter for a specific conanfile - -If for some reason a conanfile of a recipe or a test_package is not yet prepared to pass -all the checks of the linter, it can be skipped from `pylint` adding the following comment to the file: - -**`conanfile.py`** - -```python -# pylint: skip-file -from conans import ConanFile, CMake, tools -... -``` - --- - -## Running the linter locally - -It is possible to run the linter locally the same way it is being run [using Github actions](../.github/workflows/linter-conan-v2.yml): - - * (Recommended) Use a dedicated Python virtualenv. - * Ensure you have required tools installed: `conan` and `pylint` (better to uses fixed versions) - - ``` - pip install conan~=1.0 pylint==2.14 - ``` - - * Set environment variable `PYTHONPATH` to the root of the repository - - ``` - export PYTHONPATH=your/path/conan-center-index - ``` - - * Now you just need to execute the `pylint` commands: - - ``` - # Lint a recipe: - pylint --rcfile=linter/pylintrc_recipe recipes/boost/all/conanfile.py - - # Lint the test_package - pylint --rcfile=linter/pylintrc_testpackage recipes/boost/all/test_package/conanfile.py - ``` - diff --git a/docs/v2_migration.md b/docs/v2_migration.md index c38d114a5ccc5..2d2430b246c1f 100644 --- a/docs/v2_migration.md +++ b/docs/v2_migration.md @@ -1,8 +1,16 @@ # Preparing recipes for Conan 2.0 +Refer to [road to Conan v2](v2_roadmap.md) to know the steps that +will be taken in ConanCenter and this repository to start running +Conan v2 in pull requests. + ## Contents + * [Using Layout](#using-layout) + * [With New Generators](#with-new-generators) + * [With Multiple Build Helpers](#with-multiple-build-helpers) + * [New conf_info properties](#new-conf_info-properties) * [New cpp_info set_property model](#new-cpp_info-set_property-model) * [CMakeDeps](#cmakedeps) * [Update required_conan_version to ">=1.43.0"](#update-required_conan_version-to-1430) @@ -12,11 +20,7 @@ * [Translating .build_modules to cmake_build_modules](#translating-build_modules-to-cmake_build_modules) * [PkgConfigDeps](#pkgconfigdeps) -> ⚠️ Refer to [road to Conan v2](v2_roadmap.md) to know the steps that -> will be taken in ConanCenter and this repository to start running -> Conan v2 in pull requests. - -> ⚠️ Read about the [linter in pull requests](v2_linter.md). +> **Note**: Read about the [linter in pull requests](v2_linter.md) to learn how this is being enforced. It's time to start thinking seriously about Conan v2 and prepare recipes for the incoming changes. Conan v2 comes with many @@ -26,6 +30,64 @@ changes and improvements, you can read about them in the This document is a practical guide, offering extended information particular to Conan Center Index recipes to get them ready to upgrade to Conan 2.0. +## Using Layout + +All recipes should use a layout. Without one, more manual configuration of folders (e.g. source, build, etc) +and package structure will be required. + +### With New Generators + +When doing this there is no need to manually define `self._subfolder_[...]` in a recipe. +Simply use `self.source_folder` and `self.build_folder` instead of [subfolder properties](reviewing.md#subfolder-properties) + +### With Multiple Build Helpers + +When different build tools are use, at least one layout needs to be set. + +```python + def layout(self): + if self._use_cmake(): + cmake_layout(self) + else: # using autotools + basic_layout(self) +``` + +The `src_folder` must be the same when using different layouts and should +not depend on settings or options. + +## New conf_info properties + +As described in the documentation `self.user_info` has been depreated and you are now required to use +`self.conf_info` to define individual properties to expose to downstream recipes. +The [2.0 migrations docs](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#removed-self-user-info) +should cover the technical details, however for ConanCenterIndex we need to make sure there are no collisions +`conf_info` must be named `user.:`. + +For usage options of `conf_info`, the [documenation](https://docs.conan.io/en/latest/reference/config_files/global_conf.html?highlight=conf_info#configuration-in-your-recipes) + +In ConanCenterIndex this will typically looks like: + +- defining a value + ```py + def package_info(self): + tool_path = os.path.join(self.package_folder, "bin", "tool") + self.conf_info.define("user.pkg:tool", tool_path) + ``` +- using a value + ```py + #generators = "VirtualBuildEnv", "VirtualRunEnv" + + def build_requirements(self): + self.tool_requires("tool/0.1") + + def build(self): + tool_path = self.conf_info.get("user.pkg:tool") + self.run(f"{tool_path} --build") + ``` +> **Note**: This should only be used when absolutely required. In the vast majority of cases, the new +> ["Environments"](https://docs.conan.io/en/latest/reference/conanfile/tools/env/environment.html?highlight=Virtual) +> will include the `self.cpp_info.bindirs` which will provide access to the tools in the correct scopes. + ## New cpp_info set_property model New Conan generators like diff --git a/linter/check_import_conanfile.py b/linter/check_import_conanfile.py index 56442307ea781..bd5a90391b096 100644 --- a/linter/check_import_conanfile.py +++ b/linter/check_import_conanfile.py @@ -13,7 +13,7 @@ class ImportConanFile(BaseChecker): name = "conan-import-conanfile" msgs = { - "W9006": ( + "E9006": ( "Import ConanFile from new module: `from conan import ConanFile`. Old import is deprecated in Conan v2.", "conan-import-conanfile", "Import ConanFile from new module: `from conan import ConanFile`. Old import is deprecated in Conan v2.", diff --git a/recipes/7zip/19.00/conanfile.py b/recipes/7zip/19.00/conanfile.py index 5bca7f358e5d4..d18ee2242a6e7 100644 --- a/recipes/7zip/19.00/conanfile.py +++ b/recipes/7zip/19.00/conanfile.py @@ -1,8 +1,10 @@ -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 download, chdir, replace_in_file +from conans import tools, AutoToolsBuildEnvironment import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class SevenZipConan(ConanFile): @@ -18,7 +20,7 @@ class SevenZipConan(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) - def configure(self): + def validate(self): if self.settings.os != "Windows": raise ConanInvalidConfiguration("Only Windows supported") if self.settings.arch not in ("x86", "x86_64"): @@ -28,21 +30,20 @@ def build_requirements(self): self.build_requires("lzma_sdk/9.20") if self.settings.compiler != "Visual Studio" and self._settings_build.os == "Windows" and "make" not in os.environ.get("CONAN_MAKE_PROGRAM", ""): - self.build_requires("make/4.2.1") + self.build_requires("make/4.3") def package_id(self): del self.info.settings.compiler def _uncompress_7z(self, filename): - self.run("7zr x {}".format(filename)) + self.run(f"7zr x {filename}") def source(self): from six.moves.urllib.parse import urlparse url = self.conan_data["sources"][self.version]["url"] filename = os.path.basename(urlparse(url).path) sha256 = self.conan_data["sources"][self.version]["sha256"] - tools.download(url, filename) - tools.check_sha256(filename, sha256) + download(self, url, filename, sha256) self._uncompress_7z(filename) os.unlink(filename) @@ -55,8 +56,8 @@ def _msvc_platform(self): def _build_msvc(self): with tools.vcvars(self.settings): - with tools.chdir(os.path.join("CPP", "7zip")): - self.run("nmake /f makefile PLATFORM=%s" % self._msvc_platform) + with chdir(self, os.path.join("CPP", "7zip")): + self.run(f"nmake /f makefile PLATFORM={self._msvc_platform}") def _build_autotools(self): # TODO: Enable non-Windows methods in configure @@ -65,15 +66,15 @@ def _build_autotools(self): if self.settings.os == "Windows" and self.settings.compiler == "gcc": extra_env["IS_MINGW"] = "1" with tools.environment_append(extra_env): - with tools.chdir(os.path.join("CPP", "7zip", "Bundles", "LzmaCon")): + with chdir(self, os.path.join("CPP", "7zip", "Bundles", "LzmaCon")): autotools.make(args=["-f", "makefile.gcc"], target="all") def _patch_sources(self): if self.settings.compiler == "Visual Studio": fn = os.path.join("CPP", "Build.mak") os.chmod(fn, 0o644) - tools.replace_in_file(fn, "-MT", "-{}".format(str(self.settings.compiler.runtime))) - tools.replace_in_file(fn, "-MD", "-{}".format(str(self.settings.compiler.runtime))) + replace_in_file(self, fn, "-MT", f"-{self.settings.compiler.runtime}") + replace_in_file(self, fn, "-MD", f"-{self.settings.compiler.runtime}") def build(self): self._patch_sources() @@ -93,5 +94,8 @@ def package(self): def package_info(self): 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.includedirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/ade/all/conandata.yml b/recipes/ade/all/conandata.yml index 33408bd203512..954c10dfe2c1d 100644 --- a/recipes/ade/all/conandata.yml +++ b/recipes/ade/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.2a": + url: "https://github.com/opencv/ade/archive/refs/tags/v0.1.2a.tar.gz" + sha256: "c022a688b0554017e46e1cbdeb0105e625ca090fc3755c15df8c4451a304e084" "0.1.1f": url: "https://github.com/opencv/ade/archive/refs/tags/v0.1.1f.tar.gz" sha256: "c316680efbb5dd3ac4e10bb8cea345cf26a6a25ebc22418f8f0b8ca931a550e9" diff --git a/recipes/ade/config.yml b/recipes/ade/config.yml index 02ba1ae2763b8..cbf2f373fb630 100644 --- a/recipes/ade/config.yml +++ b/recipes/ade/config.yml @@ -1,3 +1,5 @@ versions: + "0.1.2a": + folder: "all" "0.1.1f": folder: "all" diff --git a/recipes/alac/all/CMakeLists.txt b/recipes/alac/all/CMakeLists.txt index 824a71b493f3a..fe2d89ad21170 100644 --- a/recipes/alac/all/CMakeLists.txt +++ b/recipes/alac/all/CMakeLists.txt @@ -3,11 +3,11 @@ project(alac LANGUAGES C CXX) include(GNUInstallDirs) -file(GLOB ALAC_LIB_SRCS src/codec/*.c src/codec/*.cpp) -file(GLOB ALAC_LIB_PUBLIC_HDRS src/codec/ALAC*.h) +file(GLOB ALAC_LIB_SRCS ${ALAC_SRC_DIR}/codec/*.c ${ALAC_SRC_DIR}/codec/*.cpp) +file(GLOB ALAC_LIB_PUBLIC_HDRS ${ALAC_SRC_DIR}/codec/ALAC*.h) add_library(alac ${ALAC_LIB_SRCS}) -target_include_directories(alac PUBLIC src/codec) +target_include_directories(alac PUBLIC ${ALAC_SRC_DIR}/codec) set_property(TARGET alac PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_compile_definitions(alac PRIVATE @@ -21,7 +21,7 @@ install(TARGETS alac ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(ALAC_BUILD_UTILITY) - file(GLOB ALAC_CONVERTER_SRCS src/convert-utility/*.cpp) + file(GLOB ALAC_CONVERTER_SRCS ${ALAC_SRC_DIR}/convert-utility/*.cpp) add_executable(alacconvert ${ALAC_CONVERTER_SRCS}) target_link_libraries(alacconvert PRIVATE alac) diff --git a/recipes/alac/all/conanfile.py b/recipes/alac/all/conanfile.py index 1c265220e3e81..03e8814c8b1fd 100644 --- a/recipes/alac/all/conanfile.py +++ b/recipes/alac/all/conanfile.py @@ -1,9 +1,10 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get +from conan.tools.scm import Version import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class AlacConan(ConanFile): @@ -35,7 +36,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def layout(self): cmake_layout(self, src_folder="src") @@ -46,6 +50,7 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + tc.variables["ALAC_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.variables["ALAC_BUILD_UTILITY"] = self.options.utility tc.generate() @@ -62,7 +67,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["alac"] - if self.options.utility: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + if Version(conan_version).major < 2 and self.options.utility: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/alac/all/test_package/CMakeLists.txt b/recipes/alac/all/test_package/CMakeLists.txt index 20135a2b359e3..237396b4c3323 100644 --- a/recipes/alac/all/test_package/CMakeLists.txt +++ b/recipes/alac/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) find_package(alac REQUIRED CONFIG) diff --git a/recipes/alac/all/test_package/conanfile.py b/recipes/alac/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/alac/all/test_package/conanfile.py +++ b/recipes/alac/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/alac/all/test_v1_package/CMakeLists.txt b/recipes/alac/all/test_v1_package/CMakeLists.txt index 00f950dcb21f6..6e042a1c74181 100644 --- a/recipes/alac/all/test_v1_package/CMakeLists.txt +++ b/recipes/alac/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) diff --git a/recipes/alac/all/test_v1_package/conanfile.py b/recipes/alac/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/alac/all/test_v1_package/conanfile.py +++ b/recipes/alac/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/amqp-cpp/all/conandata.yml b/recipes/amqp-cpp/all/conandata.yml index b1762b6aca57f..2543d0dc3e3ba 100644 --- a/recipes/amqp-cpp/all/conandata.yml +++ b/recipes/amqp-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.3.18": + url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.18.tar.gz" + sha256: "cc2c1fc5da00a1778c2804306e06bdedc782a5f74762b9d9b442d3a498dd0c4f" "4.3.16": url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.16.tar.gz" sha256: "66c96e0db1efec9e7ddcf7240ff59a073d68c09752bd3e94b8bc4c506441fbf7" @@ -21,6 +24,9 @@ sources: url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.1.5.tar.gz" sha256: "9840c7fb17bb0c0b601d269e528b7f9cac5ec008dcf8d66bef22434423b468aa" patches: + "4.3.18": + - patch_file: "patches/0001-cmake-openssl-install-directories.patch" + base_path: "source_subfolder" "4.3.16": - patch_file: "patches/0001-cmake-openssl-install-directories.patch" base_path: "source_subfolder" diff --git a/recipes/amqp-cpp/config.yml b/recipes/amqp-cpp/config.yml index 25894cbf035c2..81db570a6cd83 100644 --- a/recipes/amqp-cpp/config.yml +++ b/recipes/amqp-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "4.3.18": + folder: all "4.3.16": folder: all "4.3.11": diff --git a/recipes/android-ndk/all/conanfile.py b/recipes/android-ndk/all/conanfile.py index 5e792a8a7deac..cf7fce07c64ba 100644 --- a/recipes/android-ndk/all/conanfile.py +++ b/recipes/android-ndk/all/conanfile.py @@ -1,12 +1,13 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration from conan.tools.files import get, download, unzip, load, copy from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os import re import shutil -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class AndroidNDKConan(ConanFile): @@ -38,6 +39,9 @@ def _settings_os_supported(self): def _settings_arch_supported(self): return self.conan_data["sources"][self.version].get(str(self.settings.os), {}).get(str(self._arch)) is not None + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): if self._is_universal2: self.info.settings.arch = "universal:armv8/x86_64" @@ -50,9 +54,6 @@ def validate(self): if not self._settings_arch_supported: raise ConanInvalidConfiguration(f"os,arch={self.settings.os},{self.settings.arch} is not supported by {self.name} (no binaries are available)") - def layout(self): - basic_layout(self, src_folder="src") - def source(self): pass @@ -65,11 +66,11 @@ def build(self): destination=self.source_folder, strip_root=True) def package(self): - copy(self, "*", src=self.source_folder, dst=self.package_folder, keep_path=True) + copy(self, "*", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) copy(self, "*NOTICE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) copy(self, "*NOTICE.toolchain", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - copy(self, "cmake-wrapper.cmd", src=os.path.join(self.source_folder, os.pardir), dst=self.package_folder) - copy(self, "cmake-wrapper", src=os.path.join(self.source_folder, os.pardir), dst=self.package_folder) + copy(self, "cmake-wrapper.cmd", src=os.path.join(self.source_folder, os.pardir), dst=os.path.join(self.package_folder, "bin")) + copy(self, "cmake-wrapper", src=os.path.join(self.source_folder, os.pardir), dst=os.path.join(self.package_folder, "bin")) self._fix_broken_links() self._fix_permissions() @@ -133,7 +134,7 @@ def _ndk_version_minor(self): def _fix_permissions(self): if os.name != "posix": return - for root, _, files in os.walk(self.package_folder): + for root, _, files in os.walk(os.path.join(self.package_folder, "bin")): for filename in files: filename = os.path.join(root, filename) with open(filename, "rb") as f: @@ -169,7 +170,7 @@ def _fix_broken_links(self): f"toolchains/llvm/prebuilt/{platform}-x86_64/x86_64-linux-android/bin/as": "../../bin/x86_64-linux-android-as", f"toolchains/llvm/prebuilt/{platform}-x86_64/i686-linux-android/bin/as": "../../bin/i686-linux-android-as"} for path, target in links.items(): - path = os.path.join(self.package_folder, path) + path = os.path.join(self.package_folder, "bin", path) os.unlink(path) os.symlink(target, path) @@ -177,9 +178,13 @@ def _fix_broken_links(self): def _host(self): return f"{self._platform}-{self._arch}" + @property + def _ndk_root_rel_path(self): + return os.path.join("bin", "toolchains", "llvm", "prebuilt", self._host) + @property def _ndk_root(self): - return os.path.join(self.package_folder, "toolchains", "llvm", "prebuilt", self._host) + return os.path.join(self.package_folder, self._ndk_root_rel_path) def _wrap_executable(self, tool): suffix = ".exe" if self.settings_build.os == "Windows" else "" @@ -220,7 +225,6 @@ def _define_tool_var(self, name, value, bare = False): if not os.path.isfile(path): self.output.error(f"'Environment variable {name} could not be created: '{path}'") return "UNKNOWN" - self.output.info(f"Creating {name} environment variable: {path}") return path def _define_tool_var_naked(self, name, value): @@ -229,7 +233,6 @@ def _define_tool_var_naked(self, name, value): if not os.path.isfile(path): self.output.error(f"'Environment variable {name} could not be created: '{path}'") return "UNKNOWN" - self.output.info(f"Creating {name} environment variable: {path}") return path @staticmethod @@ -239,17 +242,14 @@ def _chmod_plus_x(filename): def package_info(self): self.cpp_info.includedirs = [] - - # test shall pass, so this runs also in the build as build requirement context - # ndk-build: https://developer.android.com/ndk/guides/ndk-build - self.cpp_info.bindirs.append(".") + self.cpp_info.libdirs = [] # You should use the ANDROID_NDK_ROOT environment variable to indicate where the NDK is located. # That's what most NDK-related scripts use (inside the NDK, and outside of it). # https://groups.google.com/g/android-ndk/c/qZjhOaynHXc - self.buildenv_info.define_path("ANDROID_NDK_ROOT", self.package_folder) + self.buildenv_info.define_path("ANDROID_NDK_ROOT", os.path.join(self.package_folder, "bin")) - self.buildenv_info.define_path("ANDROID_NDK_HOME", self.package_folder) + self.buildenv_info.define_path("ANDROID_NDK_HOME", os.path.join(self.package_folder, "bin")) # this is not enough, I can kill that ..... if not hasattr(self, "settings_target"): @@ -265,28 +265,21 @@ def package_info(self): self.output.warn(f"You've added {self.name}/{self.version} as a build requirement, while os={self.settings_target.os} != Android") return + self.cpp_info.bindirs.append(os.path.join(self._ndk_root_rel_path, "bin")) + self.buildenv_info.define_path("NDK_ROOT", self._ndk_root) self.buildenv_info.define("CHOST", self._llvm_triplet) ndk_sysroot = os.path.join(self._ndk_root, "sysroot") + self.conf_info.define("tools.build:sysroot", ndk_sysroot) self.buildenv_info.define_path("SYSROOT", ndk_sysroot) - self.cpp_info.sysroot = ndk_sysroot - self.buildenv_info.define("ANDROID_NATIVE_API_LEVEL", str(self.settings_target.os.api_level)) - # TODO: It's not clear how this all mechanism of cmake-wrapper should be emulated in conan v2, - # and actually if it matters at all. - # Is it not the purpose of the toolchain defined later to pass all these informations? - self._chmod_plus_x(os.path.join(self.package_folder, "cmake-wrapper")) - cmake_wrapper = "cmake-wrapper.cmd" if self.settings.os == "Windows" else "cmake-wrapper" - cmake_wrapper = os.path.join(self.package_folder, cmake_wrapper) - self.output.info(f"Creating CONAN_CMAKE_PROGRAM environment variable: {cmake_wrapper}") - self.env_info.CONAN_CMAKE_PROGRAM = cmake_wrapper - - toolchain = os.path.join(self.package_folder, "build", "cmake", "android.toolchain.cmake") - self.conf_info.prepend("tools.cmake.cmaketoolchain:user_toolchain", toolchain) + # CMakeToolchain automatically adds the standard Android toolchain file that ships with the NDK + # when `tools.android:ndk_path` is provided, so it MUST NOT be manually injected here to `tools.cmake.cmaketoolchain:user_toolchain` conf_info + self.conf_info.define("tools.android:ndk_path", os.path.join(self.package_folder, "bin")) self.buildenv_info.define_path("CC", self._define_tool_var("CC", "clang")) self.buildenv_info.define_path("CXX", self._define_tool_var("CXX", "clang++")) @@ -319,48 +312,51 @@ def package_info(self): libcxx_str = str(self.settings_target.compiler.libcxx) self.buildenv_info.define("ANDROID_STL", libcxx_str if libcxx_str.startswith("c++_") else "c++_shared") - self.conf_info.define("tools.android:ndk_path", self.package_folder) - # TODO: conan v1 stuff to remove later - self.env_info.PATH.append(self.package_folder) - self.env_info.ANDROID_NDK_ROOT = self.package_folder - self.env_info.ANDROID_NDK_HOME = self.package_folder - cmake_system_processor = self._cmake_system_processor - if cmake_system_processor: - self.env_info.CONAN_CMAKE_SYSTEM_PROCESSOR = cmake_system_processor - else: - self.output.warn("Could not find a valid CMAKE_SYSTEM_PROCESSOR variable, supported by CMake") - self.env_info.NDK_ROOT = self._ndk_root - self.env_info.CHOST = self._llvm_triplet - self.env_info.CONAN_CMAKE_FIND_ROOT_PATH = ndk_sysroot - self.env_info.SYSROOT = ndk_sysroot - self.env_info.ANDROID_NATIVE_API_LEVEL = str(self.settings_target.os.api_level) - self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain - self.env_info.CC = self._define_tool_var("CC", "clang") - self.env_info.CXX = self._define_tool_var("CXX", "clang++") - self.env_info.AR = self._define_tool_var("AR", "ar", bare) - self.env_info.AS = self._define_tool_var("AS", "as", bare) - self.env_info.RANLIB = self._define_tool_var("RANLIB", "ranlib", bare) - self.env_info.STRIP = self._define_tool_var("STRIP", "strip", bare) - self.env_info.ADDR2LINE = self._define_tool_var("ADDR2LINE", "addr2line", bare) - self.env_info.NM = self._define_tool_var("NM", "nm", bare) - self.env_info.OBJCOPY = self._define_tool_var("OBJCOPY", "objcopy", bare) - self.env_info.OBJDUMP = self._define_tool_var("OBJDUMP", "objdump", bare) - self.env_info.READELF = self._define_tool_var("READELF", "readelf", bare) - if self._ndk_version_major < 23: - self.env_info.ELFEDIT = self._define_tool_var("ELFEDIT", "elfedit") - if self._ndk_version_major >= 22: - self.env_info.LD = self._define_tool_var_naked("LD", "ld") - else: - self.env_info.LD = self._define_tool_var("LD", "ld") - self.env_info.ANDROID_PLATFORM = f"android-{self.settings_target.os.api_level}" - self.env_info.ANDROID_TOOLCHAIN = "clang" - self.env_info.ANDROID_ABI = self._android_abi - self.env_info.ANDROID_STL = libcxx_str if libcxx_str.startswith("c++_") else "c++_shared" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH" + if Version(conan_version).major < 2: + self.env_info.PATH.extend([os.path.join(self.package_folder, "bin"), os.path.join(self._ndk_root, "bin")]) + self.env_info.ANDROID_NDK_ROOT = os.path.join(self.package_folder, "bin") + self.env_info.ANDROID_NDK_HOME = os.path.join(self.package_folder, "bin") + cmake_system_processor = self._cmake_system_processor + if cmake_system_processor: + self.env_info.CONAN_CMAKE_SYSTEM_PROCESSOR = cmake_system_processor + else: + self.output.warn("Could not find a valid CMAKE_SYSTEM_PROCESSOR variable, supported by CMake") + self.env_info.NDK_ROOT = self._ndk_root + self.env_info.CHOST = self._llvm_triplet + self.env_info.CONAN_CMAKE_FIND_ROOT_PATH = ndk_sysroot + self.env_info.SYSROOT = ndk_sysroot + self.env_info.ANDROID_NATIVE_API_LEVEL = str(self.settings_target.os.api_level) + self._chmod_plus_x(os.path.join(self.package_folder, "bin", "cmake-wrapper")) + cmake_wrapper = "cmake-wrapper.cmd" if self.settings.os == "Windows" else "cmake-wrapper" + cmake_wrapper = os.path.join(self.package_folder, "bin", cmake_wrapper) + self.env_info.CONAN_CMAKE_PROGRAM = cmake_wrapper + self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = os.path.join(self.package_folder, "bin", "build", "cmake", "android.toolchain.cmake") + self.env_info.CC = self._define_tool_var("CC", "clang") + self.env_info.CXX = self._define_tool_var("CXX", "clang++") + self.env_info.AR = self._define_tool_var("AR", "ar", bare) + self.env_info.AS = self._define_tool_var("AS", "as", bare) + self.env_info.RANLIB = self._define_tool_var("RANLIB", "ranlib", bare) + self.env_info.STRIP = self._define_tool_var("STRIP", "strip", bare) + self.env_info.ADDR2LINE = self._define_tool_var("ADDR2LINE", "addr2line", bare) + self.env_info.NM = self._define_tool_var("NM", "nm", bare) + self.env_info.OBJCOPY = self._define_tool_var("OBJCOPY", "objcopy", bare) + self.env_info.OBJDUMP = self._define_tool_var("OBJDUMP", "objdump", bare) + self.env_info.READELF = self._define_tool_var("READELF", "readelf", bare) + if self._ndk_version_major < 23: + self.env_info.ELFEDIT = self._define_tool_var("ELFEDIT", "elfedit") + if self._ndk_version_major >= 22: + self.env_info.LD = self._define_tool_var_naked("LD", "ld") + else: + self.env_info.LD = self._define_tool_var("LD", "ld") + self.env_info.ANDROID_PLATFORM = f"android-{self.settings_target.os.api_level}" + self.env_info.ANDROID_TOOLCHAIN = "clang" + self.env_info.ANDROID_ABI = self._android_abi + self.env_info.ANDROID_STL = libcxx_str if libcxx_str.startswith("c++_") else "c++_shared" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH" def _unzip_fix_symlinks(self, url, target_folder, sha256): # Python's built-in module 'zipfile' won't handle symlinks (https://bugs.python.org/issue37921) diff --git a/recipes/antlr4-cppruntime/all/CMakeLists.txt b/recipes/antlr4-cppruntime/all/CMakeLists.txt deleted file mode 100644 index 327601d6d347e..0000000000000 --- a/recipes/antlr4-cppruntime/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder/runtime/Cpp) diff --git a/recipes/antlr4-cppruntime/all/conandata.yml b/recipes/antlr4-cppruntime/all/conandata.yml index 7cbac2212a675..2605966cb79dc 100644 --- a/recipes/antlr4-cppruntime/all/conandata.yml +++ b/recipes/antlr4-cppruntime/all/conandata.yml @@ -2,13 +2,38 @@ sources: "4.9.3": url: "https://github.com/antlr/antlr4/archive/refs/tags/4.9.3.tar.gz" sha256: "efe4057d75ab48145d4683100fec7f77d7f87fa258707330cadd1f8e6f7eecae" - "4.10": - url: "https://github.com/antlr/antlr4/archive/refs/tags/4.10.tar.gz" - sha256: "39b2604fc75fa77323bd7046f2fb750c818cf11fcce2cd6cca06b6697f60ffbb" "4.10.1": url: "https://github.com/antlr/antlr4/archive/refs/tags/4.10.1.tar.gz" sha256: "a320568b738e42735946bebc5d9d333170e14a251c5734e8b852ad1502efa8a2" + "4.11.1": + url: "https://github.com/antlr/antlr4/archive/refs/tags/4.11.1.tar.gz" + sha256: "81f87f03bb83b48da62e4fc8bfdaf447efb9fb3b7f19eb5cbc37f64e171218cf" patches: "4.9.3": - patch_file: "patches/0001-update-cmakelist.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-update-DropLibuuid-4.9.3-1.patch" + patch_description: "Revise the CMakeLists.txt to remove the dependency on libuuid (#1) which is not used since 4.9." + patch_type: "backport" + patch_source: "https://github.com/antlr/antlr4/pull/3787" + - patch_file: "patches/0004-update-DropLibuuid-4.9.3-2.patch" + patch_description: "Revise the CMakeLists.txt to remove the dependency on libuuid (#2) which is not used since 4.9." + patch_type: "backport" + patch_source: "https://github.com/antlr/antlr4/pull/3787" + "4.10.1": + - patch_file: "patches/0004-update-DropLibuuid-4.10.x-1.patch" + patch_description: "Revise the CMakeLists.txt to remove the dependency on libuuid (#1) which is not used since 4.9." + patch_type: "backport" + patch_source: "https://github.com/antlr/antlr4/pull/3787" + - patch_file: "patches/0004-update-DropLibuuid-4.10.x-2.patch" + patch_description: "Revise the CMakeLists.txt to remove the dependency on libuuid (#2) which is not used since 4.9." + patch_type: "backport" + patch_source: "https://github.com/antlr/antlr4/pull/3787" + "4.11.1": + - patch_file: "patches/0002-update-FlatHashSet.patch" + patch_description: "Fix the compiler errors reported by GCC 7 due to the new type FlatHashSet introduced in 4.11." + patch_type: "portability" + patch_source: "https://github.com/antlr/antlr4/pull/3885" + - patch_file: "patches/0003-update-FlatHashMap.patch" + patch_description: "Fix the compiler errors reported by GCC 7 due to the new type FlatHashMap introduced in 4.11." + patch_type: "portability" + patch_source: "https://github.com/antlr/antlr4/pull/3885" diff --git a/recipes/antlr4-cppruntime/all/conanfile.py b/recipes/antlr4-cppruntime/all/conanfile.py index 5f1d957aa04fd..e47c4f36aca6b 100644 --- a/recipes/antlr4-cppruntime/all/conanfile.py +++ b/recipes/antlr4-cppruntime/all/conanfile.py @@ -1,11 +1,14 @@ -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, check_min_vs +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy, rm, rmdir, save +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os import textwrap -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.52.0" class Antlr4CppRuntimeConan(ConanFile): @@ -15,6 +18,7 @@ class Antlr4CppRuntimeConan(ConanFile): topics = ("antlr", "parser", "runtime") url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" + settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,30 +27,29 @@ class Antlr4CppRuntimeConan(ConanFile): "shared": False, "fPIC": True, } - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "pkg_config" short_paths = True - compiler_required_cpp17 = { - "Visual Studio": "16", + @property + def _minimum_cpp_standard(self): + # Antlr 4.9.3 requires C++11 while newer versions require C++17 + return 17 if Version(self.version) >= "4.10" else 11 + + @property + def _minimum_compiler_versions_cpp17(self): + return { "gcc": "7", "clang": "5", "apple-clang": "9.1" - } - - - @property - def _source_subfolder(self): - return "source_subfolder" + } - @property - def _build_subfolder(self): - return "build_subfolder" + def _check_minimum_compiler_version_cpp17(self): + compiler = self.info.settings.compiler + min_compiler_version = self._minimum_compiler_versions_cpp17.get(str(compiler), False) + if min_compiler_version and Version(compiler.version) < min_compiler_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++17, which your compiler does not support.") 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": @@ -54,93 +57,74 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): + # As of 4.11, antlr4-cppruntime no longer requires libuuid. + # Reference: [C++] Remove libuuid dependency (https://github.com/antlr/antlr4/pull/3787) + # Note that the above PR points that libuuid can be removed from 4.9.3, 4.10 and 4.10.1 as well. + # We have patched the CMakeLists.txt to drop the dependency on libuuid from aforementioned antlr versions. self.requires("utfcpp/3.2.1") - if self.settings.os in ("FreeBSD", "Linux"): - self.requires("libuuid/1.0.3") def validate(self): - if str(self.settings.arch).startswith("arm"): - raise ConanInvalidConfiguration("arm architectures are not supported") - # Need to deal with missing libuuid on Arm. - # So far ANTLR delivers macOS binary package. - - compiler = self.settings.compiler - compiler_version = tools.Version(self.settings.compiler.version) - antlr_version = tools.Version(self.version) - - if compiler == "Visual Studio" and compiler_version < "16": - raise ConanInvalidConfiguration("library claims C2668 'Ambiguous call to overloaded function'") - # Compilation of this library on version 15 claims C2668 Error. - # This could be Bogus error or malformed Antl4 libary. - # Version 16 compiles this code correctly. - - if antlr_version >= "4.10": - # Antlr4 for 4.9.3 does not require C++17 - C++11 is enough. - # for newest version we need C++17 compatible compiler here - - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") - - minimum_version = self.compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if compiler_version < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) - - if is_msvc(self) and antlr_version == "4.10": - raise ConanInvalidConfiguration("{} Antlr4 4.10 version is broken on msvc - Use 4.10.1 or above.".format(self.name)) - - def build_requirements(self): - if self.settings.os in ("FreeBSD", "Linux"): - self.build_requires("pkgconf/1.7.4") + # Compilation of this library on version 15 claims C2668 Error. + # This could be Bogus error or malformed Antlr4 library. + # Guard: The minimum MSVC version is 16 or 1920 (which already supports C++17) + check_min_vs(self, "192") + + # Check the minimum C++ standard + min_cppstd = self._minimum_cpp_standard + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, min_cppstd) + # Check the minimum compiler version + if min_cppstd == 17: + self._check_minimum_compiler_version_cpp17() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ANTLR4_INSTALL"] = True - cmake.definitions["WITH_LIBCXX"] = self.settings.compiler.get_safe("libcxx") == "libc++" - cmake.definitions["ANTLR_BUILD_CPP_TESTS"] = False + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ANTLR4_INSTALL"] = True + tc.variables["WITH_LIBCXX"] = self.settings.compiler.get_safe("libcxx") == "libc++" + tc.variables["ANTLR_BUILD_CPP_TESTS"] = False if is_msvc(self): - cmake.definitions["WITH_STATIC_CRT"] = is_msvc_static_runtime(self) - cmake.definitions["WITH_DEMO"] = False - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["WITH_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.variables["WITH_DEMO"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder="runtime/Cpp") cmake.build() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=os.path.join(self.source_folder), dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime-static.*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime.a") + rm(self, "*antlr4-runtime-static.*", os.path.join(self.package_folder, "lib")) + rm(self, "*antlr4-runtime.a", os.path.join(self.package_folder, "lib")) else: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.dll") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "antlr4-runtime.lib") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime.so*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime.dll*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime.*dylib") - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "antlr4-runtime.lib", os.path.join(self.package_folder, "lib")) + rm(self, "*antlr4-runtime.so*", os.path.join(self.package_folder, "lib")) + rm(self, "*antlr4-runtime.dll*", os.path.join(self.package_folder, "lib")) + rm(self, "*antlr4-runtime.*dylib", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) # FIXME: this also removes lib/cmake/antlr4-generator # This cmake config script is needed to provide the cmake function `antlr4_generate` - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* generatores removed self._create_cmake_module_alias_targets( @@ -148,8 +132,7 @@ def package(self): {"antlr4_shared" if self.options.shared else "antlr4_static": "antlr4-cppruntime::antlr4-cppruntime"} ) - @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(f"""\ @@ -158,7 +141,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): diff --git a/recipes/antlr4-cppruntime/all/patches/0002-update-FlatHashSet.patch b/recipes/antlr4-cppruntime/all/patches/0002-update-FlatHashSet.patch new file mode 100644 index 0000000000000..336271b756971 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0002-update-FlatHashSet.patch @@ -0,0 +1,15 @@ +--- runtime/Cpp/runtime/src/FlatHashSet.h ++++ runtime/Cpp/runtime/src/FlatHashSet.h +@@ -48,9 +48,9 @@ + using FlatHashSet = absl::flat_hash_set; + #else + template ::hasher, +- typename Equal = typename std::unordered_set::key_equal, +- typename Allocator = typename std::unordered_set::allocator_type> ++ typename Hash = std::hash, ++ typename Equal = std::equal_to, ++ typename Allocator = std::allocator> + using FlatHashSet = std::unordered_set; + #endif + diff --git a/recipes/antlr4-cppruntime/all/patches/0003-update-FlatHashMap.patch b/recipes/antlr4-cppruntime/all/patches/0003-update-FlatHashMap.patch new file mode 100644 index 0000000000000..e841ee8933643 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0003-update-FlatHashMap.patch @@ -0,0 +1,15 @@ +--- runtime/Cpp/runtime/src/FlatHashMap.h ++++ runtime/Cpp/runtime/src/FlatHashMap.h +@@ -48,9 +48,9 @@ + using FlatHashMap = absl::flat_hash_map; + #else + template ::hasher, +- typename Equal = typename std::unordered_map::key_equal, +- typename Allocator = typename std::unordered_map::allocator_type> ++ typename Hash = std::hash, ++ typename Equal = std::equal_to, ++ typename Allocator = std::allocator>> + using FlatHashMap = std::unordered_map; + #endif + diff --git a/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-1.patch b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-1.patch new file mode 100644 index 0000000000000..52e813be947a8 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-1.patch @@ -0,0 +1,13 @@ +--- runtime/Cpp/CMakeLists.txt ++++ runtime/Cpp/CMakeLists.txt +@@ -41,10 +41,6 @@ + CMAKE_POLICY(SET CMP0054 OLD) + endif() + +-if(CMAKE_SYSTEM_NAME MATCHES "Linux") +- find_package(PkgConfig REQUIRED) +- pkg_check_modules(UUID REQUIRED uuid) +-endif() + if(APPLE) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + endif() diff --git a/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-2.patch b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-2.patch new file mode 100644 index 0000000000000..f1fffa5599c8b --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-2.patch @@ -0,0 +1,14 @@ +--- runtime/Cpp/runtime/CMakeLists.txt ++++ runtime/Cpp/runtime/CMakeLists.txt +@@ -69,10 +69,7 @@ + gtest_discover_tests(antlr4_tests) + endif() + +-if(CMAKE_SYSTEM_NAME MATCHES "Linux") +- target_link_libraries(antlr4_shared ${UUID_LIBRARIES}) +- target_link_libraries(antlr4_static ${UUID_LIBRARIES}) +-elseif(APPLE) ++if(APPLE) + target_link_libraries(antlr4_shared ${COREFOUNDATION_LIBRARY}) + target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY}) + endif() diff --git a/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-1.patch b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-1.patch new file mode 100644 index 0000000000000..6412c93b3d0b5 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-1.patch @@ -0,0 +1,13 @@ +--- runtime/Cpp/CMakeLists.txt ++++ runtime/Cpp/CMakeLists.txt +@@ -39,10 +39,6 @@ + CMAKE_POLICY(SET CMP0054 OLD) + endif() + +-if(CMAKE_SYSTEM_NAME MATCHES "Linux") +- find_package(PkgConfig REQUIRED) +- pkg_check_modules(UUID REQUIRED uuid) +-endif() + if(APPLE) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + endif() diff --git a/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-2.patch b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-2.patch new file mode 100644 index 0000000000000..a9b062d8bea5a --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-2.patch @@ -0,0 +1,14 @@ +--- runtime/Cpp/runtime/CMakeLists.txt ++++ runtime/Cpp/runtime/CMakeLists.txt +@@ -75,10 +75,7 @@ + endif() + endif() + +-if(CMAKE_SYSTEM_NAME MATCHES "Linux") +- target_link_libraries(antlr4_shared ${UUID_LIBRARIES}) +- target_link_libraries(antlr4_static ${UUID_LIBRARIES}) +-elseif(APPLE) ++if(APPLE) + target_link_libraries(antlr4_shared ${COREFOUNDATION_LIBRARY}) + target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY}) + endif() diff --git a/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt b/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt index 90f183c23127a..e1a9346912d37 100644 --- a/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt +++ b/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(antlr4-runtime REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) @@ -12,4 +9,4 @@ if(TARGET antlr4_shared) else() target_link_libraries(${PROJECT_NAME} PRIVATE antlr4_static) endif() -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/antlr4-cppruntime/all/test_package/conanfile.py b/recipes/antlr4-cppruntime/all/test_package/conanfile.py index 90eb89e3f2f46..a9fb96656f203 100644 --- a/recipes/antlr4-cppruntime/all/test_package/conanfile.py +++ b/recipes/antlr4-cppruntime/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt b/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b9ee4c6f88e3f --- /dev/null +++ b/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(antlr4-runtime REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +if(TARGET antlr4_shared) + target_link_libraries(${PROJECT_NAME} PRIVATE antlr4_shared) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE antlr4_static) +endif() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/antlr4-cppruntime/all/test_v1_package/conanfile.py b/recipes/antlr4-cppruntime/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90eb89e3f2f46 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/antlr4-cppruntime/config.yml b/recipes/antlr4-cppruntime/config.yml index 9b65d8dc1061b..fd8294e924d85 100644 --- a/recipes/antlr4-cppruntime/config.yml +++ b/recipes/antlr4-cppruntime/config.yml @@ -1,7 +1,7 @@ versions: "4.9.3": folder: all - "4.10": - folder: all "4.10.1": folder: all + "4.11.1": + folder: all diff --git a/recipes/aravis/all/conanfile.py b/recipes/aravis/all/conanfile.py index 9c2e5d3df66d8..3e8bc058b7f3a 100644 --- a/recipes/aravis/all/conanfile.py +++ b/recipes/aravis/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, Meson, RunEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, export_conandata_patches, apply_conandata_patches, rename, chdir, rm, rmdir +from conan.tools.microsoft import is_msvc +from conans import Meson, RunEnvironment, tools import os import glob +required_conan_version = ">=1.52.0" class AravisConan(ConanFile): name = "aravis" @@ -46,10 +50,6 @@ def _build_subfolder(self): def _aravis_api_version(self): return ".".join(self.version.split(".")[0:2]) - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -62,7 +62,7 @@ def configure(self): self.options["glib"].shared = True def validate(self): - if self._is_msvc and self.settings.get_safe("compiler.runtime", "").startswith("MT"): + if is_msvc(self) and self.settings.get_safe("compiler.runtime", "").startswith("MT"): raise ConanInvalidConfiguration("Static MT/MTd runtime is not supported on Windows due to GLib issues") if not self.options["glib"].shared and self.options.shared: raise ConanInvalidConfiguration("Shared Aravis cannot link to static GLib") @@ -70,31 +70,26 @@ def validate(self): raise ConanInvalidConfiguration("macOS builds are disabled until conan-io/conan#7324 gets merged to fix macOS SIP issue #8443") def build_requirements(self): - self.build_requires("meson/0.60.2") - self.build_requires("pkgconf/1.7.4") + self.build_requires("meson/0.63.3") + self.build_requires("pkgconf/1.9.3") if self.options.introspection: - self.build_requires("gobject-introspection/1.70.0") + self.build_requires("gobject-introspection/1.72.0") def requirements(self): - self.requires("glib/2.70.1") - self.requires("libxml2/2.9.12") - self.requires("zlib/1.2.11") + self.requires("glib/2.74.0") + self.requires("libxml2/2.9.14") + self.requires("zlib/1.2.12") if self.options.usb: - self.requires("libusb/1.0.24") + self.requires("libusb/1.0.26") if self.options.gst_plugin: self.requires("gstreamer/1.19.2") self.requires("gst-plugins-base/1.19.2") 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 source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_meson(self): if self._meson: @@ -115,19 +110,19 @@ def _configure_meson(self): return self._meson def build(self): - self._patch_sources() + apply_conandata_patches(self) with tools.environment_append(RunEnvironment(self).vars): meson = self._configure_meson() meson.build() def _fix_library_names(self, path): # https://github.com/mesonbuild/meson/issues/1412 - if not self.options.shared and self._is_msvc: - with tools.chdir(path): + if not self.options.shared and is_msvc(self): + with chdir(self, path): for filename_old in glob.glob("*.a"): filename_new = filename_old[3:-2] + ".lib" - self.output.info("rename %s into %s" % (filename_old, filename_new)) - tools.rename(filename_old, filename_new) + self.output.info(f"rename {filename_old} into {filename_new}") + rename(self, filename_old, filename_new) def package(self): self.copy("COPYING", src=self._source_subfolder, dst="licenses", keep_path=False) @@ -138,10 +133,10 @@ def package(self): self._fix_library_names(os.path.join(self.package_folder, "lib")) if self.options.gst_plugin: self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(self.package_folder, "*.pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", self.package_folder, recursive=True) if not self.options.tools: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "arv-*") + rm(self, "arv-*", os.path.join(self.package_folder, "bin")) def package_id(self): self.info.requires["glib"].full_package_mode() @@ -150,7 +145,7 @@ def package_id(self): self.info.requires["gst-plugins-base"].full_package_mode() def package_info(self): - aravis_name = "aravis-{}".format(self._aravis_api_version) + aravis_name = f"aravis-{self._aravis_api_version}" self.cpp_info.names["pkg_config"] = aravis_name self.cpp_info.includedirs = [os.path.join("include", aravis_name)] self.cpp_info.libs = [aravis_name] @@ -161,9 +156,9 @@ def package_info(self): if self.options.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) if self.options.gst_plugin and self.options.shared: gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") - self.output.info("Appending GST_PLUGIN_PATH env var: {}".format(gst_plugin_path)) + self.output.info(f"Appending GST_PLUGIN_PATH env var: {gst_plugin_path}") self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) diff --git a/recipes/arcus/all/CMakeLists.txt b/recipes/arcus/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/arcus/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/arcus/all/conandata.yml b/recipes/arcus/all/conandata.yml index 9e659afa43d49..beb6b4ed8bb02 100644 --- a/recipes/arcus/all/conandata.yml +++ b/recipes/arcus/all/conandata.yml @@ -2,3 +2,6 @@ sources: "4.9.1": url: "https://github.com/Ultimaker/libArcus/archive/refs/tags/4.9.1.tar.gz" sha256: "18d939fd2428c72fdce35a286c196438327cfc3c8476e463e5ca46570168c9ce" +patches: + "4.9.1": + - patch_file: "patches/0001-fix-cmake.patch" diff --git a/recipes/arcus/all/conanfile.py b/recipes/arcus/all/conanfile.py index b11f3d26915f9..10256ef37f251 100644 --- a/recipes/arcus/all/conanfile.py +++ b/recipes/arcus/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class ArcusConan(ConanFile): @@ -11,7 +15,7 @@ class ArcusConan(ConanFile): "creating a socket in a thread and using this socket to send " \ "and receive messages based on the Protocol Buffers library." license = "LGPL-3.0-or-later" - topics = ("arcus", "protobuf", "socket", "cura") + topics = ("protobuf", "socket", "cura") homepage = "https://github.com/Ultimaker/libArcus" url = "https://github.com/conan-io/conan-center-index" @@ -26,17 +30,8 @@ class ArcusConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,84 +39,68 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("protobuf/3.17.1") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - # Do not force PIC - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", - "") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set_target_properties(Arcus PROPERTIES COMPILE_FLAGS -fPIC)", - "") - # TODO: this patch could be removed when CMake variables fixed in protobuf recipe - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "target_link_libraries(Arcus PUBLIC ${PROTOBUF_LIBRARIES})", - "target_link_libraries(Arcus PUBLIC protobuf::libprotobuf)") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_PYTHON"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - if self._is_msvc: - if self.settings.compiler == "Visual Studio": - is_static_runtime = str(self.settings.compiler.runtime).startswith("MT") - else: - is_static_runtime = self.settings.compiler.runtime == "static" - self._cmake.definitions["MSVC_STATIC_RUNTIME"] = is_static_runtime - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_PYTHON"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_STATIC"] = not self.options.shared + if is_msvc(self): + tc.variables["MSVC_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"Arcus": "Arcus::Arcus"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) - - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "Arcus") @@ -135,6 +114,5 @@ def package_info(self): # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Arcus" self.cpp_info.names["cmake_find_package_multi"] = "Arcus" - self.cpp_info.builddirs.append(self._module_subfolder) self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/arcus/all/patches/0001-fix-cmake.patch b/recipes/arcus/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..581de6fa9b257 --- /dev/null +++ b/recipes/arcus/all/patches/0001-fix-cmake.patch @@ -0,0 +1,62 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ ++cmake_minimum_required(VERSION 3.8) + project(arcus) +-cmake_minimum_required(VERSION 3.6) + + include(GNUInstallDirs) + include(CMakePackageConfigHelpers) +@@ -19,7 +19,6 @@ endif() + set(protobuf_MODULE_COMPATIBLE ON CACHE INTERNAL "" FORCE) + find_package(Protobuf 3.0.0 REQUIRED) + +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) #Required if a patch to libArcus needs to be made via templates. + + if(BUILD_PYTHON) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +@@ -37,11 +36,7 @@ if(BUILD_PYTHON) + include_directories(python/ src/ ${SIP_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}) + endif() + +-set(CMAKE_CXX_STANDARD 11) + +-if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") +-endif() + + set(arcus_SRCS + src/Socket.cpp +@@ -63,17 +58,16 @@ set(arcus_HDRS + set(ARCUS_VERSION 1.1.0) + set(ARCUS_SOVERSION 3) + +-set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") + + if(BUILD_STATIC) + add_library(Arcus STATIC ${arcus_SRCS}) + if(NOT WIN32 OR CMAKE_COMPILER_IS_GNUCXX) + target_link_libraries(Arcus PRIVATE pthread) +- set_target_properties(Arcus PROPERTIES COMPILE_FLAGS -fPIC) + endif() + else() + add_library(Arcus SHARED ${arcus_SRCS}) + endif() ++target_compile_features(Arcus PUBLIC cxx_std_11) + + if(MSVC_STATIC_RUNTIME) + foreach(flag_var +@@ -97,11 +91,11 @@ target_include_directories(Arcus PUBLIC + $ + ${PROTOBUF_INCLUDE_DIR} + ) +-target_link_libraries(Arcus PUBLIC ${PROTOBUF_LIBRARIES}) ++target_link_libraries(Arcus PUBLIC protobuf::libprotobuf) + + if(WIN32) + add_definitions(-D_WIN32_WINNT=0x0600) # Declare we require Vista or higher, this allows us to use IPv6 functions. +- target_link_libraries(Arcus PUBLIC Ws2_32) ++ target_link_libraries(Arcus PUBLIC ws2_32) + endif() + + if(${CMAKE_BUILD_TYPE}) diff --git a/recipes/arcus/all/test_package/CMakeLists.txt b/recipes/arcus/all/test_package/CMakeLists.txt index ef27cd84029d8..376d65791e678 100644 --- a/recipes/arcus/all/test_package/CMakeLists.txt +++ b/recipes/arcus/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Arcus REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Arcus) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE Arcus) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/arcus/all/test_package/conanfile.py b/recipes/arcus/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/arcus/all/test_package/conanfile.py +++ b/recipes/arcus/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/arcus/all/test_v1_package/CMakeLists.txt b/recipes/arcus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..5b257f71e6bdc --- /dev/null +++ b/recipes/arcus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Arcus REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Arcus) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/arcus/all/test_v1_package/conanfile.py b/recipes/arcus/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/arcus/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/argparse/all/conandata.yml b/recipes/argparse/all/conandata.yml index 741831c2fa64b..18f4555649896 100644 --- a/recipes/argparse/all/conandata.yml +++ b/recipes/argparse/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.9": + url: "https://github.com/p-ranav/argparse/archive/v2.9.tar.gz" + sha256: "cd563293580b9dc592254df35b49cf8a19b4870ff5f611c7584cf967d9e6031e" "2.6": url: "https://github.com/p-ranav/argparse/archive/v2.6.tar.gz" sha256: "da261c3b3010c10a163f4535bbe2b160319d2a6b1e0fd2eb5a7b9f6a85c29021" diff --git a/recipes/argparse/config.yml b/recipes/argparse/config.yml index c4a01f65b8f9b..5a743e89da3ef 100644 --- a/recipes/argparse/config.yml +++ b/recipes/argparse/config.yml @@ -1,4 +1,6 @@ versions: + "2.9": + folder: all "2.6": folder: all "2.5": diff --git a/recipes/arrow/all/CMakeLists.txt b/recipes/arrow/all/CMakeLists.txt deleted file mode 100644 index 5fce337b405db..0000000000000 --- a/recipes/arrow/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/cpp) diff --git a/recipes/arrow/all/conandata.yml b/recipes/arrow/all/conandata.yml index 57dc370908163..d1871e991c44b 100644 --- a/recipes/arrow/all/conandata.yml +++ b/recipes/arrow/all/conandata.yml @@ -16,59 +16,58 @@ sources: sha256: "08fbd4c633c08939850d619ca0224c75d7a0526467c721c0838b8aa7efccb270" patches: "8.0.1": - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0004-use-find-package.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0005-install-utils.patch" + - 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_file: "patches/8.0.0-0005-install-utils.patch" + patch_description: "enable utilis installation" + patch_type: "conan" + - patch_file: "patches/8.0.0-0006-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "8.0.0": - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0004-use-find-package.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0005-install-utils.patch" + - 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_file: "patches/8.0.0-0005-install-utils.patch" + patch_description: "enable utilis installation" + patch_type: "conan" + - patch_file: "patches/8.0.0-0006-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "7.0.0": - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0003-mallctl-takes-size_t.patch" - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0005-use-find-package.patch" - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0006-install-utils.patch" + - 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_file: "patches/7.0.0-0006-install-utils.patch" + patch_description: "enable utilis installation" + patch_type: "conan" + - patch_file: "patches/7.0.0-0007-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "2.0.0": - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0003-fix-shared-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0005-gandiva-engine.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0006-gandiva-llvm-re2.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0007-fix-protoc-cmake.patch" + - patch_file: "patches/2.0.0-0003-fix-shared-msvc.patch" + patch_description: "make shared enabled in msvc" + patch_type: "backport" + - 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_file: "patches/2.0.0-0005-gandiva-engine.patch" + patch_description: "fix grandiva compilation error" + patch_type: "backport" + - patch_file: "patches/2.0.0-0008-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "1.0.0": - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0003-fix-shared-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" + - patch_file: "patches/1.0.0-0003-fix-shared-msvc.patch" + patch_description: "make shared enabled in msvc" + patch_type: "backport" + - 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_file: "patches/1.0.0-0005-fix-make12-namespace.patch" + patch_description: "fix ambiguous `make12` function between std and date" + patch_type: "backport" + - 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 5a8b65c292e20..2569b3fd96866 100644 --- a/recipes/arrow/all/conanfile.py +++ b/recipes/arrow/all/conanfile.py @@ -1,10 +1,15 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +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, get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os import glob -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.51.3" class ArrowConan(ConanFile): name = "arrow" @@ -43,6 +48,7 @@ class ArrowConan(ConanFile): "with_grpc": ["auto", True, False], "with_hiveserver2": [True, False], "with_jemalloc": ["auto", True, False], + "with_mimalloc": ["auto", True, False], "with_json": [True, False], "with_llvm": ["auto", True, False], "with_openssl": ["auto", True, False], @@ -87,6 +93,7 @@ class ArrowConan(ConanFile): "with_gcs": False, "with_gflags": "auto", "with_jemalloc": "auto", + "with_mimalloc": False, "with_glog": "auto", "with_grpc": "auto", "with_hiveserver2": False, @@ -104,39 +111,38 @@ class ArrowConan(ConanFile): "with_zlib": False, "with_zstd": False, } - generators = "cmake", "cmake_find_package_multi" short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "2.0.0": + if Version(self.version) < "2.0.0": del self.options.simd_level del self.options.runtime_simd_level - elif tools.Version(self.version) < "6.0.0": + elif Version(self.version) < "6.0.0": self.options.simd_level = "sse4_2" - if tools.Version(self.version) < "6.0.0": + if Version(self.version) < "6.0.0": del self.options.with_gcs - if tools.Version(self.version) < "7.0.0": + if Version(self.version) < "7.0.0": del self.options.skyhook del self.options.with_flight_sql del self.options.with_opentelemetry - if tools.Version(self.version) < "8.0.0": + if Version(self.version) < "8.0.0": del self.options.substrait + def configure(self): + if self.options.shared: + try: + del self.options.fPIC # once removed by config_options, need try..except for a second del + except Exception: + pass + def validate(self): - if self.settings.compiler == "clang" and self.settings.compiler.version <= tools.Version("3.9"): + if self.info.settings.compiler == "clang" and self.info.settings.compiler.version <= Version("3.9"): raise ConanInvalidConfiguration("This recipe does not support this compiler version") if self.options.shared: @@ -180,8 +186,8 @@ def validate(self): if self.options["jemalloc"].enable_cxx: raise ConanInvalidConfiguration("jemmalloc.enable_cxx of a static jemalloc must be disabled") - if tools.Version(self.version) < "6.0.0" and self.options.get_safe("simd_level") == "default": - raise ConanInvalidConfiguration("In {}/{}, simd_level options is not supported `default` value.".format(self.name, self.version)) + if Version(self.version) < "6.0.0" and self.options.get_safe("simd_level") == "default": + raise ConanInvalidConfiguration(f"In {self.ref}, simd_level options is not supported `default` value.") def _compute(self, required=False): if required or self.options.compute == "auto": @@ -209,7 +215,11 @@ def _with_jemalloc(self, required=False): def _with_re2(self, required=False): if required or self.options.with_re2 == "auto": - return bool(self.options.gandiva) + if self.options.gandiva or self.options.parquet: + return True + if Version(self) >= "7.0.0" and (self._compute() or self._dataset_modules()): + return True + return False else: return bool(self.options.with_re2) @@ -247,12 +257,12 @@ def _with_boost(self, required=False): if required or self.options.with_boost == "auto": if self.options.gandiva: return True - version = tools.Version(self.version) + version = Version(self.version) if version.major == "1": - if self._parquet() and self.settings.compiler == "gcc" and self.settings.compiler.version < tools.Version("4.9"): + if self._parquet() and self.settings.compiler == "gcc" and self.settings.compiler.version < Version("4.9"): return True elif version.major >= "2": - if self.settings.compiler == "Visual Studio": + if is_msvc(self): return True return False else: @@ -280,15 +290,24 @@ def _with_openssl(self, required=False): else: return bool(self.options.with_openssl) + def _with_rapidjson(self): + if self.options.with_json: + return True + if Version(self.version) >= "7.0.0" and self.options.encryption: + return True + return False + def requirements(self): if self._with_thrift(): - self.requires("thrift/0.16.0") + self.requires("thrift/0.17.0") if self._with_protobuf(): - self.requires("protobuf/3.21.1") + self.requires("protobuf/3.21.4") if self._with_jemalloc(): self.requires("jemalloc/5.2.1") + if self.options.with_mimalloc: + self.requires("mimalloc/1.7.6") if self._with_boost(): - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") if self._with_gflags(): self.requires("gflags/2.2.2") if self._with_glog(): @@ -296,8 +315,8 @@ def requirements(self): if self.options.get_safe("with_gcs"): self.requires("google-cloud-cpp/1.40.1") if self._with_grpc(): - self.requires("grpc/1.47.0") - if self.options.with_json: + self.requires("grpc/1.48.0") + if self._with_rapidjson(): self.requires("rapidjson/1.1.0") if self._with_llvm(): self.requires("llvm-core/13.0.0") @@ -316,10 +335,10 @@ def requirements(self): if self.options.with_bz2: self.requires("bzip2/1.0.8") if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_snappy: self.requires("snappy/1.1.9") - if tools.Version(self.version) >= "6.0.0" and \ + if Version(self.version) >= "6.0.0" and \ self.options.get_safe("simd_level") != None or \ self.options.get_safe("runtime_simd_level") != None: self.requires("xsimd/8.1.0") @@ -328,135 +347,138 @@ def requirements(self): if self.options.with_zstd: self.requires("zstd/1.5.2") if self._with_re2(): - self.requires("re2/20220201") + self.requires("re2/20220601") if self._with_utf8proc(): self.requires("utf8proc/2.7.0") if self.options.with_backtrace: self.requires("libbacktrace/cci.20210118") 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) - if tools.cross_building(self.settings): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + # BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE are automatically parsed when self.options.shared or self.options.fPIC exist + tc = CMakeToolchain(self) + if cross_building(self): cmake_system_processor = { "armv8": "aarch64", "armv8.3": "aarch64", }.get(str(self.settings.arch), str(self.settings.arch)) - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["ARROW_USE_STATIC_CRT"] = "MT" in str(self.settings.compiler.runtime) - self._cmake.definitions["ARROW_DEPENDENCY_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_GANDIVA"] = self.options.gandiva - self._cmake.definitions["ARROW_PARQUET"] = self._parquet() - self._cmake.definitions["ARROW_SUBSTRAIT"] = self.options.get_safe("substrait", False) - self._cmake.definitions["ARROW_PLASMA"] = self.options.plasma - self._cmake.definitions["ARROW_DATASET"] = self._dataset_modules() - self._cmake.definitions["ARROW_FILESYSTEM"] = self.options.filesystem_layer - self._cmake.definitions["PARQUET_REQUIRE_ENCRYPTION"] = self.options.encryption - self._cmake.definitions["ARROW_HDFS"] = self.options.hdfs_bridgs - self._cmake.definitions["ARROW_VERBOSE_THIRDPARTY_BUILD"] = True - self._cmake.definitions["ARROW_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["ARROW_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["ARROW_NO_DEPRECATED_API"] = not self.options.deprecated - self._cmake.definitions["ARROW_FLIGHT"] = self._with_flight_rpc() - self._cmake.definitions["ARROW_FLIGHT_SQL"] = self.options.get_safe("with_flight_sql", False) - self._cmake.definitions["ARROW_HIVESERVER2"] = self.options.with_hiveserver2 - self._cmake.definitions["ARROW_COMPUTE"] = self._compute() - self._cmake.definitions["ARROW_CSV"] = self.options.with_csv - self._cmake.definitions["ARROW_CUDA"] = self.options.with_cuda - self._cmake.definitions["ARROW_JEMALLOC"] = self._with_jemalloc() - self._cmake.definitions["ARROW_JSON"] = self.options.with_json - self._cmake.definitions["ARROW_GCS"] = self.options.get_safe("with_gcs", False) - - self._cmake.definitions["BOOST_SOURCE"] = "SYSTEM" - self._cmake.definitions["Protobuf_SOURCE"] = "SYSTEM" + tc.variables["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor + if cmake_system_processor == "aarch64": + tc.variables["ARROW_CPU_FLAG"] = "armv8" + if is_msvc(self): + tc.variables["ARROW_USE_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.variables["ARROW_DEPENDENCY_SOURCE"] = "SYSTEM" + 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)) + tc.variables["ARROW_PLASMA"] = bool(self.options.plasma) + tc.variables["ARROW_DATASET"] = self._dataset_modules() + tc.variables["ARROW_FILESYSTEM"] = bool(self.options.filesystem_layer) + tc.variables["PARQUET_REQUIRE_ENCRYPTION"] = bool(self.options.encryption) + tc.variables["ARROW_HDFS"] = bool(self.options.hdfs_bridgs) + tc.variables["ARROW_VERBOSE_THIRDPARTY_BUILD"] = True + tc.variables["ARROW_BUILD_SHARED"] = bool(self.options.shared) + tc.variables["ARROW_BUILD_STATIC"] = not bool(self.options.shared) + tc.variables["ARROW_NO_DEPRECATED_API"] = not bool(self.options.deprecated) + tc.variables["ARROW_FLIGHT"] = self._with_flight_rpc() + tc.variables["ARROW_FLIGHT_SQL"] = bool(self.options.get_safe("with_flight_sql", False)) + tc.variables["ARROW_HIVESERVER2"] = bool(self.options.with_hiveserver2) + tc.variables["ARROW_COMPUTE"] = self._compute() + 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["ARROW_MIMALLOC"] = bool(self.options.with_mimalloc) + tc.variables["ARROW_JSON"] = bool(self.options.with_json) + tc.variables["google_cloud_cpp_SOURCE"] = "SYSTEM" + tc.variables["ARROW_GCS"] = bool(self.options.get_safe("with_gcs", False)) + tc.variables["BOOST_SOURCE"] = "SYSTEM" + tc.variables["Protobuf_SOURCE"] = "SYSTEM" if self._with_protobuf(): - self._cmake.definitions["ARROW_PROTOBUF_USE_SHARED"] = self.options["protobuf"].shared - self._cmake.definitions["gRPC_SOURCE"] = "SYSTEM" + tc.variables["ARROW_PROTOBUF_USE_SHARED"] = bool(self.options["protobuf"].shared) + tc.variables["gRPC_SOURCE"] = "SYSTEM" if self._with_grpc(): - self._cmake.definitions["ARROW_GRPC_USE_SHARED"] = self.options["grpc"].shared - self._cmake.definitions["ARROW_HDFS"] = self.options.hdfs_bridgs - self._cmake.definitions["ARROW_USE_GLOG"] = self._with_glog() - self._cmake.definitions["GLOG_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_WITH_BACKTRACE"] = self.options.with_backtrace - self._cmake.definitions["ARROW_WITH_BROTLI"] = self.options.with_brotli - self._cmake.definitions["Brotli_SOURCE"] = "SYSTEM" + tc.variables["ARROW_GRPC_USE_SHARED"] = bool(self.options["grpc"].shared) + + tc.variables["ARROW_USE_GLOG"] = self._with_glog() + tc.variables["GLOG_SOURCE"] = "SYSTEM" + tc.variables["ARROW_WITH_BACKTRACE"] = bool(self.options.with_backtrace) + tc.variables["ARROW_WITH_BROTLI"] = bool(self.options.with_brotli) + tc.variables["brotli_SOURCE"] = "SYSTEM" if self.options.with_brotli: - self._cmake.definitions["ARROW_BROTLI_USE_SHARED"] = self.options["brotli"].shared - self._cmake.definitions["gflags_SOURCE"] = "SYSTEM" + tc.variables["ARROW_BROTLI_USE_SHARED"] = bool(self.options["brotli"].shared) + tc.variables["gflags_SOURCE"] = "SYSTEM" if self._with_gflags(): - self._cmake.definitions["ARROW_BROTLI_USE_SHARED"] = self.options["gflags"].shared - self._cmake.definitions["ARROW_WITH_BZ2"] = self.options.with_bz2 - self._cmake.definitions["BZip2_SOURCE"] = "SYSTEM" + tc.variables["ARROW_GFLAGS_USE_SHARED"] = bool(self.options["gflags"].shared) + tc.variables["ARROW_WITH_BZ2"] = bool(self.options.with_bz2) + tc.variables["BZip2_SOURCE"] = "SYSTEM" if self.options.with_bz2: - self._cmake.definitions["ARROW_BZ2_USE_SHARED"] = self.options["bzip2"].shared - self._cmake.definitions["ARROW_WITH_LZ4"] = self.options.with_lz4 - self._cmake.definitions["Lz4_SOURCE"] = "SYSTEM" + tc.variables["ARROW_BZ2_USE_SHARED"] = bool(self.options["bzip2"].shared) + tc.variables["ARROW_WITH_LZ4"] = bool(self.options.with_lz4) + tc.variables["lz4_SOURCE"] = "SYSTEM" if self.options.with_lz4: - self._cmake.definitions["ARROW_LZ4_USE_SHARED"] = self.options["lz4"].shared - self._cmake.definitions["ARROW_WITH_SNAPPY"] = self.options.with_snappy - self._cmake.definitions["Snappy_SOURCE"] = "SYSTEM" + tc.variables["ARROW_LZ4_USE_SHARED"] = bool(self.options["lz4"].shared) + tc.variables["ARROW_WITH_SNAPPY"] = bool(self.options.with_snappy) + tc.variables["RapidJSON_SOURCE"] = "SYSTEM" + tc.variables["Snappy_SOURCE"] = "SYSTEM" if self.options.with_snappy: - self._cmake.definitions["ARROW_SNAPPY_USE_SHARED"] = self.options["snappy"].shared - self._cmake.definitions["ARROW_WITH_ZLIB"] = self.options.with_zlib - self._cmake.definitions["RE2_SOURCE"] = "SYSTEM" - self._cmake.definitions["ZLIB_SOURCE"] = "SYSTEM" - - self._cmake.definitions["ARROW_WITH_ZSTD"] = self.options.with_zstd - if tools.Version(self.version) >= "2.0": - self._cmake.definitions["zstd_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_SIMD_LEVEL"] = str(self.options.simd_level).upper() - self._cmake.definitions["ARROW_RUNTIME_SIMD_LEVEL"] = str(self.options.runtime_simd_level).upper() + tc.variables["ARROW_SNAPPY_USE_SHARED"] = bool(self.options["snappy"].shared) + tc.variables["ARROW_WITH_ZLIB"] = bool(self.options.with_zlib) + tc.variables["RE2_SOURCE"] = "SYSTEM" + tc.variables["ZLIB_SOURCE"] = "SYSTEM" + tc.variables["xsimd_SOURCE"] = "SYSTEM" + tc.variables["ARROW_WITH_ZSTD"] = bool(self.options.with_zstd) + if Version(self.version) >= "2.0": + tc.variables["zstd_SOURCE"] = "SYSTEM" + tc.variables["ARROW_SIMD_LEVEL"] = str(self.options.simd_level).upper() + tc.variables["ARROW_RUNTIME_SIMD_LEVEL"] = str(self.options.runtime_simd_level).upper() else: - self._cmake.definitions["ZSTD_SOURCE"] = "SYSTEM" + tc.variables["ZSTD_SOURCE"] = "SYSTEM" if self.options.with_zstd: - self._cmake.definitions["ARROW_ZSTD_USE_SHARED"] = self.options["zstd"].shared - self._cmake.definitions["ORC_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_WITH_THRIFT"] = self._with_thrift() - self._cmake.definitions["Thrift_SOURCE"] = "SYSTEM" + tc.variables["ARROW_ZSTD_USE_SHARED"] = bool(self.options["zstd"].shared) + tc.variables["ORC_SOURCE"] = "SYSTEM" + tc.variables["ARROW_WITH_THRIFT"] = self._with_thrift() + tc.variables["Thrift_SOURCE"] = "SYSTEM" if self._with_thrift(): - self._cmake.definitions["THRIFT_VERSION"] = self.deps_cpp_info["thrift"].version # a recent thrift does not require boost - self._cmake.definitions["ARROW_THRIFT_USE_SHARED"] = self.options["thrift"].shared - self._cmake.definitions["ARROW_USE_OPENSSL"] = self._with_openssl() + tc.variables["THRIFT_VERSION"] = bool(self.deps_cpp_info["thrift"].version) # a recent thrift does not require boost + tc.variables["ARROW_THRIFT_USE_SHARED"] = bool(self.options["thrift"].shared) + tc.variables["ARROW_USE_OPENSSL"] = self._with_openssl() if self._with_openssl(): - self._cmake.definitions["OPENSSL_ROOT_DIR"] = self.deps_cpp_info["openssl"].rootpath.replace("\\", "/") - self._cmake.definitions["ARROW_OPENSSL_USE_SHARED"] = self.options["openssl"].shared + tc.variables["OPENSSL_ROOT_DIR"] = self.deps_cpp_info["openssl"].rootpath.replace("\\", "/") + tc.variables["ARROW_OPENSSL_USE_SHARED"] = bool(self.options["openssl"].shared) if self._with_boost(): - self._cmake.definitions["ARROW_BOOST_USE_SHARED"] = self.options["boost"].shared - self._cmake.definitions["ARROW_S3"] = self.options.with_s3 - self._cmake.definitions["AWSSDK_SOURCE"] = "SYSTEM" - - self._cmake.definitions["ARROW_BUILD_UTILITIES"] = self.options.cli - self._cmake.definitions["ARROW_BUILD_INTEGRATION"] = False - self._cmake.definitions["ARROW_INSTALL_NAME_RPATH"] = False - self._cmake.definitions["ARROW_BUILD_EXAMPLES"] = False - self._cmake.definitions["ARROW_BUILD_TESTS"] = False - self._cmake.definitions["ARROW_ENABLE_TIMING_TESTS"] = False - self._cmake.definitions["ARROW_BUILD_BENCHMARKS"] = False - self._cmake.definitions["LLVM_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_WITH_UTF8PROC"] = self._with_utf8proc() - self._cmake.definitions["utf8proc_SOURCE"] = "SYSTEM" + tc.variables["ARROW_BOOST_USE_SHARED"] = bool(self.options["boost"].shared) + tc.variables["ARROW_S3"] = bool(self.options.with_s3) + tc.variables["AWSSDK_SOURCE"] = "SYSTEM" + tc.variables["ARROW_BUILD_UTILITIES"] = bool(self.options.cli) + tc.variables["ARROW_BUILD_INTEGRATION"] = False + tc.variables["ARROW_INSTALL_NAME_RPATH"] = False + tc.variables["ARROW_BUILD_EXAMPLES"] = False + tc.variables["ARROW_BUILD_TESTS"] = False + tc.variables["ARROW_ENABLE_TIMING_TESTS"] = False + tc.variables["ARROW_BUILD_BENCHMARKS"] = False + tc.variables["LLVM_SOURCE"] = "SYSTEM" + tc.variables["ARROW_WITH_UTF8PROC"] = self._with_utf8proc() + tc.variables["ARROW_BOOST_REQUIRED"] = self._with_boost() + tc.variables["utf8proc_SOURCE"] = "SYSTEM" if self._with_utf8proc(): - self._cmake.definitions["ARROW_UTF8PROC_USE_SHARED"] = self.options["utf8proc"].shared - self._cmake.definitions["BUILD_WARNING_LEVEL"] = "PRODUCTION" - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["ARROW_USE_STATIC_CRT"] = "MT" in str(self.settings.compiler.runtime) - + tc.variables["ARROW_UTF8PROC_USE_SHARED"] = bool(self.options["utf8proc"].shared) + tc.variables["BUILD_WARNING_LEVEL"] = "PRODUCTION" + if is_msvc(self): + tc.variables["ARROW_USE_STATIC_CRT"] = "MT" in str(self.settings.compiler.runtime) if self._with_llvm(): - self._cmake.definitions["LLVM_DIR"] = self.deps_cpp_info["llvm-core"].rootpath.replace("\\", "/") - self._cmake.configure() - return self._cmake + tc.variables["LLVM_DIR"] = self.deps_cpp_info["llvm-core"].rootpath.replace("\\", "/") + 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) - if tools.Version(self.version) >= "7.0.0": - for filename in glob.glob(os.path.join(self._source_subfolder, "cpp", "cmake_modules", "Find*.cmake")): + apply_conandata_patches(self) + if Version(self.version) >= "7.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", "FindArrowCUDA.cmake", @@ -476,27 +498,27 @@ def _patch_sources(self): def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake =CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "cpp")) cmake.build() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - self.copy("NOTICE.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="NOTICE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake =CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "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 _lib_name(self, name): - if self.settings.compiler == "Visual Studio" and not self.options.shared: + if is_msvc(self) and not self.options.shared: return "{}_static".format(name) else: return "{}".format(name) def package_id(self): - self.info.options.with_jemalloc = self._with_jemalloc() self.info.options.with_gflags = self._with_gflags() self.info.options.with_protobuf = self._with_protobuf() self.info.options.with_re2 = self._with_re2() @@ -572,9 +594,9 @@ def package_info(self): if self.options.gandiva: # FIXME: only filesystem component is used self.cpp_info.components["libgandiva"].requires.append("boost::boost") - if self._parquet() and self.settings.compiler == "gcc" and self.settings.compiler.version < tools.Version("4.9"): + if self._parquet() and self.settings.compiler == "gcc" and self.settings.compiler.version < Version("4.9"): self.cpp_info.components["libparquet"].requires.append("boost::boost") - if tools.Version(self.version) >= "2.0": + if Version(self.version) >= "2.0": # FIXME: only headers components is used self.cpp_info.components["libarrow"].requires.append("boost::boost") if self._with_openssl(): @@ -585,6 +607,8 @@ def package_info(self): self.cpp_info.components["libarrow"].requires.append("glog::glog") if self._with_jemalloc(): self.cpp_info.components["libarrow"].requires.append("jemalloc::jemalloc") + if self.options.with_mimalloc: + self.cpp_info.components["libarrow"].requires.append("mimalloc::mimalloc") if self._with_re2(): self.cpp_info.components["libgandiva"].requires.append("re2::re2") if self._with_llvm(): @@ -601,7 +625,7 @@ def package_info(self): self.cpp_info.components["libarrow"].requires.append("cuda::cuda") if self.options.with_hiveserver2: self.cpp_info.components["libarrow"].requires.append("hiveserver2::hiveserver2") - if self.options.with_json: + if self._with_rapidjson(): self.cpp_info.components["libarrow"].requires.append("rapidjson::rapidjson") if self.options.with_s3: self.cpp_info.components["libarrow"].requires.append("aws-sdk-cpp::s3") @@ -625,6 +649,9 @@ def package_info(self): self.cpp_info.components["libarrow"].requires.append("zlib::zlib") if self.options.with_zstd: self.cpp_info.components["libarrow"].requires.append("zstd::zstd") + if self._with_boost(): + self.cpp_info.components["libarrow"].requires.append("boost::boost") + if self._with_grpc(): + self.cpp_info.components["libarrow"].requires.append("grpc::grpc") if self._with_flight_rpc(): - self.cpp_info.components["libarrow_flight"].requires.append("grpc::grpc") self.cpp_info.components["libarrow_flight"].requires.append("protobuf::protobuf") diff --git a/recipes/arrow/all/patches/1.0.0-0001-cmake.patch b/recipes/arrow/all/patches/1.0.0-0001-cmake.patch deleted file mode 100644 index c227f1860e305..0000000000000 --- a/recipes/arrow/all/patches/1.0.0-0001-cmake.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- cpp/cmake_modules/DefineOptions.cmake -+++ cpp/cmake_modules/DefineOptions.cmake -@@ -76,7 +76,7 @@ macro(define_option_string name description default) - endmacro() - - # Top level cmake dir --if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") -+if(1) - #---------------------------------------------------------------------- - set_option_category("Compile and link") - ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -854,7 +854,7 @@ if(ARROW_WITH_SNAPPY) - # location. - # https://bugzilla.redhat.com/show_bug.cgi?id=1679727 - # https://src.fedoraproject.org/rpms/snappy/pull-request/1 -- find_package(Snappy QUIET HINTS "${CMAKE_ROOT}/Modules/") -+ find_package(Snappy REQUIRED) - if(NOT Snappy_FOUND) - find_package(SnappyAlt) - endif() -@@ -866,7 +866,7 @@ - elseif(Snappy_SOURCE STREQUAL "SYSTEM") - # SnappyConfig.cmake is not installed on Ubuntu/Debian - # TODO: Make a bug report upstream -- find_package(Snappy HINTS "${CMAKE_ROOT}/Modules/") -+ find_package(Snappy REQUIRED) - if(NOT Snappy_FOUND) - find_package(SnappyAlt REQUIRED) - endif() -@@ -1139,8 +1139,8 @@ - build_gflags() - elseif(gflags_SOURCE STREQUAL "SYSTEM") -- # gflagsConfig.cmake is not installed on Ubuntu/Debian -- # TODO: Make a bug report upstream -- find_package(gflags ${ARROW_GFLAGS_REQUIRED_VERSION}) -+ find_package(gflags REQUIRED) -+ add_library(gflags-shared INTERFACE) -+ target_link_libraries(gflags-shared INTERFACE gflags::gflags) - if(NOT gflags_FOUND) - find_package(gflagsAlt ${ARROW_GFLAGS_REQUIRED_VERSION} REQUIRED) - endif() -@@ -1329,6 +1329,6 @@ macro(build_protobuf) - endmacro() -- - if(ARROW_WITH_PROTOBUF) -+ find_package(Protobuf REQUIRED) - if(ARROW_WITH_GRPC) - # gRPC 1.21.0 or later require Protobuf 3.7.0 or later. - set(ARROW_PROTOBUF_REQUIRED_VERSION "3.7.0") -@@ -1365,9 +1365,9 @@ if(ARROW_WITH_PROTOBUF) - set(ARROW_PROTOBUF_LIBPROTOC arrow::protobuf::libprotoc) - else() - if(NOT TARGET protobuf::libprotoc) -+ set(Protobuf_PROTOC_LIBRARY protoc) - if(PROTOBUF_PROTOC_LIBRARY AND NOT Protobuf_PROTOC_LIBRARY) -- # Old CMake versions have a different casing. -- set(Protobuf_PROTOC_LIBRARY ${PROTOBUF_PROTOC_LIBRARY}) -+ set(Protobuf_PROTOC_LIBRARY protoc) - endif() - if(NOT Protobuf_PROTOC_LIBRARY) - message(FATAL_ERROR "libprotoc was set to ${Protobuf_PROTOC_LIBRARY}") -@@ -1802,7 +1802,7 @@ if(ARROW_WITH_RAPIDJSON) - elseif(RapidJSON_SOURCE STREQUAL "SYSTEM") - # Fedora packages place the package information at the wrong location. - # https://bugzilla.redhat.com/show_bug.cgi?id=1680400 -- find_package(RapidJSON ${ARROW_RAPIDJSON_REQUIRED_VERSION} HINTS "${CMAKE_ROOT}") -+ find_package(RapidJSON REQUIRED) - if(RapidJSON_FOUND) - set(RAPIDJSON_INCLUDE_DIR ${RAPIDJSON_INCLUDE_DIRS}) - else() -@@ -2088,7 +2088,7 @@ if(ARROW_WITH_BZ2) - PROPERTIES IMPORTED_LOCATION "${BZIP2_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") - endif() -- include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}") -+ include_directories(SYSTEM "${BZip2_INCLUDE_DIR}") - endif() - - macro(build_utf8proc) ---- cpp/cmake_modules/SetupCxxFlags.cmake -+++ cpp/cmake_modules/SetupCxxFlags.cmake -@@ -188,7 +188,7 @@ - message(STATUS "Arrow build warning level: ${BUILD_WARNING_LEVEL}") - - macro(arrow_add_werror_if_debug) -- if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") -+ if(0) - # Treat all compiler warnings as errors - if(MSVC) - set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /WX") diff --git a/recipes/arrow/all/patches/1.0.0-0002-jemalloc.patch b/recipes/arrow/all/patches/1.0.0-0002-jemalloc.patch deleted file mode 100644 index 7e8bd1ed08039..0000000000000 --- a/recipes/arrow/all/patches/1.0.0-0002-jemalloc.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1407,6 +1407,6 @@ endif() - # jemalloc - Unix-only high-performance allocator -- - if(ARROW_JEMALLOC) -+if(0) - message(STATUS "Building (vendored) jemalloc from source") - # We only use a vendored jemalloc as we want to control its version. - # Also our build of jemalloc is specially prefixed so that it will not -@@ -1465,6 +1465,8 @@ if(ARROW_JEMALLOC) - add_dependencies(jemalloc::jemalloc jemalloc_ep) - - list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) -+else() -+ find_package(jemalloc REQUIRED) -+endif() - endif() -- - # ---------------------------------------------------------------------- - # mimalloc - Cross-platform high-performance allocator, from Microsoft ---- cpp/src/arrow/CMakeLists.txt -+++ cpp/src/arrow/CMakeLists.txt -@@ -292,7 +292,7 @@ - - set(_allocator_dependencies "") # Empty list - if(ARROW_JEMALLOC) -- list(APPEND _allocator_dependencies jemalloc_ep) -+ list(APPEND _allocator_dependencies jemalloc::jemalloc) - endif() - if(ARROW_MIMALLOC) - list(APPEND _allocator_dependencies mimalloc_ep) ---- cpp/src/arrow/memory_pool.cc -+++ cpp/src/arrow/memory_pool.cc -@@ -31,7 +31,7 @@ - // Needed to support jemalloc 3 and 4 - #define JEMALLOC_MANGLE - // Explicitly link to our version of jemalloc --#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" -+#include "jemalloc/jemalloc.h" - #endif - - #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/1.0.0-0005-fix-make12-namespace.patch b/recipes/arrow/all/patches/1.0.0-0005-fix-make12-namespace.patch new file mode 100644 index 0000000000000..5f0f6f4c52d5c --- /dev/null +++ b/recipes/arrow/all/patches/1.0.0-0005-fix-make12-namespace.patch @@ -0,0 +1,22 @@ +diff --git a/cpp/src/arrow/vendored/datetime/date.h b/cpp/src/arrow/vendored/datetime/date.h +index 02a4909..2b168d2 100644 +--- a/cpp/src/arrow/vendored/datetime/date.h ++++ b/cpp/src/arrow/vendored/datetime/date.h +@@ -5152,7 +5152,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, + if (modified == CharT{}) + #endif + { +- auto h = *fmt == CharT{'I'} ? make12(hms.hours()) : hms.hours(); ++ auto h = *fmt == CharT{'I'} ? arrow_vendored::date::make12(hms.hours()) : hms.hours(); + if (h < hours{10}) + os << CharT{'0'}; + os << h.count(); +@@ -5366,7 +5366,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, + save_ostream _(os); + os.fill('0'); + os.width(2); +- os << make12(tod.hours()).count() << CharT{':'}; ++ os << arrow_vendored::date::make12(tod.hours()).count() << CharT{':'}; + os.width(2); + os << tod.minutes().count() << CharT{':'}; + os.width(2); diff --git a/recipes/arrow/all/patches/1.0.0-0006-fix-cmake.patch b/recipes/arrow/all/patches/1.0.0-0006-fix-cmake.patch new file mode 100644 index 0000000000000..eb6816262214b --- /dev/null +++ b/recipes/arrow/all/patches/1.0.0-0006-fix-cmake.patch @@ -0,0 +1,333 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 300f043..0127a7a 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -654,7 +654,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_LINK_LIBS ${ARROW_BROTLI_LIBS}) + list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) + endif() +@@ -664,7 +664,7 @@ if(ARROW_WITH_BZ2) + endif() + + if(ARROW_WITH_LZ4) +- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) ++ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_static) + endif() + + if(ARROW_WITH_SNAPPY) +@@ -800,8 +800,11 @@ endif() + + if(ARROW_MIMALLOC) + add_definitions(-DARROW_MIMALLOC) +- list(APPEND ARROW_LINK_LIBS mimalloc::mimalloc) +- list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) ++ if (TARGET mimalloc-static) ++ list(APPEND ARROW_LINK_LIBS mimalloc-static) ++ else() ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc) ++ endif() + endif() + + # ---------------------------------------------------------------------- +diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake +index eb10ebe..9c81017 100644 +--- a/cpp/cmake_modules/BuildUtils.cmake ++++ b/cpp/cmake_modules/BuildUtils.cmake +@@ -165,10 +165,10 @@ function(create_merged_static_lib output_target) + set(ar_script_path ${CMAKE_BINARY_DIR}/${ARG_NAME}.ar) + + file(WRITE ${ar_script_path}.in "CREATE ${output_lib_path}\n") +- file(APPEND ${ar_script_path}.in "ADDLIB $\n") ++ file(APPEND ${ar_script_path}.in "ADDLIB $\n") + + foreach(lib ${ARG_TO_MERGE}) +- file(APPEND ${ar_script_path}.in "ADDLIB $\n") ++ file(APPEND ${ar_script_path}.in "ADDLIB $\n") + endforeach() + + file(APPEND ${ar_script_path}.in "SAVE\nEND\n") +diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake +index 807e2b9..016c8db 100644 +--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake +@@ -154,16 +154,7 @@ macro(build_dependency DEPENDENCY_NAME) + endmacro() + + macro(resolve_dependency DEPENDENCY_NAME) +- if(${DEPENDENCY_NAME}_SOURCE STREQUAL "AUTO") +- find_package(${DEPENDENCY_NAME} MODULE) +- if(NOT ${${DEPENDENCY_NAME}_FOUND}) +- build_dependency(${DEPENDENCY_NAME}) +- endif() +- elseif(${DEPENDENCY_NAME}_SOURCE STREQUAL "BUNDLED") +- build_dependency(${DEPENDENCY_NAME}) +- elseif(${DEPENDENCY_NAME}_SOURCE STREQUAL "SYSTEM") +- find_package(${DEPENDENCY_NAME} REQUIRED) +- endif() ++ find_package(${DEPENDENCY_NAME} REQUIRED) + endmacro() + + macro(resolve_dependency_with_version DEPENDENCY_NAME REQUIRED_VERSION) +@@ -765,6 +756,7 @@ endif() + # - Tests need Boost at runtime. + # - S3FS and Flight benchmarks need Boost at runtime. + if(ARROW_BUILD_INTEGRATION ++ OR ARROW_BOOST_REQUIRED + OR ARROW_BUILD_TESTS + OR ARROW_GANDIVA + OR (ARROW_FLIGHT AND ARROW_BUILD_BENCHMARKS) +@@ -785,7 +777,7 @@ if(ARROW_BOOST_REQUIRED) + elseif(BOOST_SOURCE STREQUAL "BUNDLED") + build_boost() + elseif(BOOST_SOURCE STREQUAL "SYSTEM") +- find_package(BoostAlt ${ARROW_BOOST_REQUIRED_VERSION} REQUIRED) ++ find_package(Boost ${ARROW_BOOST_REQUIRED_VERSION} REQUIRED) + endif() + + if(TARGET Boost::system) +@@ -936,11 +928,11 @@ macro(build_brotli) + endmacro() + + if(ARROW_WITH_BROTLI) +- resolve_dependency(Brotli) ++ resolve_dependency(brotli) + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon ++ get_target_property(BROTLI_INCLUDE_DIR brotli::brotlicommon + INTERFACE_INCLUDE_DIRECTORIES) +- include_directories(SYSTEM ${BROTLI_INCLUDE_DIR}) ++ include_directories(SYSTEM ${brotli_INCLUDE_DIR}) + endif() + + if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) +@@ -1146,9 +1138,10 @@ if(ARROW_NEED_GFLAGS) + endif() + endif() + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) ++ include_directories(SYSTEM ${gflags_INCLUDE_DIR}) ++ set(GFLAGS_LIBRARIES ${gflags_LIBRARIES}) + +- if(NOT TARGET ${GFLAGS_LIBRARIES}) ++ if(0) + if(TARGET gflags-shared) + set(GFLAGS_LIBRARIES gflags-shared) + elseif(TARGET gflags_shared) +@@ -1237,12 +1230,13 @@ endmacro() + if(ARROW_WITH_THRIFT) + # We already may have looked for Thrift earlier, when considering whether + # to build Boost, so don't look again if already found. +- if(NOT Thrift_FOUND AND NOT THRIFT_FOUND) ++ if(0) + # Thrift c++ code generated by 0.13 requires 0.11 or greater + resolve_dependency_with_version(Thrift 0.11.0) + endif() ++ find_package(Thrift CONFIG REQUIRED) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) ++ include_directories(SYSTEM ${Thrift_INCLUDE_DIR}) + endif() + + # ---------------------------------------------------------------------- +@@ -1407,6 +1401,7 @@ endif() + # jemalloc - Unix-only high-performance allocator + + if(ARROW_JEMALLOC) ++if(0) + message(STATUS "Building (vendored) jemalloc from source") + # We only use a vendored jemalloc as we want to control its version. + # Also our build of jemalloc is specially prefixed so that it will not +@@ -1465,12 +1460,18 @@ if(ARROW_JEMALLOC) + add_dependencies(jemalloc::jemalloc jemalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) ++else() ++ find_package(jemalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- + # mimalloc - Cross-platform high-performance allocator, from Microsoft + + if(ARROW_MIMALLOC) ++if(0) + message(STATUS "Building (vendored) mimalloc from source") + # We only use a vendored mimalloc as we want to control its build options. + +@@ -1518,6 +1519,11 @@ if(ARROW_MIMALLOC) + add_dependencies(toolchain mimalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) ++else() ++ find_package(mimalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${mimalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${mimalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- +@@ -1918,11 +1924,16 @@ macro(build_lz4) + endmacro() + + if(ARROW_WITH_LZ4) +- resolve_dependency(Lz4) ++ resolve_dependency(lz4) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) +- include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) ++ if(TARGET LZ4::lz4_static) ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) ++ else() ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) ++ endif() ++ include_directories(SYSTEM ${lz4_INCLUDE_DIR}) ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${lz4_LIBRARIES_TARGETS} ) + endif() + + macro(build_zstd) +@@ -2037,10 +2048,10 @@ macro(build_re2) + endmacro() + + if(ARROW_GANDIVA) +- resolve_dependency(RE2) ++ resolve_dependency(re2) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(RE2_INCLUDE_DIR RE2::re2 INTERFACE_INCLUDE_DIRECTORIES) ++ get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${RE2_INCLUDE_DIR}) + endif() + +@@ -2480,17 +2491,24 @@ if(ARROW_WITH_GRPC) + endif() + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(GRPC_INCLUDE_DIR gRPC::grpc INTERFACE_INCLUDE_DIRECTORIES) ++ # get_target_property(GRPC_INCLUDE_DIR gRPC::grpc INTERFACE_INCLUDE_DIRECTORIES) ++ if(grpc_INCLUDE_DIRS_RELEASE) ++ set(GRPC_INCLUDE_DIR ${grpc_INCLUDE_DIRS_RELEASE}) ++ elseif(grpc_INCLUDE_DIRS_DEBUG) ++ set(GRPC_INCLUDE_DIR ${grpc_INCLUDE_DIRS_DEBUG}) ++ endif() + include_directories(SYSTEM ${GRPC_INCLUDE_DIR}) ++ include_directories(SYSTEM ${absl_INCLUDE_DIR}) ++ include_directories(SYSTEM ${protobuf_INCLUDE_DIR}) + + if(GRPC_VENDORED) + set(GRPCPP_PP_INCLUDE TRUE) + else() + # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp + # depending on the gRPC version. +- if(EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") ++ if(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}") +diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt +index 5797a78..da6bd4d 100644 +--- a/cpp/src/arrow/CMakeLists.txt ++++ b/cpp/src/arrow/CMakeLists.txt +@@ -292,10 +292,15 @@ set(ARROW_TESTING_SRCS + + set(_allocator_dependencies "") # Empty list + if(ARROW_JEMALLOC) +- list(APPEND _allocator_dependencies jemalloc_ep) ++ list(APPEND _allocator_dependencies jemalloc::jemalloc) + endif() ++ + if(ARROW_MIMALLOC) +- list(APPEND _allocator_dependencies mimalloc_ep) ++ if (TARGET mimalloc-static) ++ list(APPEND _allocator_dependencies mimalloc-static) ++ else() ++ list(APPEND _allocator_dependencies mimalloc) ++ endif() + endif() + + if(_allocator_dependencies) +diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc +index 784bf7b..8f005a5 100644 +--- a/cpp/src/arrow/memory_pool.cc ++++ b/cpp/src/arrow/memory_pool.cc +@@ -31,7 +31,7 @@ + // Needed to support jemalloc 3 and 4 + #define JEMALLOC_MANGLE + // Explicitly link to our version of jemalloc +-#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" ++#include "jemalloc/jemalloc.h" + #endif + + #ifdef ARROW_MIMALLOC +diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt +index 85e8db6..cd70c63 100644 +--- a/cpp/src/gandiva/CMakeLists.txt ++++ b/cpp/src/gandiva/CMakeLists.txt +@@ -25,7 +25,7 @@ add_custom_target(gandiva-benchmarks) + + add_dependencies(gandiva-all gandiva gandiva-tests gandiva-benchmarks) + +-find_package(LLVMAlt REQUIRED) ++find_package(LLVM REQUIRED) + + if(LLVM_VERSION_MAJOR LESS "10") + set(GANDIVA_CXX_STANDARD ${CMAKE_CXX_STANDARD}) +@@ -88,9 +88,16 @@ set(SRC_FILES + random_generator_holder.cc + ${GANDIVA_PRECOMPILED_CC_PATH}) + +-set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared LLVM::LLVM_INTERFACE RE2::re2) + +-set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_INTERFACE RE2::re2) ++ function(get_all_targets var) ++ set(targets) ++ get_all_targets_recursive(targets ${CMAKE_CURRENT_SOURCE_DIR}) ++ set(${var} ${targets} PARENT_SCOPE) ++endfunction() ++ ++set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared llvm-core::llvm-core re2::re2) ++ ++set(GANDIVA_STATIC_LINK_LIBS arrow_static llvm-core::llvm-core re2::re2) + + if(ARROW_GANDIVA_STATIC_LIBSTDCPP + AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)) +@@ -131,7 +138,7 @@ add_arrow_lib(gandiva + arrow_dependencies + precompiled + EXTRA_INCLUDES +- $ ++ $ + SHARED_LINK_FLAGS + ${GANDIVA_SHARED_LINK_FLAGS} + SHARED_LINK_LIBS +@@ -203,7 +210,7 @@ endfunction() + + set(GANDIVA_INTERNALS_TEST_ARGUMENTS) + if(WIN32) +- list(APPEND GANDIVA_INTERNALS_TEST_ARGUMENTS EXTRA_LINK_LIBS LLVM::LLVM_INTERFACE) ++ list(APPEND GANDIVA_INTERNALS_TEST_ARGUMENTS EXTRA_LINK_LIBS llvm-core::llvm-core) + endif() + add_gandiva_test(internals-test + SOURCES +@@ -225,9 +232,9 @@ add_gandiva_test(internals-test + decimal_type_util_test.cc + random_generator_holder_test.cc + EXTRA_DEPENDENCIES +- LLVM::LLVM_INTERFACE ++ llvm-core::llvm-core + EXTRA_INCLUDES +- $ ++ $ + ${GANDIVA_INTERNALS_TEST_ARGUMENTS}) + + if(ARROW_GANDIVA_JAVA) diff --git a/recipes/arrow/all/patches/2.0.0-0001-cmake.patch b/recipes/arrow/all/patches/2.0.0-0001-cmake.patch deleted file mode 100644 index e275b8cfe872b..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0001-cmake.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- cpp/cmake_modules/DefineOptions.cmake -+++ cpp/cmake_modules/DefineOptions.cmake -@@ -76,7 +76,7 @@ macro(define_option_string name description default) - endmacro() - - # Top level cmake dir --if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") -+if(1) - #---------------------------------------------------------------------- - set_option_category("Compile and link") - ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1856,3 +1856,3 @@ -- find_package(RapidJSON ${ARROW_RAPIDJSON_REQUIRED_VERSION} HINTS "${CMAKE_ROOT}") -+ find_package(RapidJSON ${ARROW_RAPIDJSON_REQUIRED_VERSION} HINTS "${CMAKE_ROOT}" REQUIRED) - if(RapidJSON_FOUND) -- set(RAPIDJSON_INCLUDE_DIR ${RAPIDJSON_INCLUDE_DIRS}) -+ set(RAPIDJSON_INCLUDE_DIR ${RapidJSON_INCLUDE_DIRS}) diff --git a/recipes/arrow/all/patches/2.0.0-0002-jemalloc.patch b/recipes/arrow/all/patches/2.0.0-0002-jemalloc.patch deleted file mode 100644 index 6fd3afbe4a1db..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0002-jemalloc.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1461,6 +1461,6 @@ - # jemalloc - Unix-only high-performance allocator -- - if(ARROW_JEMALLOC) -+if(0) - message(STATUS "Building (vendored) jemalloc from source") - # We only use a vendored jemalloc as we want to control its version. - # Also our build of jemalloc is specially prefixed so that it will not -@@ -1519,6 +1519,8 @@ - add_dependencies(jemalloc::jemalloc jemalloc_ep) - - list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) -+else() -+ find_package(jemalloc REQUIRED) -+endif() - endif() -- - # ---------------------------------------------------------------------- - # mimalloc - Cross-platform high-performance allocator, from Microsoft ---- cpp/src/arrow/CMakeLists.txt -+++ cpp/src/arrow/CMakeLists.txt -@@ -307,7 +307,7 @@ - - set(_allocator_dependencies "") # Empty list - if(ARROW_JEMALLOC) -- list(APPEND _allocator_dependencies jemalloc_ep) -+ list(APPEND _allocator_dependencies jemalloc::jemalloc) - endif() - if(ARROW_MIMALLOC) - list(APPEND _allocator_dependencies mimalloc_ep) ---- cpp/src/arrow/memory_pool.cc -+++ cpp/src/arrow/memory_pool.cc -@@ -31,7 +31,7 @@ - // Needed to support jemalloc 3 and 4 - #define JEMALLOC_MANGLE - // Explicitly link to our version of jemalloc --#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" -+#include "jemalloc/jemalloc.h" - #endif - - #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/2.0.0-0006-gandiva-llvm-re2.patch b/recipes/arrow/all/patches/2.0.0-0006-gandiva-llvm-re2.patch deleted file mode 100644 index 84a3edc7fde19..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0006-gandiva-llvm-re2.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- cpp/CMakeLists.txt -+++ cpp/CMakeLists.txt -@@ -109,7 +109,7 @@ set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support") - set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") - set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}") - --set(ARROW_LLVM_VERSIONS "10" "9" "8" "7") -+set(ARROW_LLVM_VERSIONS "12" "11" "10" "9" "8" "7") - list(GET ARROW_LLVM_VERSIONS 0 ARROW_LLVM_VERSION_PRIMARY) - string(REGEX - REPLACE "^([0-9]+)(\\..+)?" "\\1" ARROW_LLVM_VERSION_PRIMARY_MAJOR - ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -2092,10 +2092,11 @@ macro(build_re2) - endmacro() - - if(ARROW_GANDIVA) -- resolve_dependency(RE2) -+ find_package(re2 REQUIRED) -+ resolve_dependency(re2) - - # TODO: Don't use global includes but rather target_include_directories -- get_target_property(RE2_INCLUDE_DIR RE2::re2 INTERFACE_INCLUDE_DIRECTORIES) -+ get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${RE2_INCLUDE_DIR}) - endif() - ---- cpp/src/gandiva/CMakeLists.txt -+++ cpp/src/gandiva/CMakeLists.txt -@@ -25,8 +25,14 @@ add_custom_target(gandiva-benchmarks) - - add_dependencies(gandiva-all gandiva gandiva-tests gandiva-benchmarks) - -+# Now LLVMAlt is only for finding clang/llvm-link - find_package(LLVMAlt REQUIRED) - -+find_package(llvm-core REQUIRED) -+ -+string(REPLACE "." ";" VERSION_LIST ${llvm-core_VERSION}) -+list(GET VERSION_LIST 0 LLVM_VERSION_MAJOR) -+ - if(LLVM_VERSION_MAJOR LESS "10") - set(GANDIVA_CXX_STANDARD ${CMAKE_CXX_STANDARD}) - else() -@@ -88,9 +94,9 @@ set(SRC_FILES - random_generator_holder.cc - ${GANDIVA_PRECOMPILED_CC_PATH}) - --set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared LLVM::LLVM_INTERFACE RE2::re2) -+set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared llvm-core::llvm-core re2::re2) - --set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_INTERFACE RE2::re2) -+set(GANDIVA_STATIC_LINK_LIBS arrow_static llvm-core::llvm-core re2::re2) - - if(ARROW_GANDIVA_STATIC_LIBSTDCPP - AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)) -@@ -131,7 +137,7 @@ add_arrow_lib(gandiva - arrow_dependencies - precompiled - EXTRA_INCLUDES -- $ -+ $ - SHARED_LINK_FLAGS - ${GANDIVA_SHARED_LINK_FLAGS} - SHARED_LINK_LIBS -@@ -225,9 +231,9 @@ add_gandiva_test(internals-test - decimal_type_util_test.cc - random_generator_holder_test.cc - EXTRA_DEPENDENCIES -- LLVM::LLVM_INTERFACE -+ llvm-core::llvm-core - EXTRA_INCLUDES -- $ -+ $ - ${GANDIVA_INTERNALS_TEST_ARGUMENTS}) - - if(ARROW_GANDIVA_JAVA) diff --git a/recipes/arrow/all/patches/2.0.0-0007-fix-protoc-cmake.patch b/recipes/arrow/all/patches/2.0.0-0007-fix-protoc-cmake.patch deleted file mode 100644 index 2e1c27893d15d..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0007-fix-protoc-cmake.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1452,7 +1452,7 @@ if(ARROW_WITH_PROTOBUF) - message(STATUS "Found protoc: ${PROTOBUF_PROTOC_EXECUTABLE}") - # Protobuf_PROTOC_LIBRARY is set by all versions of FindProtobuf.cmake - message(STATUS "Found libprotoc: ${Protobuf_PROTOC_LIBRARY}") -- get_target_property(PROTOBUF_LIBRARY ${ARROW_PROTOBUF_LIBPROTOBUF} IMPORTED_LOCATION) -+ # get_target_property(PROTOBUF_LIBRARY ${ARROW_PROTOBUF_LIBPROTOBUF} IMPORTED_LOCATION) - message(STATUS "Found libprotobuf: ${PROTOBUF_LIBRARY}") - message(STATUS "Found protobuf headers: ${PROTOBUF_INCLUDE_DIR}") - endif() diff --git a/recipes/arrow/all/patches/2.0.0-0008-fix-cmake.patch b/recipes/arrow/all/patches/2.0.0-0008-fix-cmake.patch new file mode 100644 index 0000000000000..7153d641e0c61 --- /dev/null +++ b/recipes/arrow/all/patches/2.0.0-0008-fix-cmake.patch @@ -0,0 +1,273 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 515e6af..7488161 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -109,7 +109,7 @@ set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support") + set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") + set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}") + +-set(ARROW_LLVM_VERSIONS "10" "9" "8" "7") ++set(ARROW_LLVM_VERSIONS "13" "12" "11" "10" "9" "8" "7") + list(GET ARROW_LLVM_VERSIONS 0 ARROW_LLVM_VERSION_PRIMARY) + string(REGEX + REPLACE "^([0-9]+)(\\..+)?" "\\1" ARROW_LLVM_VERSION_PRIMARY_MAJOR +@@ -667,7 +667,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_LINK_LIBS ${ARROW_BROTLI_LIBS}) + list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) + if(Brotli_SOURCE STREQUAL "SYSTEM") +@@ -683,9 +683,9 @@ if(ARROW_WITH_BZ2) + endif() + + if(ARROW_WITH_LZ4) +- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) ++ list(APPEND ARROW_STATIC_LINK_LIBS lz4::lz4) + if(Lz4_SOURCE STREQUAL "SYSTEM") +- list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) ++ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS lz4::lz4) + endif() + endif() + +@@ -842,8 +842,14 @@ endif() + + if(ARROW_MIMALLOC) + add_definitions(-DARROW_MIMALLOC) +- list(APPEND ARROW_LINK_LIBS mimalloc::mimalloc) +- list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) ++ if (TARGET mimalloc-static) ++ list(APPEND ARROW_LINK_LIBS mimalloc-static) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc-static) ++ else() ++ list(APPEND ARROW_LINK_LIBS mimalloc) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc) ++ endif() ++ + endif() + + # ---------------------------------------------------------------------- +diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake +index cc37a3c..8fe6db9 100644 +--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake +@@ -171,6 +171,7 @@ macro(provide_find_module DEPENDENCY_NAME) + endmacro() + + macro(resolve_dependency DEPENDENCY_NAME) ++if(0) + set(options) + set(one_value_args REQUIRED_VERSION) + cmake_parse_arguments(ARG +@@ -207,6 +208,14 @@ macro(resolve_dependency DEPENDENCY_NAME) + provide_find_module(${DEPENDENCY_NAME}) + list(APPEND ARROW_SYSTEM_DEPENDENCIES ${DEPENDENCY_NAME}) + endif() ++else() ++ if(ARG_REQUIRED_VERSION) ++ find_package(${DEPENDENCY_NAME} ${ARG_REQUIRED_VERSION} REQUIRED) ++ else() ++ find_package(${DEPENDENCY_NAME} REQUIRED) ++ endif() ++ list(APPEND ARROW_SYSTEM_DEPENDENCIES ${DEPENDENCY_NAME}) ++endif() + endmacro() + + # ---------------------------------------------------------------------- +@@ -826,6 +835,7 @@ endif() + # - Tests need Boost at runtime. + # - S3FS and Flight benchmarks need Boost at runtime. + if(ARROW_BUILD_INTEGRATION ++ OR ARROW_BOOST_REQUIRED + OR ARROW_BUILD_TESTS + OR ARROW_GANDIVA + OR (ARROW_FLIGHT AND ARROW_BUILD_BENCHMARKS) +@@ -846,7 +856,7 @@ if(ARROW_BOOST_REQUIRED) + elseif(BOOST_SOURCE STREQUAL "BUNDLED") + build_boost() + elseif(BOOST_SOURCE STREQUAL "SYSTEM") +- find_package(BoostAlt ${ARROW_BOOST_REQUIRED_VERSION} REQUIRED) ++ find_package(Boost ${ARROW_BOOST_REQUIRED_VERSION} REQUIRED) + endif() + + if(TARGET Boost::system) +@@ -973,11 +983,11 @@ macro(build_brotli) + endmacro() + + if(ARROW_WITH_BROTLI) +- resolve_dependency(Brotli) ++ resolve_dependency(brotli) + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon ++ get_target_property(BROTLI_INCLUDE_DIR brotli::brotlicommon + INTERFACE_INCLUDE_DIRECTORIES) +- include_directories(SYSTEM ${BROTLI_INCLUDE_DIR}) ++ include_directories(SYSTEM ${brotli_INCLUDE_DIR}) + endif() + + if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) +@@ -1200,9 +1210,10 @@ if(ARROW_NEED_GFLAGS) + endif() + endif() + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) ++ include_directories(SYSTEM ${gflags_INCLUDE_DIR}) ++ set(GFLAGS_LIBRARIES ${gflags_LIBRARIES}) + +- if(NOT TARGET ${GFLAGS_LIBRARIES}) ++ if(0) + if(TARGET gflags-shared) + set(GFLAGS_LIBRARIES gflags-shared) + elseif(TARGET gflags_shared) +@@ -1291,12 +1302,13 @@ endmacro() + if(ARROW_WITH_THRIFT) + # We already may have looked for Thrift earlier, when considering whether + # to build Boost, so don't look again if already found. +- if(NOT Thrift_FOUND AND NOT THRIFT_FOUND) ++ if(0) + # Thrift c++ code generated by 0.13 requires 0.11 or greater + resolve_dependency(Thrift REQUIRED_VERSION 0.11.0) + endif() ++ find_package(Thrift CONFIG REQUIRED) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) ++ include_directories(SYSTEM ${Thrift_INCLUDE_DIR}) + endif() + + # ---------------------------------------------------------------------- +@@ -1461,6 +1473,7 @@ endif() + # jemalloc - Unix-only high-performance allocator + + if(ARROW_JEMALLOC) ++if(0) + message(STATUS "Building (vendored) jemalloc from source") + # We only use a vendored jemalloc as we want to control its version. + # Also our build of jemalloc is specially prefixed so that it will not +@@ -1519,12 +1532,18 @@ if(ARROW_JEMALLOC) + add_dependencies(jemalloc::jemalloc jemalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) ++else() ++ find_package(jemalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- + # mimalloc - Cross-platform high-performance allocator, from Microsoft + + if(ARROW_MIMALLOC) ++if(0) + message(STATUS "Building (vendored) mimalloc from source") + # We only use a vendored mimalloc as we want to control its build options. + +@@ -1572,6 +1591,11 @@ if(ARROW_MIMALLOC) + add_dependencies(toolchain mimalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) ++else() ++ find_package(mimalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${mimalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${mimalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- +@@ -1971,11 +1995,16 @@ macro(build_lz4) + endmacro() + + if(ARROW_WITH_LZ4) +- resolve_dependency(Lz4) ++ resolve_dependency(lz4) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) +- include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) ++ if(TARGET LZ4::lz4_static) ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) ++ else() ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) ++ endif() ++ include_directories(SYSTEM ${lz4_INCLUDE_DIR}) ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${lz4_LIBRARIES_TARGETS} ) + endif() + + macro(build_zstd) +@@ -2090,10 +2119,10 @@ macro(build_re2) + endmacro() + + if(ARROW_GANDIVA) +- resolve_dependency(RE2) ++ resolve_dependency(re2) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(RE2_INCLUDE_DIR RE2::re2 INTERFACE_INCLUDE_DIRECTORIES) ++ get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${RE2_INCLUDE_DIR}) + endif() + +@@ -2541,17 +2570,24 @@ if(ARROW_WITH_GRPC) + endif() + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(GRPC_INCLUDE_DIR gRPC::grpc INTERFACE_INCLUDE_DIRECTORIES) ++ if(grpc_INCLUDE_DIRS_RELEASE) ++ set(GRPC_INCLUDE_DIR ${grpc_INCLUDE_DIRS_RELEASE}) ++ elseif(grpc_INCLUDE_DIRS_DEBUG) ++ set(GRPC_INCLUDE_DIR ${grpc_INCLUDE_DIRS_DEBUG}) ++ endif() ++ + include_directories(SYSTEM ${GRPC_INCLUDE_DIR}) ++ include_directories(SYSTEM ${absl_INCLUDE_DIR}) ++ include_directories(SYSTEM ${protobuf_INCLUDE_DIR}) + + if(GRPC_VENDORED) + set(GRPCPP_PP_INCLUDE TRUE) + else() + # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp + # depending on the gRPC version. +- if(EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") ++ if(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}") +diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt +index 2751254..842fc9e 100644 +--- a/cpp/src/arrow/CMakeLists.txt ++++ b/cpp/src/arrow/CMakeLists.txt +@@ -307,10 +307,14 @@ set(ARROW_TESTING_SRCS + + set(_allocator_dependencies "") # Empty list + if(ARROW_JEMALLOC) +- list(APPEND _allocator_dependencies jemalloc_ep) ++ list(APPEND _allocator_dependencies jemalloc::jemalloc) + endif() + if(ARROW_MIMALLOC) +- list(APPEND _allocator_dependencies mimalloc_ep) ++ if (TARGET mimalloc-static) ++ list(APPEND _allocator_dependencies mimalloc-static) ++ else() ++ list(APPEND _allocator_dependencies mimalloc) ++ endif() + endif() + + if(_allocator_dependencies) +diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc +index 784bf7b..8f005a5 100644 +--- a/cpp/src/arrow/memory_pool.cc ++++ b/cpp/src/arrow/memory_pool.cc +@@ -31,7 +31,7 @@ + // Needed to support jemalloc 3 and 4 + #define JEMALLOC_MANGLE + // Explicitly link to our version of jemalloc +-#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" ++#include "jemalloc/jemalloc.h" + #endif + + #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/7.0.0-0001-cmake.patch b/recipes/arrow/all/patches/7.0.0-0001-cmake.patch deleted file mode 100644 index 3a476ed4aeddb..0000000000000 --- a/recipes/arrow/all/patches/7.0.0-0001-cmake.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake -index 0a43ec1..c468d48 100644 ---- a/cpp/cmake_modules/DefineOptions.cmake -+++ b/cpp/cmake_modules/DefineOptions.cmake -@@ -82,7 +82,7 @@ macro(define_option_string name description default) - endmacro() - - # Top level cmake dir --if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") -+if(1) - #---------------------------------------------------------------------- - set_option_category("Compile and link") - diff --git a/recipes/arrow/all/patches/7.0.0-0002-jemalloc.patch b/recipes/arrow/all/patches/7.0.0-0002-jemalloc.patch deleted file mode 100644 index 323f5178065e6..0000000000000 --- a/recipes/arrow/all/patches/7.0.0-0002-jemalloc.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt -index b984bc1..84975e2 100644 ---- a/cpp/src/arrow/CMakeLists.txt -+++ b/cpp/src/arrow/CMakeLists.txt -@@ -323,7 +323,7 @@ set(ARROW_TESTING_SRCS - - set(_allocator_dependencies "") # Empty list - if(ARROW_JEMALLOC) -- list(APPEND _allocator_dependencies jemalloc_ep) -+ list(APPEND _allocator_dependencies jemalloc::jemalloc) - endif() - if(ARROW_MIMALLOC) - list(APPEND _allocator_dependencies mimalloc_ep) -diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc -index cf8bf64..cf8966b 100644 ---- a/cpp/src/arrow/memory_pool.cc -+++ b/cpp/src/arrow/memory_pool.cc -@@ -48,7 +48,7 @@ - // Needed to support jemalloc 3 and 4 - #define JEMALLOC_MANGLE - // Explicitly link to our version of jemalloc --#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" -+#include "jemalloc/jemalloc.h" - #endif - - #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/7.0.0-0005-use-find-package.patch b/recipes/arrow/all/patches/7.0.0-0005-use-find-package.patch deleted file mode 100644 index 64cfa3e6d8f47..0000000000000 --- a/recipes/arrow/all/patches/7.0.0-0005-use-find-package.patch +++ /dev/null @@ -1,418 +0,0 @@ -diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt -index 2d7baf1..c2e86e0 100644 ---- a/cpp/CMakeLists.txt -+++ b/cpp/CMakeLists.txt -@@ -715,7 +715,7 @@ if(ARROW_WITH_BZ2) - endif() - - if(ARROW_WITH_LZ4) -- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) -+ list(APPEND ARROW_STATIC_LINK_LIBS lz4::lz4) - if(Lz4_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) - endif() -@@ -901,8 +901,8 @@ endif() - if(ARROW_JEMALLOC) - add_definitions(-DARROW_JEMALLOC) - add_definitions(-DARROW_JEMALLOC_INCLUDE_DIR=${JEMALLOC_INCLUDE_DIR}) -- list(APPEND ARROW_LINK_LIBS jemalloc::jemalloc) -- list(APPEND ARROW_STATIC_LINK_LIBS jemalloc::jemalloc) -+ list(APPEND ARROW_LINK_LIBS jemalloc) -+ list(APPEND ARROW_STATIC_LINK_LIBS jemalloc) - endif() - - if(ARROW_MIMALLOC) -diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake -index bc38952..84fc279 100644 ---- a/cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -953,14 +953,7 @@ else() - endif() - - if(ARROW_BOOST_REQUIRED) -- resolve_dependency(Boost -- HAVE_ALT -- TRUE -- REQUIRED_VERSION -- ${ARROW_BOOST_REQUIRED_VERSION} -- IS_RUNTIME_DEPENDENCY -- # libarrow.so doesn't depend on libboost*. -- FALSE) -+ find_package(Boost CONFIG REQUIRED) - - if(TARGET Boost::system) - set(BOOST_SYSTEM_LIBRARY Boost::system) -@@ -1038,6 +1031,7 @@ macro(build_snappy) - endmacro() - - if(ARROW_WITH_SNAPPY) -+ if(0) - resolve_dependency(Snappy PC_PACKAGE_NAMES snappy) - if(${Snappy_SOURCE} STREQUAL "SYSTEM" AND NOT snappy_PC_FOUND) - get_target_property(SNAPPY_LIB Snappy::snappy IMPORTED_LOCATION) -@@ -1046,6 +1040,8 @@ if(ARROW_WITH_SNAPPY) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(SNAPPY_INCLUDE_DIRS Snappy::snappy INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${SNAPPY_INCLUDE_DIRS}) -+ endif() -+ find_package(Snappy REQUIRED) - endif() - - # ---------------------------------------------------------------------- -@@ -1108,7 +1104,7 @@ macro(build_brotli) - endmacro() - - if(ARROW_WITH_BROTLI) -- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) -+ find_package(Brotli REQUIRED) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon - INTERFACE_INCLUDE_DIRECTORIES) -@@ -1156,6 +1152,15 @@ if(PARQUET_REQUIRE_ENCRYPTION - set(OpenSSL_USE_STATIC_LIBS ON) - set(OPENSSL_USE_STATIC_LIBS ON) - find_package(OpenSSL ${ARROW_OPENSSL_REQUIRED_VERSION} REQUIRED) -+ find_package(OpenSSL REQUIRED CONFIG) -+ message("OPENSSL_FOUND: ${OPENSSL_FOUND}") -+ message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") -+ message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}") -+ message("OPENSSL_CRYPTO_LIBRARIES: ${OPENSSL_CRYPTO_LIBRARIES}") -+ message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}") -+ message("OPENSSL_SSL_LIBRARIES: ${OPENSSL_SSL_LIBRARIES}") -+ message("OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}") -+ message("OPENSSL_VERSION: ${OPENSSL_VERSION}") - endif() - set(ARROW_USE_OPENSSL ON) - endif() -@@ -1228,10 +1233,13 @@ macro(build_glog) - endmacro() - - if(ARROW_USE_GLOG) -+ if(0) - resolve_dependency(GLOG PC_PACKAGE_NAMES libglog) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(GLOG_INCLUDE_DIR glog::glog INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${GLOG_INCLUDE_DIR}) -+ endif() -+ find_package(glog REQUIRED) - endif() - - # ---------------------------------------------------------------------- -@@ -1300,17 +1308,11 @@ macro(build_gflags) - endmacro() - - if(ARROW_NEED_GFLAGS) -- set(ARROW_GFLAGS_REQUIRED_VERSION "2.1.0") -- resolve_dependency(gflags -- HAVE_ALT -- TRUE -- REQUIRED_VERSION -- ${ARROW_GFLAGS_REQUIRED_VERSION} -- IS_RUNTIME_DEPENDENCY -- FALSE) -+ find_package(gflags REQUIRED) - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) - -+if(0) - if(NOT TARGET ${GFLAGS_LIBRARIES}) - if(TARGET gflags-shared) - set(GFLAGS_LIBRARIES gflags-shared) -@@ -1318,6 +1320,10 @@ if(ARROW_NEED_GFLAGS) - set(GFLAGS_LIBRARIES gflags_shared) - endif() - endif() -+else() -+ set(GFLAGS_LIBRARIES gflags::gflags) -+endif() -+ - endif() - - # ---------------------------------------------------------------------- -@@ -1400,6 +1406,7 @@ macro(build_thrift) - endmacro() - - if(ARROW_WITH_THRIFT) -+if (0) - # We already may have looked for Thrift earlier, when considering whether - # to build Boost, so don't look again if already found. - if(NOT Thrift_FOUND) -@@ -1412,6 +1419,9 @@ if(ARROW_WITH_THRIFT) - endif() - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) -+else() -+ find_package(Thrift REQUIRED CONFIG) -+endif() - - string(REPLACE "." ";" VERSION_LIST ${THRIFT_VERSION}) - list(GET VERSION_LIST 0 THRIFT_VERSION_MAJOR) -@@ -1606,7 +1616,7 @@ if(ARROW_JEMALLOC) - # conflict with the default allocator as well as other jemalloc - # installations. - # find_package(jemalloc) -- -+ if (0) - set(ARROW_JEMALLOC_USE_SHARED OFF) - set(JEMALLOC_PREFIX - "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src/jemalloc_ep/dist/") -@@ -1664,6 +1674,9 @@ if(ARROW_JEMALLOC) - "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src") - add_dependencies(jemalloc::jemalloc jemalloc_ep) - -+ endif() -+ find_package(jemalloc REQUIRED) -+ - list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) - endif() - -@@ -1671,6 +1684,8 @@ endif() - # mimalloc - Cross-platform high-performance allocator, from Microsoft - - if(ARROW_MIMALLOC) -+ if (0) -+ - message(STATUS "Building (vendored) mimalloc from source") - # We only use a vendored mimalloc as we want to control its build options. - -@@ -1715,6 +1730,13 @@ if(ARROW_MIMALLOC) - add_dependencies(mimalloc::mimalloc mimalloc_ep) - add_dependencies(toolchain mimalloc_ep) - -+ else() -+ -+ find_package(mimalloc CONFIG REQUIRED) -+ add_dependencies(toolchain mimalloc::mimalloc) -+ -+ endif() -+ - list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) - endif() - -@@ -1999,6 +2021,7 @@ macro(build_rapidjson) - endmacro() - - if(ARROW_WITH_RAPIDJSON) -+if(0) - set(ARROW_RAPIDJSON_REQUIRED_VERSION "1.1.0") - resolve_dependency(RapidJSON - HAVE_ALT -@@ -2011,6 +2034,10 @@ if(ARROW_WITH_RAPIDJSON) - if(RapidJSON_INCLUDE_DIR) - set(RAPIDJSON_INCLUDE_DIR "${RapidJSON_INCLUDE_DIR}") - endif() -+else() -+ find_package(RapidJSON REQUIRED) -+ set(RAPIDJSON_INCLUDE_DIR "${RapidJSON_INCLUDE_DIR}") -+endif() - - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR}) -@@ -2036,10 +2063,21 @@ macro(build_xsimd) - set(XSIMD_VENDORED TRUE) - endmacro() - --if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE" -- )) -+if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE")) -+ -+ if (0) -+ - set(xsimd_SOURCE "BUNDLED") - resolve_dependency(xsimd) -+ -+ else() -+ -+ find_package(xsimd) -+ set(XSIMD_INCLUDE_DIR "${xsimd_INCLUDE_DIR}") -+ add_dependencies(toolchain xsimd) -+ -+ endif() -+ - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${XSIMD_INCLUDE_DIR}) - endif() -@@ -2082,11 +2120,14 @@ macro(build_zlib) - endmacro() - - if(ARROW_WITH_ZLIB) -+ if(0) - resolve_dependency(ZLIB PC_PACKAGE_NAMES zlib) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(ZLIB_INCLUDE_DIR ZLIB::ZLIB INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${ZLIB_INCLUDE_DIR}) -+ endif() -+ find_package(ZLIB REQUIRED) - endif() - - macro(build_lz4) -@@ -2140,11 +2181,14 @@ macro(build_lz4) - endmacro() - - if(ARROW_WITH_LZ4) -+ if(0) - resolve_dependency(Lz4 PC_PACKAGE_NAMES liblz4) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) -+ endif() -+ find_package(lz4 REQUIRED) - endif() - - macro(build_zstd) -@@ -2205,6 +2249,7 @@ macro(build_zstd) - endmacro() - - if(ARROW_WITH_ZSTD) -+ if(0) - # ARROW-13384: ZSTD_minCLevel was added in v1.4.0, required by ARROW-13091 - resolve_dependency(zstd - PC_PACKAGE_NAMES -@@ -2232,6 +2277,8 @@ if(ARROW_WITH_ZSTD) - get_target_property(ZSTD_INCLUDE_DIR ${ARROW_ZSTD_LIBZSTD} - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${ZSTD_INCLUDE_DIR}) -+ endif() -+ find_package(zstd REQUIRED) - endif() - - # ---------------------------------------------------------------------- -@@ -2271,6 +2318,7 @@ macro(build_re2) - endmacro() - - if(ARROW_WITH_RE2) -+ if(0) - # 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. -@@ -2284,6 +2332,8 @@ if(ARROW_WITH_RE2) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${RE2_INCLUDE_DIR}) -+ endif() -+ find_package(re2 REQUIRED) - endif() - - macro(build_bzip2) -@@ -2335,10 +2385,7 @@ macro(build_bzip2) - endmacro() - - if(ARROW_WITH_BZ2) -- resolve_dependency(BZip2) -- if(${BZip2_SOURCE} STREQUAL "SYSTEM") -- string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZIP2_LIBRARIES}") -- endif() -+ find_package(BZip2 REQUIRED) - - if(NOT TARGET BZip2::BZip2) - add_library(BZip2::BZip2 UNKNOWN IMPORTED) -@@ -2390,11 +2437,7 @@ macro(build_utf8proc) - endmacro() - - if(ARROW_WITH_UTF8PROC) -- resolve_dependency(utf8proc -- REQUIRED_VERSION -- "2.2.0" -- PC_PACKAGE_NAMES -- libutf8proc) -+ find_package(utf8proc REQUIRED CONFIG) - - add_definitions(-DARROW_WITH_UTF8PROC) - -@@ -3554,33 +3597,12 @@ if(ARROW_WITH_GRPC) - message(STATUS "Forcing gRPC_SOURCE to Protobuf_SOURCE (${Protobuf_SOURCE})") - set(gRPC_SOURCE "${Protobuf_SOURCE}") - endif() -- resolve_dependency(gRPC -- HAVE_ALT -- TRUE -- REQUIRED_VERSION -- ${ARROW_GRPC_REQUIRED_VERSION} -- PC_PACKAGE_NAMES -- grpc++) -+ find_package(gRPC CONFIG REQUIRED) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(GRPC_INCLUDE_DIR gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${GRPC_INCLUDE_DIR}) - -- if(GRPC_VENDORED) -- set(GRPCPP_PP_INCLUDE TRUE) -- # Examples need to link to static Arrow if we're using static gRPC -- set(ARROW_GRPC_USE_SHARED OFF) -- else() -- # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp -- # depending on the gRPC version. -- if(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") -- set(GRPCPP_PP_INCLUDE FALSE) -- else() -- message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") -- endif() -- endif() - endif() - - # ---------------------------------------------------------------------- -@@ -3770,7 +3792,12 @@ macro(build_google_cloud_cpp_storage) - endmacro() - - if(ARROW_WITH_GOOGLE_CLOUD_CPP) -+if(0) - resolve_dependency(google_cloud_cpp_storage) -+else() -+ find_package(google-cloud-cpp REQUIRED) -+endif() -+ - get_target_property(google_cloud_cpp_storage_INCLUDE_DIR google-cloud-cpp::storage - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${google_cloud_cpp_storage_INCLUDE_DIR}) -@@ -4097,11 +4124,15 @@ macro(build_opentelemetry) - endmacro() - - if(ARROW_WITH_OPENTELEMETRY) -+if(0) - set(opentelemetry-cpp_SOURCE "AUTO") - resolve_dependency(opentelemetry-cpp) - get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::api - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${OPENTELEMETRY_INCLUDE_DIR}) -+else() -+ find_package(opentelemetry-cpp REQUIRED) -+endif() - message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") - endif() - -diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt -index 84975e2..7779c08 100644 ---- a/cpp/src/arrow/CMakeLists.txt -+++ b/cpp/src/arrow/CMakeLists.txt -@@ -575,6 +575,10 @@ foreach(LIB_TARGET ${ARROW_LIBRARIES}) - target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_EXPORTING) - endforeach() - -+if(ARROW_BUILD_SHARED AND WIN32) -+ target_compile_definitions(arrow_shared PRIVATE ARROW_EXPORTING) -+endif() -+ - if(ARROW_WITH_BACKTRACE) - find_package(Backtrace) - -@@ -585,6 +589,7 @@ if(ARROW_WITH_BACKTRACE) - endforeach() - endif() - -+if(0) - if(ARROW_BUILD_BUNDLED_DEPENDENCIES) - arrow_car(_FIRST_LIB ${ARROW_BUNDLED_STATIC_LIBS}) - arrow_cdr(_OTHER_LIBS ${ARROW_BUNDLED_STATIC_LIBS}) -@@ -596,6 +601,7 @@ if(ARROW_BUILD_BUNDLED_DEPENDENCIES) - TO_MERGE - ${_OTHER_LIBS}) - endif() -+endif() - - if(ARROW_TESTING) - # that depend on gtest diff --git a/recipes/arrow/all/patches/7.0.0-0007-fix-cmake.patch b/recipes/arrow/all/patches/7.0.0-0007-fix-cmake.patch new file mode 100644 index 0000000000000..8b4d5d5518dcc --- /dev/null +++ b/recipes/arrow/all/patches/7.0.0-0007-fix-cmake.patch @@ -0,0 +1,347 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 2d7baf1..dff5b1a 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -699,7 +699,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_LINK_LIBS ${ARROW_BROTLI_LIBS}) + list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) + if(Brotli_SOURCE STREQUAL "SYSTEM") +@@ -715,10 +715,17 @@ if(ARROW_WITH_BZ2) + endif() + + if(ARROW_WITH_LZ4) +- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) +- if(Lz4_SOURCE STREQUAL "SYSTEM") +- list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) +- endif() ++ 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_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) +@@ -907,8 +914,13 @@ endif() + + if(ARROW_MIMALLOC) + add_definitions(-DARROW_MIMALLOC) +- list(APPEND ARROW_LINK_LIBS mimalloc::mimalloc) +- list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) ++ if (TARGET mimalloc-static) ++ list(APPEND ARROW_LINK_LIBS mimalloc-static) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc-static) ++ else() ++ list(APPEND ARROW_LINK_LIBS mimalloc) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc) ++ endif() + endif() + + # ---------------------------------------------------------------------- +diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake +index bc38952..62bf314 100644 +--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake +@@ -954,7 +954,7 @@ endif() + + if(ARROW_BOOST_REQUIRED) + resolve_dependency(Boost +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_BOOST_REQUIRED_VERSION} +@@ -965,7 +965,7 @@ if(ARROW_BOOST_REQUIRED) + if(TARGET Boost::system) + set(BOOST_SYSTEM_LIBRARY Boost::system) + set(BOOST_FILESYSTEM_LIBRARY Boost::filesystem) +- elseif(BoostAlt_FOUND) ++ elseif(Boost_FOUND) + set(BOOST_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY}) + set(BOOST_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY}) + else() +@@ -1108,9 +1108,9 @@ macro(build_brotli) + endmacro() + + if(ARROW_WITH_BROTLI) +- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) ++ resolve_dependency(brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon ++ get_target_property(BROTLI_INCLUDE_DIR brotli::brotlicommon + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${BROTLI_INCLUDE_DIR}) + endif() +@@ -1302,22 +1302,17 @@ 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) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) ++ include_directories(SYSTEM ${gflags_INCLUDE_DIR}) + +- if(NOT TARGET ${GFLAGS_LIBRARIES}) +- if(TARGET gflags-shared) +- set(GFLAGS_LIBRARIES gflags-shared) +- elseif(TARGET gflags_shared) +- set(GFLAGS_LIBRARIES gflags_shared) +- endif() +- endif() ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${gflags_LIBRARIES_TARGETS}) ++ set(GFLAGS_LIBRARIES gflags::gflags) + endif() + + # ---------------------------------------------------------------------- +@@ -1411,9 +1406,9 @@ if(ARROW_WITH_THRIFT) + thrift) + endif() + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) ++ include_directories(SYSTEM ${Thrift_INCLUDE_DIR}) + +- string(REPLACE "." ";" VERSION_LIST ${THRIFT_VERSION}) ++ string(REPLACE "." ";" VERSION_LIST ${Thrift_VERSION}) + list(GET VERSION_LIST 0 THRIFT_VERSION_MAJOR) + list(GET VERSION_LIST 1 THRIFT_VERSION_MINOR) + list(GET VERSION_LIST 2 THRIFT_VERSION_PATCH) +@@ -1528,6 +1523,7 @@ if(ARROW_WITH_PROTOBUF) + set(ARROW_PROTOBUF_REQUIRED_VERSION "2.6.1") + endif() + resolve_dependency(Protobuf ++ USE_CONFIG + REQUIRED_VERSION + ${ARROW_PROTOBUF_REQUIRED_VERSION} + PC_PACKAGE_NAMES +@@ -1538,7 +1534,7 @@ if(ARROW_WITH_PROTOBUF) + endif() + + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR}) ++ include_directories(SYSTEM ${protobuf_INCLUDE_DIR}) + + if(TARGET arrow::protobuf::libprotobuf) + set(ARROW_PROTOBUF_LIBPROTOBUF arrow::protobuf::libprotobuf) +@@ -1547,9 +1543,9 @@ if(ARROW_WITH_PROTOBUF) + if(NOT TARGET protobuf::libprotobuf) + add_library(protobuf::libprotobuf UNKNOWN IMPORTED) + set_target_properties(protobuf::libprotobuf +- PROPERTIES IMPORTED_LOCATION "${PROTOBUF_LIBRARY}" ++ PROPERTIES IMPORTED_LOCATION "${Protobuf_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES +- "${PROTOBUF_INCLUDE_DIR}") ++ "${Protobuf_INCLUDE_DIR}") + endif() + set(ARROW_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) + endif() +@@ -1569,7 +1565,7 @@ if(ARROW_WITH_PROTOBUF) + set_target_properties(protobuf::libprotoc + PROPERTIES IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES +- "${PROTOBUF_INCLUDE_DIR}") ++ "${Protobuf_INCLUDE_DIR}") + endif() + set(ARROW_PROTOBUF_LIBPROTOC protobuf::libprotoc) + endif() +@@ -1600,6 +1596,7 @@ endif() + # jemalloc - Unix-only high-performance allocator + + if(ARROW_JEMALLOC) ++if(0) + message(STATUS "Building (vendored) jemalloc from source") + # We only use a vendored jemalloc as we want to control its version. + # Also our build of jemalloc is specially prefixed so that it will not +@@ -1665,12 +1662,18 @@ if(ARROW_JEMALLOC) + add_dependencies(jemalloc::jemalloc jemalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) ++else() ++ find_package(jemalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS}) ++endif() + endif() + + # ---------------------------------------------------------------------- + # mimalloc - Cross-platform high-performance allocator, from Microsoft + + if(ARROW_MIMALLOC) ++if(0) + message(STATUS "Building (vendored) mimalloc from source") + # We only use a vendored mimalloc as we want to control its build options. + +@@ -1716,6 +1719,11 @@ if(ARROW_MIMALLOC) + add_dependencies(toolchain mimalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) ++else() ++ find_package(mimalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${mimalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${mimalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- +@@ -2001,7 +2009,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} +@@ -2038,10 +2046,9 @@ endmacro() + + if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE" + )) +- set(xsimd_SOURCE "BUNDLED") + resolve_dependency(xsimd) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${XSIMD_INCLUDE_DIR}) ++ include_directories(SYSTEM ${xsimd_INCLUDE_DIR}) + endif() + + macro(build_zlib) +@@ -2140,10 +2147,14 @@ macro(build_lz4) + endmacro() + + if(ARROW_WITH_LZ4) +- resolve_dependency(Lz4 PC_PACKAGE_NAMES liblz4) ++ resolve_dependency(lz4) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) ++ if (TARGET LZ4::lz4_static) ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) ++ else() ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) ++ endif() + include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) + endif() + +@@ -2274,7 +2285,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_LIB re2::re2 IMPORTED_LOCATION) + string(APPEND ARROW_PC_LIBS_PRIVATE " ${RE2_LIB}") +@@ -2337,7 +2348,7 @@ endmacro() + if(ARROW_WITH_BZ2) + resolve_dependency(BZip2) + if(${BZip2_SOURCE} STREQUAL "SYSTEM") +- string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZIP2_LIBRARIES}") ++ string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZip2_LIBRARIES}") + endif() + + if(NOT TARGET BZip2::BZip2) +@@ -2346,7 +2357,7 @@ if(ARROW_WITH_BZ2) + PROPERTIES IMPORTED_LOCATION "${BZIP2_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") + endif() +- include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}") ++ include_directories(SYSTEM "${BZip2_INCLUDE_DIR}") + endif() + + macro(build_utf8proc) +@@ -3555,7 +3566,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} +@@ -3573,9 +3584,9 @@ if(ARROW_WITH_GRPC) + else() + # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp + # depending on the gRPC version. +- if(EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") ++ if(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 ${gPC_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}") +@@ -4097,9 +4108,9 @@ macro(build_opentelemetry) + endmacro() + + if(ARROW_WITH_OPENTELEMETRY) +- set(opentelemetry-cpp_SOURCE "AUTO") ++ set(opentelemetry-cpp_SOURCE "SYSTEM") + resolve_dependency(opentelemetry-cpp) +- get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::api ++ get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::opentelemetry_common + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${OPENTELEMETRY_INCLUDE_DIR}) + message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") +diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt +index b984bc1..2c78cd9 100644 +--- a/cpp/src/arrow/CMakeLists.txt ++++ b/cpp/src/arrow/CMakeLists.txt +@@ -323,10 +323,14 @@ set(ARROW_TESTING_SRCS + + set(_allocator_dependencies "") # Empty list + if(ARROW_JEMALLOC) +- list(APPEND _allocator_dependencies jemalloc_ep) ++ list(APPEND _allocator_dependencies jemalloc::jemalloc) + endif() + if(ARROW_MIMALLOC) +- list(APPEND _allocator_dependencies mimalloc_ep) ++ if (TARGET mimalloc-static) ++ list(APPEND _allocator_dependencies mimalloc-static) ++ else() ++ list(APPEND _allocator_dependencies mimalloc) ++ endif() + endif() + + if(_allocator_dependencies) +diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt +index 2cf8c99..90ebb9a 100644 +--- a/cpp/src/arrow/flight/CMakeLists.txt ++++ b/cpp/src/arrow/flight/CMakeLists.txt +@@ -17,6 +17,9 @@ + + add_custom_target(arrow_flight) + ++# TODO: This is a temporary workaround. absl should be LINKED as TARGET. ++include_directories(SYSTEM ${absl_INCLUDE_DIR}) ++ + arrow_install_all_headers("arrow/flight") + + set(ARROW_FLIGHT_LINK_LIBS gRPC::grpc++ ${ARROW_PROTOBUF_LIBPROTOBUF}) +diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc +index 2dcfb01..0394c01 100644 +--- a/cpp/src/arrow/memory_pool.cc ++++ b/cpp/src/arrow/memory_pool.cc +@@ -48,7 +48,7 @@ + // Needed to support jemalloc 3 and 4 + #define JEMALLOC_MANGLE + // Explicitly link to our version of jemalloc +-#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" ++#include "jemalloc/jemalloc.h" + #endif + + #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/8.0.0-0001-cmake.patch b/recipes/arrow/all/patches/8.0.0-0001-cmake.patch deleted file mode 100644 index 893ddf0b07512..0000000000000 --- a/recipes/arrow/all/patches/8.0.0-0001-cmake.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake -index ab7d2ed..6f1e411 100644 ---- a/cpp/cmake_modules/DefineOptions.cmake -+++ b/cpp/cmake_modules/DefineOptions.cmake -@@ -82,7 +82,7 @@ macro(define_option_string name description default) - endmacro() - - # Top level cmake dir --if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") -+if(1) - #---------------------------------------------------------------------- - set_option_category("Compile and link") - diff --git a/recipes/arrow/all/patches/8.0.0-0002-jemalloc.patch b/recipes/arrow/all/patches/8.0.0-0002-jemalloc.patch deleted file mode 100644 index ebc52531e130d..0000000000000 --- a/recipes/arrow/all/patches/8.0.0-0002-jemalloc.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt -index 690c51a..c518b7d 100644 ---- a/cpp/src/arrow/CMakeLists.txt -+++ b/cpp/src/arrow/CMakeLists.txt -@@ -326,7 +326,7 @@ set(ARROW_TESTING_SRCS - - set(_allocator_dependencies "") # Empty list - if(ARROW_JEMALLOC) -- list(APPEND _allocator_dependencies jemalloc_ep) -+ list(APPEND _allocator_dependencies jemalloc::jemalloc) - endif() - if(ARROW_MIMALLOC) - list(APPEND _allocator_dependencies mimalloc_ep) -diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc -index 2fab6f3..1f8f896 100644 ---- a/cpp/src/arrow/memory_pool.cc -+++ b/cpp/src/arrow/memory_pool.cc -@@ -52,7 +52,7 @@ - // Needed to support jemalloc 3 and 4 - #define JEMALLOC_MANGLE - // Explicitly link to our version of jemalloc --#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" -+#include "jemalloc/jemalloc.h" - #endif - - #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/8.0.0-0004-use-find-package.patch b/recipes/arrow/all/patches/8.0.0-0004-use-find-package.patch deleted file mode 100644 index b270f53d3516e..0000000000000 --- a/recipes/arrow/all/patches/8.0.0-0004-use-find-package.patch +++ /dev/null @@ -1,379 +0,0 @@ -diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt -index aba18c8..bb463d0 100644 ---- a/cpp/CMakeLists.txt -+++ b/cpp/CMakeLists.txt -@@ -721,7 +721,7 @@ if(ARROW_WITH_BZ2) - endif() - - if(ARROW_WITH_LZ4) -- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) -+ list(APPEND ARROW_STATIC_LINK_LIBS lz4::lz4) - if(Lz4_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) - endif() -@@ -907,8 +907,8 @@ endif() - if(ARROW_JEMALLOC) - add_definitions(-DARROW_JEMALLOC) - add_definitions(-DARROW_JEMALLOC_INCLUDE_DIR=${JEMALLOC_INCLUDE_DIR}) -- list(APPEND ARROW_LINK_LIBS jemalloc::jemalloc) -- list(APPEND ARROW_STATIC_LINK_LIBS jemalloc::jemalloc) -+ list(APPEND ARROW_LINK_LIBS jemalloc) -+ list(APPEND ARROW_STATIC_LINK_LIBS jemalloc) - endif() - - if(ARROW_MIMALLOC) -diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake -index f070323..2e2a03b 100644 ---- a/cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -974,6 +974,7 @@ else() - endif() - - if(ARROW_BOOST_REQUIRED) -+if(0) - resolve_dependency(Boost - HAVE_ALT - TRUE -@@ -982,6 +983,9 @@ if(ARROW_BOOST_REQUIRED) - IS_RUNTIME_DEPENDENCY - # libarrow.so doesn't depend on libboost*. - FALSE) -+else() -+ find_package(Boost REQUIRED CONFIG) -+endif() - - if(TARGET Boost::system) - set(BOOST_SYSTEM_LIBRARY Boost::system) -@@ -1059,6 +1063,7 @@ macro(build_snappy) - endmacro() - - if(ARROW_WITH_SNAPPY) -+if(0) - resolve_dependency(Snappy PC_PACKAGE_NAMES snappy) - if(${Snappy_SOURCE} STREQUAL "SYSTEM" AND NOT snappy_PC_FOUND) - get_target_property(SNAPPY_LIB Snappy::snappy IMPORTED_LOCATION) -@@ -1067,6 +1072,9 @@ if(ARROW_WITH_SNAPPY) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(SNAPPY_INCLUDE_DIRS Snappy::snappy INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${SNAPPY_INCLUDE_DIRS}) -+else() -+ find_package(Snappy REQUIRED) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -1129,7 +1137,7 @@ macro(build_brotli) - endmacro() - - if(ARROW_WITH_BROTLI) -- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) -+ find_package(Brotli REQUIRED) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon - INTERFACE_INCLUDE_DIRECTORIES) -@@ -1169,8 +1177,16 @@ if(PARQUET_REQUIRE_ENCRYPTION - set(BUILD_SHARED_LIBS_KEEP ${BUILD_SHARED_LIBS}) - set(BUILD_SHARED_LIBS ON) - -- find_package(OpenSSL ${ARROW_OPENSSL_REQUIRED_VERSION} REQUIRED) -- set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_KEEP}) -+ find_package(OpenSSL REQUIRED CONFIG) -+ message("OPENSSL_FOUND: ${OPENSSL_FOUND}") -+ message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") -+ message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}") -+ message("OPENSSL_CRYPTO_LIBRARIES: ${OPENSSL_CRYPTO_LIBRARIES}") -+ message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}") -+ message("OPENSSL_SSL_LIBRARIES: ${OPENSSL_SSL_LIBRARIES}") -+ message("OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}") -+ message("OPENSSL_VERSION: ${OPENSSL_VERSION}") -+ set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_KEEP}) - unset(BUILD_SHARED_LIBS_KEEP) - else() - # Find static OpenSSL headers and libs -@@ -1249,10 +1265,14 @@ macro(build_glog) - endmacro() - - if(ARROW_USE_GLOG) -+if(0) - resolve_dependency(GLOG PC_PACKAGE_NAMES libglog) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(GLOG_INCLUDE_DIR glog::glog INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${GLOG_INCLUDE_DIR}) -+else() -+ find_package(glog REQUIRED) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -1321,6 +1341,7 @@ macro(build_gflags) - endmacro() - - if(ARROW_NEED_GFLAGS) -+if(0) - set(ARROW_GFLAGS_REQUIRED_VERSION "2.1.0") - resolve_dependency(gflags - HAVE_ALT -@@ -1339,6 +1360,10 @@ if(ARROW_NEED_GFLAGS) - set(GFLAGS_LIBRARIES gflags_shared) - endif() - endif() -+else() -+ find_package(gflags REQUIRED) -+ set(GFLAGS_LIBRARIES gflags::gflags) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -1718,6 +1756,7 @@ if(ARROW_JEMALLOC) - # installations. - # find_package(jemalloc) - -+if(0) - set(ARROW_JEMALLOC_USE_SHARED OFF) - set(JEMALLOC_PREFIX - "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src/jemalloc_ep/dist/") -@@ -1778,6 +1817,9 @@ if(ARROW_JEMALLOC) - INTERFACE_INCLUDE_DIRECTORIES - "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src") - add_dependencies(jemalloc::jemalloc jemalloc_ep) -+else() -+ find_package(jemalloc REQUIRED) -+endif() - - list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) - endif() -@@ -1786,6 +1828,7 @@ endif() - # mimalloc - Cross-platform high-performance allocator, from Microsoft - - if(ARROW_MIMALLOC) -+if(0) - message(STATUS "Building (vendored) mimalloc from source") - # We only use a vendored mimalloc as we want to control its build options. - -@@ -1834,6 +1877,10 @@ if(ARROW_MIMALLOC) - endif() - add_dependencies(mimalloc::mimalloc mimalloc_ep) - add_dependencies(toolchain mimalloc_ep) -+else() -+ find_package(mimalloc REQUIRED CONFIG) -+ add_dependencies(toolchain mimalloc::mimalloc) -+endif() - - list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) - endif() -@@ -2119,6 +2166,7 @@ macro(build_rapidjson) - endmacro() - - if(ARROW_WITH_RAPIDJSON) -+if(0) - set(ARROW_RAPIDJSON_REQUIRED_VERSION "1.1.0") - resolve_dependency(RapidJSON - HAVE_ALT -@@ -2131,6 +2179,10 @@ if(ARROW_WITH_RAPIDJSON) - if(RapidJSON_INCLUDE_DIR) - set(RAPIDJSON_INCLUDE_DIR "${RapidJSON_INCLUDE_DIR}") - endif() -+else() -+ find_package(RapidJSON REQUIRED) -+ set(RAPIDJSON_INCLUDE_DIR "${RapidJSON_INCLUDE_DIR}") -+endif() - - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR}) -@@ -2158,8 +2210,14 @@ endmacro() - - if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE" - )) -+if(0) - set(xsimd_SOURCE "BUNDLED") - resolve_dependency(xsimd) -+else() -+ find_package(xsimd) -+ set(XSIMD_INCLUDE_DIR "${xsimd_INCLUDE_DIR}") -+ add_dependencies(toolchain xsimd) -+endif() - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${XSIMD_INCLUDE_DIR}) - endif() -@@ -2202,11 +2260,15 @@ macro(build_zlib) - endmacro() - - if(ARROW_WITH_ZLIB) -+if(0) - resolve_dependency(ZLIB PC_PACKAGE_NAMES zlib) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(ZLIB_INCLUDE_DIR ZLIB::ZLIB INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${ZLIB_INCLUDE_DIR}) -+else() -+ find_package(ZLIB REQUIRED) -+endif() - endif() - - macro(build_lz4) -@@ -2260,11 +2322,15 @@ macro(build_lz4) - endmacro() - - if(ARROW_WITH_LZ4) -+if(0) - resolve_dependency(Lz4 PC_PACKAGE_NAMES liblz4) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) -+else() -+ find_package(lz4 REQUIRED) -+endif() - endif() - - macro(build_zstd) -@@ -2325,6 +2391,7 @@ macro(build_zstd) - endmacro() - - if(ARROW_WITH_ZSTD) -+if(0) - # ARROW-13384: ZSTD_minCLevel was added in v1.4.0, required by ARROW-13091 - resolve_dependency(zstd - PC_PACKAGE_NAMES -@@ -2352,6 +2419,9 @@ if(ARROW_WITH_ZSTD) - get_target_property(ZSTD_INCLUDE_DIR ${ARROW_ZSTD_LIBZSTD} - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${ZSTD_INCLUDE_DIR}) -+else() -+ find_package(zstd REQUIRED) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -2391,6 +2461,7 @@ macro(build_re2) - endmacro() - - if(ARROW_WITH_RE2) -+if(0) - # 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. -@@ -2411,6 +2482,9 @@ if(ARROW_WITH_RE2) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${RE2_INCLUDE_DIR}) -+else() -+ find_package(re2 REQUIRED) -+endif() - endif() - - macro(build_bzip2) -@@ -2462,6 +2536,7 @@ macro(build_bzip2) - endmacro() - - if(ARROW_WITH_BZ2) -+if(0) - resolve_dependency(BZip2) - if(${BZip2_SOURCE} STREQUAL "SYSTEM") - string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZIP2_LIBRARIES}") -@@ -2474,6 +2549,9 @@ if(ARROW_WITH_BZ2) - INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") - endif() - include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}") -+else() -+ find_package(BZip2 REQUIRED) -+endif() - endif() - - macro(build_utf8proc) -@@ -2517,6 +2595,7 @@ macro(build_utf8proc) - endmacro() - - if(ARROW_WITH_UTF8PROC) -+if(0) - resolve_dependency(utf8proc - REQUIRED_VERSION - "2.2.0" -@@ -2538,6 +2617,10 @@ if(ARROW_WITH_UTF8PROC) - get_target_property(UTF8PROC_INCLUDE_DIR utf8proc::utf8proc - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${UTF8PROC_INCLUDE_DIR}) -+else() -+ find_package(utf8proc REQUIRED CONFIG) -+ add_definitions(-DARROW_WITH_UTF8PROC) -+endif() - endif() - - macro(build_cares) -@@ -3702,6 +3785,7 @@ macro(build_grpc) - endmacro() - - if(ARROW_WITH_GRPC) -+if(0) - set(ARROW_GRPC_REQUIRED_VERSION "1.17.0") - if(NOT Protobuf_SOURCE STREQUAL gRPC_SOURCE) - # ARROW-15495: Protobuf/gRPC must come from the same source -@@ -3735,6 +3819,9 @@ if(ARROW_WITH_GRPC) - message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") - endif() - endif() -+else() -+ find_package(gRPC REQUIRED CONFIG) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -3937,10 +4024,14 @@ macro(build_google_cloud_cpp_storage) - endmacro() - - if(ARROW_WITH_GOOGLE_CLOUD_CPP) -+if(0) - resolve_dependency(google_cloud_cpp_storage) - get_target_property(google_cloud_cpp_storage_INCLUDE_DIR google-cloud-cpp::storage - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${google_cloud_cpp_storage_INCLUDE_DIR}) -+else() -+ find_package(google-cloud-cpp REQUIRED) -+endif() - get_target_property(absl_base_INCLUDE_DIR absl::base INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${absl_base_INCLUDE_DIR}) - message(STATUS "Found google-cloud-cpp::storage headers: ${google_cloud_cpp_storage_INCLUDE_DIR}" -@@ -4261,6 +4352,7 @@ macro(build_opentelemetry) - endmacro() - - if(ARROW_WITH_OPENTELEMETRY) -+if(0) - # cURL is required whether we build from source or use an existing installation - # (OTel's cmake files do not call find_curl for you) - find_curl() -@@ -4269,7 +4361,10 @@ if(ARROW_WITH_OPENTELEMETRY) - get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::api - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${OPENTELEMETRY_INCLUDE_DIR}) -- message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") -+else() -+ find_package(opentelemetry-cpp REQUIRED) -+endif() -+ message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") - endif() - - # ---------------------------------------------------------------------- -diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt -index c518b7d..40b4853 100644 ---- a/cpp/src/arrow/CMakeLists.txt -+++ b/cpp/src/arrow/CMakeLists.txt -@@ -584,6 +584,10 @@ foreach(LIB_TARGET ${ARROW_LIBRARIES}) - target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_EXPORTING) - endforeach() - -+if(ARROW_BUILD_SHARED AND WIN32) -+ target_compile_definitions(arrow_shared PRIVATE ARROW_EXPORTING) -+endif() -+ - if(ARROW_WITH_BACKTRACE) - find_package(Backtrace) - -@@ -594,7 +598,7 @@ if(ARROW_WITH_BACKTRACE) - endforeach() - endif() - --if(ARROW_BUILD_BUNDLED_DEPENDENCIES) -+if(0) - arrow_car(_FIRST_LIB ${ARROW_BUNDLED_STATIC_LIBS}) - arrow_cdr(_OTHER_LIBS ${ARROW_BUNDLED_STATIC_LIBS}) - create_merged_static_lib(arrow_bundled_dependencies diff --git a/recipes/arrow/all/patches/8.0.0-0006-fix-cmake.patch b/recipes/arrow/all/patches/8.0.0-0006-fix-cmake.patch new file mode 100644 index 0000000000000..7125204e0d1f9 --- /dev/null +++ b/recipes/arrow/all/patches/8.0.0-0006-fix-cmake.patch @@ -0,0 +1,425 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index bb463d0..ce2d1df 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -705,7 +705,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_LINK_LIBS ${ARROW_BROTLI_LIBS}) + list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) + if(Brotli_SOURCE STREQUAL "SYSTEM") +@@ -721,11 +721,18 @@ if(ARROW_WITH_BZ2) + endif() + + if(ARROW_WITH_LZ4) +- list(APPEND ARROW_STATIC_LINK_LIBS lz4::lz4) +- if(Lz4_SOURCE STREQUAL "SYSTEM") +- list(APPEND ARROW_STATIC_INSTALL_INTERFACE_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_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::snappy) +@@ -913,8 +920,13 @@ endif() + + if(ARROW_MIMALLOC) + add_definitions(-DARROW_MIMALLOC) +- list(APPEND ARROW_LINK_LIBS mimalloc::mimalloc) +- list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) ++ if (TARGET mimalloc-static) ++ list(APPEND ARROW_LINK_LIBS mimalloc-static) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc-static) ++ else() ++ list(APPEND ARROW_LINK_LIBS mimalloc) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc) ++ endif() + endif() + + # ---------------------------------------------------------------------- +diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake +index f070323..16faf73 100644 +--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake +@@ -959,6 +959,7 @@ endif() + # - Tests need Boost at runtime. + # - S3FS and Flight benchmarks need Boost at runtime. + if(ARROW_BUILD_INTEGRATION ++ OR ARROW_BOOST_REQUIRED + OR ARROW_BUILD_TESTS + OR (ARROW_FLIGHT AND ARROW_BUILD_BENCHMARKS) + OR (ARROW_S3 AND ARROW_BUILD_BENCHMARKS)) +@@ -975,7 +976,7 @@ endif() + + if(ARROW_BOOST_REQUIRED) + resolve_dependency(Boost +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_BOOST_REQUIRED_VERSION} +@@ -986,7 +987,7 @@ if(ARROW_BOOST_REQUIRED) + if(TARGET Boost::system) + set(BOOST_SYSTEM_LIBRARY Boost::system) + set(BOOST_FILESYSTEM_LIBRARY Boost::filesystem) +- elseif(BoostAlt_FOUND) ++ elseif(Boost_FOUND) + set(BOOST_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY}) + set(BOOST_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY}) + else() +@@ -1129,9 +1130,9 @@ macro(build_brotli) + endmacro() + + if(ARROW_WITH_BROTLI) +- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) ++ resolve_dependency(brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon ++ get_target_property(BROTLI_INCLUDE_DIR brotli::brotlicommon + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${BROTLI_INCLUDE_DIR}) + endif() +@@ -1323,22 +1324,16 @@ 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) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) +- +- if(NOT TARGET ${GFLAGS_LIBRARIES}) +- if(TARGET gflags-shared) +- set(GFLAGS_LIBRARIES gflags-shared) +- elseif(TARGET gflags_shared) +- set(GFLAGS_LIBRARIES gflags_shared) +- endif() +- endif() ++ include_directories(SYSTEM ${gflags_INCLUDE_DIR}) ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${gflags_LIBRARIES_TARGETS}) ++ set(GFLAGS_LIBRARIES gflags::gflags) + endif() + + # ---------------------------------------------------------------------- +@@ -1432,9 +1427,9 @@ if(ARROW_WITH_THRIFT) + thrift) + endif() + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) ++ include_directories(SYSTEM ${Thrift_INCLUDE_DIR}) + +- string(REPLACE "." ";" VERSION_LIST ${THRIFT_VERSION}) ++ string(REPLACE "." ";" VERSION_LIST ${Thrift_VERSION}) + list(GET VERSION_LIST 0 THRIFT_VERSION_MAJOR) + list(GET VERSION_LIST 1 THRIFT_VERSION_MINOR) + list(GET VERSION_LIST 2 THRIFT_VERSION_PATCH) +@@ -1557,6 +1552,7 @@ if(ARROW_WITH_PROTOBUF) + set(ARROW_PROTOBUF_REQUIRED_VERSION "2.6.1") + endif() + resolve_dependency(Protobuf ++ USE_CONFIG + REQUIRED_VERSION + ${ARROW_PROTOBUF_REQUIRED_VERSION} + PC_PACKAGE_NAMES +@@ -1567,7 +1563,7 @@ if(ARROW_WITH_PROTOBUF) + endif() + + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR}) ++ include_directories(SYSTEM ${protobuf_INCLUDE_DIR}) + + if(TARGET arrow::protobuf::libprotobuf) + set(ARROW_PROTOBUF_LIBPROTOBUF arrow::protobuf::libprotobuf) +@@ -1576,9 +1572,9 @@ if(ARROW_WITH_PROTOBUF) + if(NOT TARGET protobuf::libprotobuf) + add_library(protobuf::libprotobuf UNKNOWN IMPORTED) + set_target_properties(protobuf::libprotobuf +- PROPERTIES IMPORTED_LOCATION "${PROTOBUF_LIBRARY}" ++ PROPERTIES IMPORTED_LOCATION "${Protobuf_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES +- "${PROTOBUF_INCLUDE_DIR}") ++ "${Protobuf_INCLUDE_DIR}") + endif() + set(ARROW_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) + endif() +@@ -1598,7 +1594,7 @@ if(ARROW_WITH_PROTOBUF) + set_target_properties(protobuf::libprotoc + PROPERTIES IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES +- "${PROTOBUF_INCLUDE_DIR}") ++ "${Protobuf_INCLUDE_DIR}") + endif() + set(ARROW_PROTOBUF_LIBPROTOC protobuf::libprotoc) + endif() +@@ -1690,11 +1686,12 @@ 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) + target_include_directories(substrait PUBLIC ${SUBSTRAIT_INCLUDES}) ++ target_include_directories(substrait PUBLIC ${PROTOBUF_INCLUDE_DIR}) + target_link_libraries(substrait INTERFACE ${ARROW_PROTOBUF_LIBPROTOBUF}) + add_dependencies(substrait substrait_gen) + +@@ -1711,6 +1708,7 @@ endif() + # jemalloc - Unix-only high-performance allocator + + if(ARROW_JEMALLOC) ++if(0) + message(STATUS "Building (vendored) jemalloc from source") + # We only use a vendored jemalloc as we want to control its version. + # Also our build of jemalloc is specially prefixed so that it will not +@@ -1780,12 +1778,18 @@ if(ARROW_JEMALLOC) + add_dependencies(jemalloc::jemalloc jemalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) ++else() ++ find_package(jemalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS}) ++endif() + endif() + + # ---------------------------------------------------------------------- + # mimalloc - Cross-platform high-performance allocator, from Microsoft + + if(ARROW_MIMALLOC) ++if(0) + message(STATUS "Building (vendored) mimalloc from source") + # We only use a vendored mimalloc as we want to control its build options. + +@@ -1836,6 +1840,11 @@ if(ARROW_MIMALLOC) + add_dependencies(toolchain mimalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) ++else() ++ find_package(mimalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${mimalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${mimalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- +@@ -2121,7 +2130,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} +@@ -2158,10 +2167,10 @@ endmacro() + + if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE" + )) +- set(xsimd_SOURCE "BUNDLED") ++ set(xsimd_SOURCE "SYSTEM") + resolve_dependency(xsimd) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${XSIMD_INCLUDE_DIR}) ++ include_directories(SYSTEM ${xsimd_INCLUDE_DIR}) + endif() + + macro(build_zlib) +@@ -2260,10 +2269,14 @@ macro(build_lz4) + endmacro() + + if(ARROW_WITH_LZ4) +- resolve_dependency(Lz4 PC_PACKAGE_NAMES liblz4) ++ resolve_dependency(Lz4) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) ++ if (TARGET LZ4::lz4_static) ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) ++ else() ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) ++ endif() + include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) + endif() + +@@ -2394,7 +2407,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_LIB re2::re2 IMPORTED_LOCATION_${UPPERCASE_BUILD_TYPE}) + if(NOT RE2_LIB) +@@ -2464,7 +2477,7 @@ endmacro() + if(ARROW_WITH_BZ2) + resolve_dependency(BZip2) + if(${BZip2_SOURCE} STREQUAL "SYSTEM") +- string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZIP2_LIBRARIES}") ++ string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZip2_LIBRARIES}") + endif() + + if(NOT TARGET BZip2::BZip2) +@@ -2473,7 +2486,7 @@ if(ARROW_WITH_BZ2) + PROPERTIES IMPORTED_LOCATION "${BZIP2_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") + endif() +- include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}") ++ include_directories(SYSTEM "${BZip2_INCLUDE_DIR}") + endif() + + macro(build_utf8proc) +@@ -3709,7 +3722,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} +@@ -3727,9 +3740,9 @@ if(ARROW_WITH_GRPC) + else() + # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp + # depending on the gRPC version. +- if(EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") ++ if(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}") +@@ -3937,7 +3950,7 @@ macro(build_google_cloud_cpp_storage) + endmacro() + + if(ARROW_WITH_GOOGLE_CLOUD_CPP) +- resolve_dependency(google_cloud_cpp_storage) ++ resolve_dependency(google_cloud_cpp) + get_target_property(google_cloud_cpp_storage_INCLUDE_DIR google-cloud-cpp::storage + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${google_cloud_cpp_storage_INCLUDE_DIR}) +@@ -4264,9 +4277,9 @@ if(ARROW_WITH_OPENTELEMETRY) + # cURL is required whether we build from source or use an existing installation + # (OTel's cmake files do not call find_curl for you) + find_curl() +- set(opentelemetry-cpp_SOURCE "AUTO") ++ set(opentelemetry-cpp_SOURCE "SYSTEM") + resolve_dependency(opentelemetry-cpp) +- get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::api ++ get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::opentelemetry_common + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${OPENTELEMETRY_INCLUDE_DIR}) + message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") +diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt +index 690c51a..752f3b9 100644 +--- a/cpp/src/arrow/CMakeLists.txt ++++ b/cpp/src/arrow/CMakeLists.txt +@@ -326,10 +326,14 @@ set(ARROW_TESTING_SRCS + + set(_allocator_dependencies "") # Empty list + if(ARROW_JEMALLOC) +- list(APPEND _allocator_dependencies jemalloc_ep) ++ list(APPEND _allocator_dependencies jemalloc::jemalloc) + endif() + if(ARROW_MIMALLOC) +- list(APPEND _allocator_dependencies mimalloc_ep) ++ if (TARGET mimalloc-static) ++ list(APPEND _allocator_dependencies mimalloc-static) ++ else() ++ list(APPEND _allocator_dependencies mimalloc) ++ endif() + endif() + + if(_allocator_dependencies) +diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt +index f9d1356..c9bcf79 100644 +--- a/cpp/src/arrow/flight/CMakeLists.txt ++++ b/cpp/src/arrow/flight/CMakeLists.txt +@@ -17,6 +17,9 @@ + + add_custom_target(arrow_flight) + ++# TODO: This is a temporary workaround. absl should be LINKED as TARGET. ++include_directories(SYSTEM ${absl_INCLUDE_DIR}) ++ + arrow_install_all_headers("arrow/flight") + + set(ARROW_FLIGHT_LINK_LIBS gRPC::grpc++ ${ARROW_PROTOBUF_LIBPROTOBUF}) +diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc +index ed1c2d8..37a89da 100644 +--- a/cpp/src/arrow/memory_pool.cc ++++ b/cpp/src/arrow/memory_pool.cc +@@ -52,7 +52,7 @@ + // Needed to support jemalloc 3 and 4 + #define JEMALLOC_MANGLE + // Explicitly link to our version of jemalloc +-#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" ++#include "jemalloc/jemalloc.h" + #endif + + #ifdef ARROW_MIMALLOC +diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt +index 71faf9a..3aabea1 100644 +--- a/cpp/src/gandiva/CMakeLists.txt ++++ b/cpp/src/gandiva/CMakeLists.txt +@@ -25,7 +25,7 @@ add_custom_target(gandiva-benchmarks) + + add_dependencies(gandiva-all gandiva gandiva-tests gandiva-benchmarks) + +-find_package(LLVMAlt REQUIRED) ++find_package(LLVM REQUIRED) + + if(LLVM_VERSION_MAJOR LESS "10") + set(GANDIVA_CXX_STANDARD ${CMAKE_CXX_STANDARD}) +@@ -40,7 +40,7 @@ endif() + + add_definitions(-DGANDIVA_LLVM_VERSION=${LLVM_VERSION_MAJOR}) + +-find_package(OpenSSLAlt REQUIRED) ++find_package(OpenSSL REQUIRED) + + # Set the path where the bitcode file generated, see precompiled/CMakeLists.txt + set(GANDIVA_PRECOMPILED_BC_PATH "${CMAKE_CURRENT_BINARY_DIR}/irhelpers.bc") +@@ -98,10 +98,11 @@ set(SRC_FILES + random_generator_holder.cc + ${GANDIVA_PRECOMPILED_CC_PATH}) + +-set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared LLVM::LLVM_INTERFACE +- ${GANDIVA_OPENSSL_LIBS}) ++set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared llvm-core::llvm-core NTERFACE ++ ${GANDIVA_OPENSSL_LIBS}) ++ ++set(GANDIVA_STATIC_LINK_LIBS arrow_static llvm-core::llvm-core ${GANDIVA_OPENSSL_LIBS}) + +-set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_INTERFACE ${GANDIVA_OPENSSL_LIBS}) + + if(ARROW_GANDIVA_STATIC_LIBSTDCPP AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX + )) +@@ -139,7 +140,7 @@ add_arrow_lib(gandiva + arrow_dependencies + precompiled + EXTRA_INCLUDES +- $ ++ $ + ${GANDIVA_OPENSSL_INCLUDE_DIR} + ${UTF8PROC_INCLUDE_DIR} + SHARED_LINK_FLAGS diff --git a/recipes/arrow/all/test_package/CMakeLists.txt b/recipes/arrow/all/test_package/CMakeLists.txt index f5dd033e0e7e3..f11eeda92dde4 100644 --- a/recipes/arrow/all/test_package/CMakeLists.txt +++ b/recipes/arrow/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.8) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package CXX) find_package(Arrow REQUIRED) diff --git a/recipes/arrow/all/test_package/conanfile.py b/recipes/arrow/all/test_package/conanfile.py index 3da371b660e0a..1111583fea732 100644 --- a/recipes/arrow/all/test_package/conanfile.py +++ b/recipes/arrow/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.cmake import cmake_layout, CMake 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" + 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 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/arrow/all/test_v1_package/CMakeLists.txt b/recipes/arrow/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..00e9abed830ed --- /dev/null +++ b/recipes/arrow/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Arrow REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE arrow::arrow) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_JEMALLOC) diff --git a/recipes/arrow/all/test_v1_package/conanfile.py b/recipes/arrow/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/arrow/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/arsenalgear/all/CMakeLists.txt b/recipes/arsenalgear/all/CMakeLists.txt index 595b8c7314510..3656fbcc9d3a0 100644 --- a/recipes/arsenalgear/all/CMakeLists.txt +++ b/recipes/arsenalgear/all/CMakeLists.txt @@ -1,35 +1,34 @@ cmake_minimum_required(VERSION 3.8) project(arsenalgear LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - include(GNUInstallDirs) -set(arsenalgear_src - source_subfolder/src/operators.cpp - source_subfolder/src/stream.cpp - source_subfolder/src/system.cpp - source_subfolder/src/utils.cpp -) - -set(arsenalgear_inc - source_subfolder/include/constants.hpp - source_subfolder/include/math.hpp - source_subfolder/include/operators.hpp - source_subfolder/include/stream.hpp - source_subfolder/include/system.hpp - source_subfolder/include/utils.hpp -) - add_library(arsenalgear ${arsenalgear_src}) -target_include_directories(arsenalgear PRIVATE "source_subfolder/include") +target_sources(arsenalgear PRIVATE + $<$: + ${ARSENALGEAR_SRC_DIR}/src/operators.cpp + > + ${ARSENALGEAR_SRC_DIR}/src/stream.cpp + ${ARSENALGEAR_SRC_DIR}/src/system.cpp + ${ARSENALGEAR_SRC_DIR}/src/utils.cpp +) +target_include_directories(arsenalgear PRIVATE "${ARSENALGEAR_SRC_DIR}/include") set_target_properties(arsenalgear PROPERTIES PUBLIC_HEADER "${arsenalgear_inc}" WINDOWS_EXPORT_ALL_SYMBOLS ON ) target_compile_features(arsenalgear PUBLIC cxx_std_17) +if(${ARSENALGEAR_VERSION} VERSION_LESS 2.0.0) + find_package(Boost REQUIRED CONFIG) + target_link_libraries(arsenalgear PUBLIC Boost::headers) + + find_package(exprtk CONFIG) + if(${exprtk_FOUND}) + target_link_libraries(arsenalgear PUBLIC exprtk::exprtk) + endif() +endif() + find_library(LIBM m) target_link_libraries(arsenalgear PRIVATE $<$:${LIBM}>) @@ -38,5 +37,9 @@ install( RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/arsenalgear +) + +install( + DIRECTORY ${ARSENALGEAR_SRC_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/arsenalgear ) diff --git a/recipes/arsenalgear/all/conandata.yml b/recipes/arsenalgear/all/conandata.yml index 99ab6ba4966e7..b30bf921ec7e0 100644 --- a/recipes/arsenalgear/all/conandata.yml +++ b/recipes/arsenalgear/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.1": + url: "https://github.com/JustWhit3/arsenalgear-cpp/archive/refs/tags/v2.0.1.tar.gz" + sha256: "d0fa1639abb3c41aa60e596b9d70966281a1206c5527b34a4526f6577c3bac6f" "1.2.2": url: "https://github.com/JustWhit3/arsenalgear-cpp/archive/refs/tags/v1.2.2.tar.gz" sha256: "556155d0be0942bcdd5df02fcda258579915e76b5a70e7220de6ef38c8ca7779" diff --git a/recipes/arsenalgear/all/conanfile.py b/recipes/arsenalgear/all/conanfile.py index 2edad27f8a72e..5a83b05e8d8a5 100644 --- a/recipes/arsenalgear/all/conanfile.py +++ b/recipes/arsenalgear/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import is_msvc -import functools +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -required_conan_version = ">=1.45.0" +import os + +required_conan_version = ">=1.52.0" class ArsenalgearConan(ConanFile): name = "arsenalgear" @@ -21,14 +26,22 @@ class ArsenalgearConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } def export_sources(self): - self.copy("CMakeLists.txt") + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -36,54 +49,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def requirements(self): - self.requires("boost/1.79.0") - if self.settings.os in ["Linux", "Macos"]: - self.requires("exprtk/0.0.1") + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _compiler_required_cpp17(self): - return { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } + def requirements(self): + if Version(self.version) < "2.0.0": + self.requires("boost/1.80.0") + if self.settings.os in ["Linux", "Macos"]: + self.requires("exprtk/0.0.1") def validate(self): - # In 1.2.2, arsenalgear doesn't support Visual Studio. + # arsenalgear doesn't support Visual Studio(yet). if is_msvc(self): - raise ConanInvalidConfiguration("{} doesn't support Visual Studio(yet)".format(self.name)) - - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio(yet)") - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ARSENALGEAR_VERSION"] = str(self.version) + tc.variables["ARSENALGEAR_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/arsenalgear/all/test_package/CMakeLists.txt b/recipes/arsenalgear/all/test_package/CMakeLists.txt index abd25c367aac4..e3d45800d41b0 100644 --- a/recipes/arsenalgear/all/test_package/CMakeLists.txt +++ b/recipes/arsenalgear/all/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(arsenalgear REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} arsenalgear::arsenalgear) +target_link_libraries(${PROJECT_NAME} PRIVATE arsenalgear::arsenalgear) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/arsenalgear/all/test_package/conanfile.py b/recipes/arsenalgear/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/arsenalgear/all/test_package/conanfile.py +++ b/recipes/arsenalgear/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2340ca5c12b92 --- /dev/null +++ b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(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) diff --git a/recipes/arsenalgear/all/test_v1_package/conanfile.py b/recipes/arsenalgear/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/arsenalgear/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/arsenalgear/config.yml b/recipes/arsenalgear/config.yml index af40d9653a378..6d0bf30afb485 100644 --- a/recipes/arsenalgear/config.yml +++ b/recipes/arsenalgear/config.yml @@ -1,3 +1,5 @@ versions: + "2.0.1": + folder: all "1.2.2": folder: all diff --git a/recipes/asio-grpc/all/conandata.yml b/recipes/asio-grpc/all/conandata.yml index f34ff55643aa6..60518d226bd20 100644 --- a/recipes/asio-grpc/all/conandata.yml +++ b/recipes/asio-grpc/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.2.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.2.0.tar.gz" + sha256: "a820e48681bc66834f7e6dbc326e245416f4ef009769f45826b3d09079afad4c" + "2.1.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.1.0.tar.gz" + sha256: "51da699eb442db3ec3af1caae5a29d78733ebbd9d1b781f75abe6ce2802fc7c1" "2.0.0": url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.0.0.tar.gz" sha256: "e36ab4f286dccfd6589b8001d6560e994c753539738680588264c1c0e0a6ce4f" diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index 75de28466abad..7d8cde5489396 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class AsioGrpcConan(ConanFile): @@ -38,10 +42,10 @@ def _compilers_minimum_version(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._min_cppstd) + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: + if Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration(f"{self.name} requires C++{self._min_cppstd}, which your compiler does not support.") else: self.output.warn(f"{self.name} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") @@ -49,38 +53,47 @@ def validate(self): def configure(self): if self.options.use_boost_container == "auto": libcxx = self.settings.compiler.get_safe("libcxx") - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) self.options.use_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++") def requirements(self): - self.requires("grpc/1.47.1") + self.requires("grpc/1.48.0") if self.options.use_boost_container or self.options.backend == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") if self.options.backend == "asio": - self.requires("asio/1.23.0") + self.requires("asio/1.24.0") if self.options.backend == "unifex": self.requires("libunifex/cci.20220430") def package_id(self): - self.info.header_only() + self.info.clear() self.info.options.use_boost_container = self.options.use_boost_container + def layout(self): + cmake_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def package(self): - self.copy(pattern="LICENSE", dst="licenses") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self.options.use_boost_container + tc.generate() + + def build(self): cmake = CMake(self) - cmake.definitions["ASIO_GRPC_USE_BOOST_CONTAINER"] = self.options.use_boost_container cmake.configure() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib", "cmake", "asio-grpc"), "asio-grpc*") + rm(self, "asio-grpc*", os.path.join(self.package_folder, "lib", "cmake", "asio-grpc")) def package_info(self): - self.cpp_info.builddirs = [os.path.join("lib", "cmake", "asio-grpc")] - build_modules = [os.path.join(self.cpp_info.builddirs[0], "AsioGrpcProtobufGenerator.cmake")] + build_modules = [os.path.join("lib", "cmake", "asio-grpc", "AsioGrpcProtobufGenerator.cmake")] self.cpp_info.requires = ["grpc::grpc++_unsecure"] if self.options.backend == "boost": diff --git a/recipes/asio-grpc/all/test_package/CMakeLists.txt b/recipes/asio-grpc/all/test_package/CMakeLists.txt index 24d2c280e32b6..3566d527f1ca9 100644 --- a/recipes/asio-grpc/all/test_package/CMakeLists.txt +++ b/recipes/asio-grpc/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(asio-grpc REQUIRED CONFIG) diff --git a/recipes/asio-grpc/all/test_package/conanfile.py b/recipes/asio-grpc/all/test_package/conanfile.py index 38f4483872d47..d120a992c06a6 100644 --- a/recipes/asio-grpc/all/test_package/conanfile.py +++ b/recipes/asio-grpc/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, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if 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/asio-grpc/all/test_v1_package/CMakeLists.txt b/recipes/asio-grpc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e68b2def0d618 --- /dev/null +++ b/recipes/asio-grpc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.14) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(asio-grpc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE asio-grpc::asio-grpc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + +# See https://github.com/chriskohlhoff/asio/issues/955 +target_compile_definitions(${PROJECT_NAME} + PRIVATE BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC) + +if(${asio-grpc_VERSION} VERSION_GREATER_EQUAL 2) + target_compile_definitions(${PROJECT_NAME} PRIVATE ASIO_GRPC_V2) +endif() + +if(CMAKE_CROSSCOMPILING) + # Assuming protoc plugins needed by `asio_grpc_protobuf_generate` are not + # available when cross compiling + target_compile_definitions(${PROJECT_NAME} PRIVATE CROSSCOMPILING) +else() + asio_grpc_protobuf_generate( + GENERATE_GRPC + TARGET + ${PROJECT_NAME} + OUT_DIR + "${CMAKE_CURRENT_BINARY_DIR}/generated" + PROTOS + "${CMAKE_CURRENT_LIST_DIR}/../test_package/test.proto") +endif() diff --git a/recipes/asio-grpc/all/test_v1_package/conanfile.py b/recipes/asio-grpc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2da76eac8dd35 --- /dev/null +++ b/recipes/asio-grpc/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 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/asio-grpc/config.yml b/recipes/asio-grpc/config.yml index a6ac7221e4d6f..1b1afefa695a0 100644 --- a/recipes/asio-grpc/config.yml +++ b/recipes/asio-grpc/config.yml @@ -1,4 +1,8 @@ versions: + "2.2.0": + folder: all + "2.1.0": + folder: all "2.0.0": folder: all "1.7.0": diff --git a/recipes/assimp/5.x/conanfile.py b/recipes/assimp/5.x/conanfile.py index b306ed9818cf2..0e423ced4847b 100644 --- a/recipes/assimp/5.x/conanfile.py +++ b/recipes/assimp/5.x/conanfile.py @@ -7,7 +7,7 @@ from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.51.2" class AssimpConan(ConanFile): @@ -282,28 +282,3 @@ def package_info(self): stdcpp_library = tools_legacy.stdcpp_library(self) if stdcpp_library: self.cpp_info.system_libs.append(stdcpp_library) - - # FIXME: shouldn't be necessary. - # It's a workaround to support conan v1 generators - self.cpp_info.requires.append("minizip::minizip") - self.cpp_info.requires.append("utfcpp::utfcpp") - if Version(self.version) < "5.1.0": - self.cpp_info.requires.append("irrxml::irrxml") - else: - self.cpp_info.requires.append("pugixml::pugixml") - if self._depends_on_kuba_zip: - self.cpp_info.requires.append("kuba-zip::kuba-zip") - if self._depends_on_poly2tri: - self.cpp_info.requires.append("poly2tri::poly2tri") - if self._depends_on_rapidjson: - self.cpp_info.requires.append("rapidjson::rapidjson") - if self._depends_on_zlib: - self.cpp_info.requires.append("zlib::zlib") - if self._depends_on_draco: - self.cpp_info.requires.append("draco::draco") - if self._depends_on_clipper: - self.cpp_info.requires.append("clipper::clipper") - if self._depends_on_stb: - self.cpp_info.requires.append("stb::stb") - if self._depends_on_openddlparser: - self.cpp_info.requires.append("openddl-parser::openddl-parser") diff --git a/recipes/assimp/5.x/patches/0001-unvendor-deps-5.0.x.patch b/recipes/assimp/5.x/patches/0001-unvendor-deps-5.0.x.patch index 6df76c40d3bc9..1445d96a11b7c 100644 --- a/recipes/assimp/5.x/patches/0001-unvendor-deps-5.0.x.patch +++ b/recipes/assimp/5.x/patches/0001-unvendor-deps-5.0.x.patch @@ -110,7 +110,7 @@ - INCLUDE_DIRECTORIES( "../contrib/rapidjson/include" ) - INCLUDE_DIRECTORIES( "../contrib" ) + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(rapidjson REQUIRED CONFIG) ++ find_package(RapidJSON REQUIRED CONFIG) + endif() ENDIF(HUNTER_ENABLED) @@ -158,7 +158,7 @@ + target_link_libraries(assimp zip::zip) + endif() + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp rapidjson::rapidjson) ++ target_link_libraries(assimp rapidjson) + endif() ENDIF(HUNTER_ENABLED) diff --git a/recipes/assimp/5.x/patches/0003-unvendor-deps-5.1.x.patch b/recipes/assimp/5.x/patches/0003-unvendor-deps-5.1.x.patch index e5355147d8c36..fdd67862ddb24 100644 --- a/recipes/assimp/5.x/patches/0003-unvendor-deps-5.1.x.patch +++ b/recipes/assimp/5.x/patches/0003-unvendor-deps-5.1.x.patch @@ -198,7 +198,7 @@ ELSE() - INCLUDE_DIRECTORIES("../contrib/rapidjson/include") + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(rapidjson REQUIRED CONFIG) ++ find_package(RapidJSON REQUIRED CONFIG) + endif() ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1) option( ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR "Suppress rapidjson warning on MSVC (NOTE: breaks android build)" ON ) @@ -288,7 +288,7 @@ + target_link_libraries(assimp openddlparser::openddlparser) + endif() + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp rapidjson::rapidjson) ++ target_link_libraries(assimp rapidjson) + endif() + if(ASSIMP_BUILD_M3D_IMPORTER OR ASSIMP_BUILD_M3D_EXPORTER OR ASSIMP_BUILD_PBRT_EXPORTER) + target_link_libraries(assimp stb::stb) diff --git a/recipes/assimp/5.x/patches/0004-unvendor-deps-5.1.6.patch b/recipes/assimp/5.x/patches/0004-unvendor-deps-5.1.6.patch index 5e1a3a2bcfaf2..67d2f67fd3661 100644 --- a/recipes/assimp/5.x/patches/0004-unvendor-deps-5.1.6.patch +++ b/recipes/assimp/5.x/patches/0004-unvendor-deps-5.1.6.patch @@ -185,7 +185,7 @@ ELSE() - INCLUDE_DIRECTORIES("../contrib/rapidjson/include") + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(rapidjson REQUIRED CONFIG) ++ find_package(RapidJSON REQUIRED CONFIG) + endif() ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1) option( ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR "Suppress rapidjson warning on MSVC (NOTE: breaks android build)" ON ) @@ -275,7 +275,7 @@ + target_link_libraries(assimp openddlparser::openddlparser) + endif() + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp rapidjson::rapidjson) ++ target_link_libraries(assimp rapidjson) + endif() + if(ASSIMP_BUILD_M3D_IMPORTER OR ASSIMP_BUILD_M3D_EXPORTER OR ASSIMP_BUILD_PBRT_EXPORTER) + target_link_libraries(assimp stb::stb) diff --git a/recipes/assimp/5.x/patches/0006-unvendor-deps-5.2.x.patch b/recipes/assimp/5.x/patches/0006-unvendor-deps-5.2.x.patch index 3fc4c7ba34b08..2a1e7bc39e620 100644 --- a/recipes/assimp/5.x/patches/0006-unvendor-deps-5.2.x.patch +++ b/recipes/assimp/5.x/patches/0006-unvendor-deps-5.2.x.patch @@ -185,7 +185,7 @@ ELSE() - INCLUDE_DIRECTORIES("../contrib/rapidjson/include") + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(rapidjson REQUIRED CONFIG) ++ find_package(RapidJSON REQUIRED CONFIG) + endif() ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1) option( ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR "Suppress rapidjson warning on MSVC (NOTE: breaks android build)" ON ) @@ -275,7 +275,7 @@ + target_link_libraries(assimp openddlparser::openddlparser) + endif() + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp rapidjson::rapidjson) ++ target_link_libraries(assimp rapidjson) + endif() + if(ASSIMP_BUILD_M3D_IMPORTER OR ASSIMP_BUILD_M3D_EXPORTER OR ASSIMP_BUILD_PBRT_EXPORTER) + target_link_libraries(assimp stb::stb) diff --git a/recipes/at-spi2-core/config.yml b/recipes/at-spi2-core/config.yml index e2400052c7bae..75bf09030a311 100644 --- a/recipes/at-spi2-core/config.yml +++ b/recipes/at-spi2-core/config.yml @@ -15,3 +15,5 @@ versions: folder: new "2.45.90": folder: new + "2.46.0": + folder: new diff --git a/recipes/at-spi2-core/new/conandata.yml b/recipes/at-spi2-core/new/conandata.yml index f27c58a670f7b..4ea30e6fd2d79 100644 --- a/recipes/at-spi2-core/new/conandata.yml +++ b/recipes/at-spi2-core/new/conandata.yml @@ -1,4 +1,7 @@ sources: + "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" "2.45.90": url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.45/at-spi2-core-2.45.90.tar.xz" sha256: "e9050ad3c24937548396b2377f2fcdb9321ce2daffad35e7554e8f6ad850ab0d" @@ -6,6 +9,9 @@ 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.46.0": + - base_path: "source_subfolder" + patch_file: "patches/93.patch" "2.45.90": - base_path: "source_subfolder" patch_file: "patches/93.patch" diff --git a/recipes/automake/all/conandata.yml b/recipes/automake/all/conandata.yml index 24df7aa715c72..29d48a6c87604 100644 --- a/recipes/automake/all/conandata.yml +++ b/recipes/automake/all/conandata.yml @@ -16,47 +16,27 @@ 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-0.16.4.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.4.patch" + - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" + - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.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-0.16.4.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.4.patch" + - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" + - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.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-0.16.3.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.3.patch" + - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" + - patch_file: "patches/0004-introduce-automake_perllibdir-0.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-0.16.2.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.2.patch" + - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch" + - patch_file: "patches/0004-introduce-automake_perllibdir-0.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-0.16.1.patch" + - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.1.patch" + - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch" + - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.1.patch" diff --git a/recipes/automake/all/conanfile.py b/recipes/automake/all/conanfile.py index 472f84cf07d88..614f14f92d29c 100644 --- a/recipes/automake/all/conanfile.py +++ b/recipes/automake/all/conanfile.py @@ -1,140 +1,170 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import os +from os import path -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, get, replace_in_file, rmdir, export_conandata_patches +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version + +required_conan_version = ">=1.52" class AutomakeConan(ConanFile): name = "automake" + description = "Automake is a tool for automatically generating Makefile.in files compliant with the GNU Coding Standards." + license = ("GPL-2.0-or-later", "GPL-3.0-or-later") 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." topics = ("conan", "automake", "configure", "build") - 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) - return '{}.{}'.format(major, minor) - @property def _settings_build(self): + # TODO: Remove for Conan v2 return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.win_bash = self._settings_build.os == "Windows" + try: + del self.settings.compiler.libcxx # for plain C projects only + except ValueError: + pass + try: + del self.settings.compiler.cppstd # for plain C projects only + except ValueError: + pass + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("autoconf/2.71") - # automake requires perl-Thread-Queue package - - 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"): - self.build_requires("msys2/cci.latest") + self.requires("m4/1.4.19") def package_id(self): - del self.info.settings.arch - del self.info.settings.compiler - del self.info.settings.build_type + try: + del self.info.settings.arch + except ValueError: + pass + try: + del self.info.settings.compiler + except ValueError: + pass + try: + del self.info.settings.build_type + except ValueError: + pass - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def build_requirements(self): + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") - @property - def _datarootdir(self): - return os.path.join(self.package_folder, "res") + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--datarootdir=${prefix}/res", + ]) + + if is_msvc(self): + build = "{}-{}-{}".format( + "x86_64" if self._settings_build.arch == "x86_64" else "i686", + "pc" if self._settings_build.arch == "x86" else "win64", + "mingw32") + host = "{}-{}-{}".format( + "x86_64" if self.settings.arch == "x86_64" else "i686", + "pc" if self.settings.arch == "x86" else "win64", + "mingw32") + tc.configure_args.append(f"--build={build}") + tc.configure_args.append(f"--host={host}") + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + + ms = VirtualBuildEnv(self) + ms.generate(scope="build") - @property - 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 build(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;") - - def build(self): - self._patch_files() - autotools = self._configure_autotools() + replace_in_file(self, path.join(self.source_folder, "bin", "aclocal.in"), + " $map_traced_defs{$arg1} = $file;", + " $file = `cygpath -u $file`;\n" + " $file =~ s/^\\s+|\\s+$//g;\n" + " $map_traced_defs{$arg1} = $file;") + + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() - 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")) + autotools = Autotools(self) + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) # Need to specify the `DESTDIR` as a Unix path, aware of the subsystem - if self.settings.os == "Windows": - binpath = os.path.join(self.package_folder, "bin") - for filename in os.listdir(binpath): - fullpath = os.path.join(binpath, filename) - if not os.path.isfile(fullpath): - continue - os.rename(fullpath, fullpath + ".exe") + copy(self, "COPYING*", src=self.source_folder, dst=path.join(self.package_folder, "licenses")) + for sub_path in ("info", "man", "doc"): + rmdir(self, path.join(self.package_folder, "res", sub_path)) def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable:: {}".format(bin_path)) + bin_path = path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH environment variable: {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") + dataroot_path = path.join(self.package_folder, "res") + self.output.info(f"Defining AUTOMAKE_DATADIR environment variable: {dataroot_path}") + self.env_info.AUTOMAKE_DATADIR = dataroot_path + self.buildenv_info.define_path("AUTOMAKE_DATADIR", dataroot_path) + + version = Version(self.version) + automake_dataroot_path = path.join(dataroot_path, f"automake-{version.major}.{version.minor}") + self.output.info(f"Defining AUTOMAKE_LIBDIR environment variable: {automake_dataroot_path}") + self.env_info.AUTOMAKE_LIBDIR = automake_dataroot_path + self.buildenv_info.define_path("AUTOMAKE_LIBDIR", automake_dataroot_path) + + self.output.info(f"Defining AUTOMAKE_PERLLIBDIR environment variable: {automake_dataroot_path}") + self.env_info.AUTOMAKE_PERLLIBDIR = automake_dataroot_path + self.buildenv_info.define_path("AUTOMAKE_PERLLIBDIR", automake_dataroot_path) + + aclocal_bin = path.join(bin_path, "aclocal") + self.output.info(f"Defining ACLOCAL environment variable: {aclocal_bin}") + self.env_info.ACLOCAL = aclocal_bin + self.buildenv_info.define_path("ACLOCAL", aclocal_bin) + + automake_bin = path.join(bin_path, "automake") + self.output.info(f"Defining AUTOMAKE environment variable: {automake_bin}") + self.env_info.AUTOMAKE = automake_bin + self.buildenv_info.define_path("AUTOMAKE", automake_bin) + + compile_bin = path.join(automake_dataroot_path, "compile") + self.output.info(f"Define path to `compile` binary in user_info as: {compile_bin}") + self.user_info.compile = compile_bin # FIXME: Conan V2 will use conf_key instead of user_info + compile_conf_key = "user.automake:compile" + self.output.info(f"Defining path to `compile` binary in configuration as `{compile_conf_key}` with value: {compile_bin}") + self.conf_info.define(compile_conf_key, compile_bin) + + ar_lib_bin = path.join(automake_dataroot_path, "ar-lib") + self.output.info(f"Define path to ar_lib binary in user_info as: {ar_lib_bin}") + self.user_info.ar_lib = ar_lib_bin # FIXME: Conan V2 will use conf_key instead of user_info + ar_lib_conf_key = "user.automake:ar-lib" + self.output.info(f"Defining path to ar-lib binary in configuration as `{ar_lib_conf_key}` with value: {ar_lib_bin}") + self.conf_info.define(ar_lib_conf_key, ar_lib_bin) + + install_sh_bin = path.join(automake_dataroot_path, "install-sh") + self.output.info(f"Define path to install_sh binary in user_info as: {install_sh_bin}") + self.user_info.install_sh = install_sh_bin # FIXME: Conan V2 will use conf_key instead of user_info + install_sh_conf_key = "user.automake:install-sh" + self.output.info(f"Defining path to install_sh binary in configuration as `{install_sh_conf_key}` with value: {install_sh_bin}") + self.conf_info.define(install_sh_conf_key, install_sh_bin) diff --git a/recipes/automake/all/test_package/conanfile.py b/recipes/automake/all/test_package/conanfile.py index 8362800620a5a..c23f7e240514c 100644 --- a/recipes/automake/all/test_package/conanfile.py +++ b/recipes/automake/all/test_package/conanfile.py @@ -1,89 +1,57 @@ -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.gnu import Autotools +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path + +required_conan_version = ">=1.50.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!!! + generators = "AutotoolsDeps", "AutotoolsToolchain", "VirtualBuildEnv" test_type = "explicit" @property def _settings_build(self): + # TODO: Remove for Conan v2 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) + def win_bash(self): + return self._settings_build.os == "Windows" - 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 layout(self): + basic_layout(self, src_folder=".") + self.folders.build = "build" + self.folders.generators = "build/conan" - 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_requirements(self): + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") # The conf `tools.microsoft.bash:path` and `tools.microsoft.bash:subsystem` aren't injected for test_package + self.tool_requires(self.tested_reference_str) def build(self): + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + return # autoconf needs a bash if there isn't a bash no need to build + for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + shutil.copy(self.source_path.joinpath(src), self.build_folder) - self._build_scripts() - self._build_autotools() + autotools = Autotools(self) + self.run("autoreconf -fiv", cwd=self.build_path, env="conanbuild") # Workaround for since the method `autoreconf()` will always run from source + autotools.configure(build_script_folder=self.build_path) + autotools.make() def test(self): - if self._system_cc: - if not tools.cross_building(self): - self.run(os.path.join(".", "script_test"), run_environment=True) + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + return # autoconf needs a bash if there isn't a bash no need to build + + if can_run(self): + ext = ".exe" if self.settings.os == "Windows" else "" + test_cmd = unix_path(self, self.build_path.joinpath(f"test_package{ext}")) - if not tools.cross_building(self): - self.run(os.path.join(".", "test_package"), run_environment=True) + self.run(test_cmd, run_environment=True, env="conanbuild") diff --git a/recipes/automake/all/test_package/configure.ac b/recipes/automake/all/test_package/configure.ac index 8a7ae1dc34e7f..3c6beb812917f 100644 --- a/recipes/automake/all/test_package/configure.ac +++ b/recipes/automake/all/test_package/configure.ac @@ -8,10 +8,6 @@ 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 diff --git a/recipes/automake/all/test_package/extra.m4 b/recipes/automake/all/test_package/extra.m4 deleted file mode 100644 index 69c85f5ac945d..0000000000000 --- a/recipes/automake/all/test_package/extra.m4 +++ /dev/null @@ -1,14 +0,0 @@ -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/conanfile.py b/recipes/automake/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a6e3a0c477acd --- /dev/null +++ b/recipes/automake/all/test_v1_package/conanfile.py @@ -0,0 +1,90 @@ +from conan import ConanFile +from conans import AutoToolsBuildEnvironment, 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 = "../test_package/configure.ac", "../test_package/Makefile.am", "../test_package/test_package_1.c", "../test_package/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"].replace("\\", "/")), 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/avahi/all/conanfile.py b/recipes/avahi/all/conanfile.py index 793efa5b83afd..1bb65f4a2da31 100644 --- a/recipes/avahi/all/conanfile.py +++ b/recipes/avahi/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +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 +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.51.0" class AvahiConan(ConanFile): @@ -10,12 +14,11 @@ class AvahiConan(ConanFile): # --enable-compat-libdns_sd means that this recipe provides the mdnsresponder compile interface provides = "mdnsresponder" description = "Avahi - Service Discovery for Linux using mDNS/DNS-SD -- compatible with Bonjour" - topics = ("avahi", "Bonjour", "DNS-SD", "mDNS") + topics = ("bonjour", "dns", "dns-sd", "mdns") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lathiat/avahi" license = "LGPL-2.1-only" settings = "os", "arch", "compiler", "build_type" - generators = "pkg_config" options = { "shared": [True, False], @@ -26,75 +29,70 @@ class AvahiConan(ConanFile): "fPIC": True } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("glib/2.68.3") - self.requires("expat/2.4.1") + self.requires("glib/2.74.0") + self.requires("expat/2.4.9") self.requires("libdaemon/0.14") - self.requires("dbus/1.12.20") + self.requires("dbus/1.15.0") self.requires("gdbm/1.19") self.requires("libevent/2.1.12") def validate(self): - if self.settings.os != "Linux" or tools.cross_building(self): + if self.info.settings.os != "Linux": raise ConanInvalidConfiguration("Only Linux is supported for this package.") def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def _configure_args(self): - yes_no = lambda v: "yes" if v else "no" - return [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--disable-gtk3", - "--disable-mono", - "--disable-python", - "--disable-qt5", - "--disable-monodoc", - "--enable-compat-libdns_sd", - "--with-systemdsystemunitdir={}/lib/systemd/system".format(self.package_folder), - ] - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.configure(configure_dir=self._source_subfolder, args=self._configure_args) - return self._autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-compat-libdns_sd") + tc.configure_args.append("--disable-gtk3") + tc.configure_args.append("--disable-mono") + tc.configure_args.append("--disable-monodoc") + tc.configure_args.append("--disable-python") + tc.configure_args.append("--disable-qt5") + tc.configure_args.append("--with-systemdsystemunitdir=/lib/systemd/system") + tc.generate() + AutotoolsDeps(self).generate() + PkgConfigDeps(self).generate() def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, 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, "run")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "Avahi" - self.cpp_info.names["cmake_find_package_multi"] = "Avahi" - for lib in ("client", "common", "core", "glib", "gobject", "libevent", "compat-libdns_sd"): - avahi_lib = "avahi-{}".format(lib) + avahi_lib = f"avahi-{lib}" self.cpp_info.components[lib].names["cmake_find_package"] = lib self.cpp_info.components[lib].names["cmake_find_package_multi"] = lib self.cpp_info.components[lib].names["pkg_config"] = avahi_lib @@ -111,7 +109,7 @@ def package_info(self): self.cpp_info.components["compat-libdns_sd"].requires = ["client"] for app in ("autoipd", "browse", "daemon", "dnsconfd", "publish", "resolve", "set-host-name"): - avahi_app = "avahi-{}".format(app) + avahi_app = f"avahi-{app}" self.cpp_info.components[app].names["cmake_find_package"] = app self.cpp_info.components[app].names["cmake_find_package_multi"] = app self.cpp_info.components[app].names["pkg_config"] = avahi_app @@ -125,5 +123,5 @@ def package_info(self): self.cpp_info.components["set-host-name"].requires = ["client"] 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/avahi/all/test_package/CMakeLists.txt b/recipes/avahi/all/test_package/CMakeLists.txt index 7f438a48c4ea1..fce015c3405a9 100644 --- a/recipes/avahi/all/test_package/CMakeLists.txt +++ b/recipes/avahi/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 C) find_package(Avahi CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} Avahi::compat-libdns_sd) +target_link_libraries(${PROJECT_NAME} PRIVATE avahi::compat-libdns_sd) diff --git a/recipes/avahi/all/test_package/conanfile.py b/recipes/avahi/all/test_package/conanfile.py index 1bf1c7e26255d..704f712573f0d 100644 --- a/recipes/avahi/all/test_package/conanfile.py +++ b/recipes/avahi/all/test_package/conanfile.py @@ -1,9 +1,20 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake +from conan.tools.layout import cmake_layout + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/avahi/all/test_v1_package/CMakeLists.txt b/recipes/avahi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..abd3bb0df681c --- /dev/null +++ b/recipes/avahi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Avahi CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE avahi::compat-libdns_sd) diff --git a/recipes/avahi/all/test_v1_package/conanfile.py b/recipes/avahi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b6a26067f365d --- /dev/null +++ b/recipes/avahi/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/avcpp/all/CMakeLists.txt b/recipes/avcpp/all/CMakeLists.txt deleted file mode 100644 index fcd2addceeac7..0000000000000 --- a/recipes/avcpp/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -set(AVCPP_NOT_SUBPROJECT ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/avcpp/all/conandata.yml b/recipes/avcpp/all/conandata.yml index af831432579cc..1ba5e69f511c2 100644 --- a/recipes/avcpp/all/conandata.yml +++ b/recipes/avcpp/all/conandata.yml @@ -1,9 +1,17 @@ sources: + "2.1.0": + url: "https://github.com/h4tr3d/avcpp/archive/refs/tags/v2.1.0.tar.gz" + sha256: "8398217dccb9f5b4cbb41e5bf4f73f47b461ed3ba8c3aefdda9f9dd714649855" "cci.20220301": url: "https://github.com/h4tr3d/avcpp/archive/fd4bc4662eb39853de8fcac4a663bebd0eea30b8.tar.gz" sha256: "e48eae2ec154bc69aed16159c8b18c9ffb4925ba672b022e94a3c9b96782a4bf" patches: + "2.1.0": + - patch_file: "patches/2.1.0-fix-ffmpeg.patch" + patch_description: "fix ffmpeg package name and remove ffmpeg from install targets" + patch_type: "conan" "cci.20220301": - - base_path: "source_subfolder" - patch_file: "patches/fix-ffmpeg-package.patch" + - patch_file: "patches/cci.20220301-fix-ffmpeg.patch" + patch_description: "fix ffmpeg package name and remove ffmpeg from install targets" + patch_type: "conan" diff --git a/recipes/avcpp/all/conanfile.py b/recipes/avcpp/all/conanfile.py index ca7902bd79a4f..7585987f38a75 100644 --- a/recipes/avcpp/all/conanfile.py +++ b/recipes/avcpp/all/conanfile.py @@ -1,46 +1,45 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class AvcppConan(ConanFile): name = "avcpp" description = "C++ wrapper for FFmpeg" - topics = ("ffmpeg", "cpp") license = "LGPL-2.1", "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/h4tr3d/avcpp/" + topics = ("ffmpeg", "cpp") settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False], + "fPIC": [True, False], "shared": [True, False], } default_options = { - "fPIC": True, + "fPIC": True, "shared": False, } - generators = "cmake", "cmake_find_package_multi" + @property + def _minimum_cpp_standard(self): + return 17 @property - def _compiler_required_cpp17(self): + def _compilers_minimum_version(self): return { - "Visual Studio": "16", "gcc": "8", "clang": "7", "apple-clang": "12.0", } - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,56 +50,66 @@ def configure(self): del self.options.fPIC def validate(self): - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") - - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("ffmpeg/5.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["AV_ENABLE_SHARED"] = self.options.shared - cmake.definitions["AV_ENABLE_STATIC"] = not self.options.shared - cmake.definitions["AV_BUILD_EXAMPLES"] = False - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["AV_ENABLE_SHARED"] = self.options.shared + tc.variables["AV_ENABLE_STATIC"] = not self.options.shared + tc.variables["AV_BUILD_EXAMPLES"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): target_name = "avcpp" if self.options.shared else "avcpp-static" self.cpp_info.set_property("cmake_file_name", "avcpp") - self.cpp_info.set_property("cmake_target_name", "avcpp::{}".format(target_name)) - - self.cpp_info.filenames["cmake_find_package"] = "avcpp" - self.cpp_info.filenames["cmake_find_package_multi"] = "avcpp" - self.cpp_info.names["cmake_find_package"] = "avcpp" - self.cpp_info.names["cmake_find_package_multi"] = "avcpp" + self.cpp_info.set_property("cmake_target_name", f"avcpp::{target_name}") self.cpp_info.components["AvCpp"].names["cmake_find_package"] = target_name self.cpp_info.components["AvCpp"].names["cmake_find_package_multi"] = target_name - self.cpp_info.components["AvCpp"].set_property("cmake_target_name", "avcpp::{}".format(target_name)) + self.cpp_info.components["AvCpp"].set_property("cmake_target_name", f"avcpp::{target_name}") self.cpp_info.components["AvCpp"].libs = ["avcpp", ] self.cpp_info.components["AvCpp"].requires = ["ffmpeg::ffmpeg", ] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["AvCpp"].system_libs = ["mvec"] + if self.settings.os == "Windows": + self.cpp_info.components["AvCpp"].system_libs = ["mfplat"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "avcpp" + self.cpp_info.filenames["cmake_find_package_multi"] = "avcpp" + self.cpp_info.names["cmake_find_package"] = "avcpp" + self.cpp_info.names["cmake_find_package_multi"] = "avcpp" diff --git a/recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch b/recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch new file mode 100644 index 0000000000000..38c60a601238c --- /dev/null +++ b/recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch @@ -0,0 +1,46 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 95b1a02..0f31197 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,8 +6,6 @@ endif() + + project(AvCpp LANGUAGES CXX VERSION 2.1.0) + +-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) +- + set(FFMPEG_PKG_CONFIG_SUFFIX "" CACHE STRING "This suffix uses for FFmpeg component names searches by pkg-config") + set(AV_ENABLE_STATIC On CACHE BOOL "Enable static library build (On)") + set(AV_ENABLE_SHARED On CACHE BOOL "Enable shared library build (On)") +@@ -28,8 +26,8 @@ set (AVCPP_WARNING_OPTIONS + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads) + +-find_package(FFmpeg +- COMPONENTS AVCODEC AVFORMAT AVUTIL AVDEVICE AVFILTER SWSCALE SWRESAMPLE REQUIRED) ++find_package(ffmpeg ++ COMPONENTS avcodec avformat avutil avdevice avfilter swscale swresample REQUIRED) + + add_subdirectory(src) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 4c58281..bee779f 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -24,7 +24,7 @@ foreach(TARGET ${AV_TARGETS}) + add_library(${TARGET} ${TYPE} ${AV_SOURCES} ${AV_HEADERS}) + + target_compile_options(${TARGET} PRIVATE ${AVCPP_WARNING_OPTIONS}) +- target_link_libraries(${TARGET} PRIVATE Threads::Threads PUBLIC FFmpeg::FFmpeg) ++ target_link_libraries(${TARGET} PRIVATE Threads::Threads PUBLIC ffmpeg::ffmpeg) + target_include_directories(${TARGET} + PUBLIC + $ +@@ -53,7 +53,7 @@ if (AVCPP_NOT_SUBPROJECT) + # APPEND + # FILE ${CMAKE_CURRENT_BINARY_DIR}/avcpp-targets.cmake) + +- install(TARGETS ${AV_TARGETS} FFmpeg ++ install(TARGETS ${AV_TARGETS} + EXPORT avcpp-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/avcpp/all/patches/fix-ffmpeg-package.patch b/recipes/avcpp/all/patches/cci.20220301-fix-ffmpeg.patch similarity index 100% rename from recipes/avcpp/all/patches/fix-ffmpeg-package.patch rename to recipes/avcpp/all/patches/cci.20220301-fix-ffmpeg.patch diff --git a/recipes/avcpp/all/test_package/CMakeLists.txt b/recipes/avcpp/all/test_package/CMakeLists.txt index a52ed1452c0cb..7b07f0b83ed62 100644 --- a/recipes/avcpp/all/test_package/CMakeLists.txt +++ b/recipes/avcpp/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(avcpp CONFIG REQUIRED) +find_package(avcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) if (TARGET avcpp::avcpp) - target_link_libraries(${PROJECT_NAME} avcpp::avcpp) + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp) else() - target_link_libraries(${PROJECT_NAME} avcpp::avcpp-static) + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp-static) endif() target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) diff --git a/recipes/avcpp/all/test_package/conanfile.py b/recipes/avcpp/all/test_package/conanfile.py index 6b551939fbde3..a9fb96656f203 100644 --- a/recipes/avcpp/all/test_package/conanfile.py +++ b/recipes/avcpp/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class TestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/avcpp/all/test_v1_package/CMakeLists.txt b/recipes/avcpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..053bba6e952b4 --- /dev/null +++ b/recipes/avcpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(avcpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +if (TARGET avcpp::avcpp) + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp-static) +endif() +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) diff --git a/recipes/avcpp/all/test_v1_package/conanfile.py b/recipes/avcpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6b551939fbde3 --- /dev/null +++ b/recipes/avcpp/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class TestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/avcpp/config.yml b/recipes/avcpp/config.yml index 372dcda16cf25..deb0eb011c7ea 100644 --- a/recipes/avcpp/config.yml +++ b/recipes/avcpp/config.yml @@ -1,3 +1,5 @@ versions: + "2.1.0": + folder: all "cci.20220301": folder: all diff --git a/recipes/aws-c-auth/all/CMakeLists.txt b/recipes/aws-c-auth/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-auth/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-auth/all/conandata.yml b/recipes/aws-c-auth/all/conandata.yml index 4cdcb1f5bef3d..3f6bee7b4b086 100644 --- a/recipes/aws-c-auth/all/conandata.yml +++ b/recipes/aws-c-auth/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.6.17": + url: "https://github.com/awslabs/aws-c-auth/archive/v0.6.17.tar.gz" + sha256: "b43678ad3a779c9c7fccf8f931c162eaaf4d5d64d2955ac1fcfd32e538545c0f" "0.6.11": url: "https://github.com/awslabs/aws-c-auth/archive/v0.6.11.tar.gz" sha256: "d8a0d373cf8b0ff148a014ae2ba24c51f2e7a598b5b0cf3a6e64482c1cd37f90" diff --git a/recipes/aws-c-auth/all/conanfile.py b/recipes/aws-c-auth/all/conanfile.py index 3f61c0db81b14..98d3c8c463737 100644 --- a/recipes/aws-c-auth/all/conanfile.py +++ b/recipes/aws-c-auth/all/conanfile.py @@ -1,18 +1,19 @@ -from conans import ConanFile, CMake, tools -import os +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -required_conan_version = ">=1.43.0" +import os +required_conan_version = ">=1.47.0" class AwsCAuth(ConanFile): name = "aws-c-auth" description = "C99 library implementation of AWS client-side authentication: standard credentials providers and signing." - topics = ("aws", "amazon", "cloud", "authentication", "credentials", "providers", "signing") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-auth" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "authentication", "credentials", "providers", "signing") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,60 +24,66 @@ class AwsCAuth(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") self.requires("aws-c-cal/0.5.13") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") - if tools.Version(self.version) >= "0.6.5": - self.requires("aws-c-sdkutils/0.1.2") + if Version(self.version) < "0.6.17": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + if Version(self.version) >= "0.6.5": + self.requires("aws-c-sdkutils/0.1.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-auth")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-auth")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-auth") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-auth") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-auth" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-auth" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["aws-c-auth-lib"].names["cmake_find_package"] = "aws-c-auth" self.cpp_info.components["aws-c-auth-lib"].names["cmake_find_package_multi"] = "aws-c-auth" self.cpp_info.components["aws-c-auth-lib"].set_property("cmake_target_name", "AWS::aws-c-auth") @@ -86,7 +93,13 @@ def package_info(self): "aws-c-common::aws-c-common-lib", "aws-c-cal::aws-c-cal-lib", "aws-c-io::aws-c-io-lib", - "aws-c-http::aws-c-http-lib" + "aws-c-http::aws-c-http-lib", ] - if tools.Version(self.version) >= "0.6.5": + if Version(self.version) >= "0.6.5": self.cpp_info.components["aws-c-auth-lib"].requires.append("aws-c-sdkutils::aws-c-sdkutils-lib") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "aws-c-auth" + self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-auth" + self.cpp_info.names["cmake_find_package"] = "AWS" + self.cpp_info.names["cmake_find_package_multi"] = "AWS" diff --git a/recipes/aws-c-auth/all/test_package/CMakeLists.txt b/recipes/aws-c-auth/all/test_package/CMakeLists.txt index 61133ac41d950..d0c587e8dd59d 100644 --- a/recipes/aws-c-auth/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-auth/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-auth REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-auth) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-auth) diff --git a/recipes/aws-c-auth/all/test_package/conanfile.py b/recipes/aws-c-auth/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-auth/all/test_package/conanfile.py +++ b/recipes/aws-c-auth/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-auth/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-auth/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..606180fec87bd --- /dev/null +++ b/recipes/aws-c-auth/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-auth REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-auth) diff --git a/recipes/aws-c-auth/all/test_v1_package/conanfile.py b/recipes/aws-c-auth/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-auth/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/aws-c-auth/config.yml b/recipes/aws-c-auth/config.yml index 17cbddbaa736f..503ab418198f1 100644 --- a/recipes/aws-c-auth/config.yml +++ b/recipes/aws-c-auth/config.yml @@ -1,4 +1,6 @@ versions: + "0.6.17": + folder: all "0.6.11": folder: all "0.6.8": diff --git a/recipes/aws-c-cal/all/CMakeLists.txt b/recipes/aws-c-cal/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-cal/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-cal/all/conandata.yml b/recipes/aws-c-cal/all/conandata.yml index 32f0c310bc263..e1b848e4dfa2d 100644 --- a/recipes/aws-c-cal/all/conandata.yml +++ b/recipes/aws-c-cal/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.5.20": + url: "https://github.com/awslabs/aws-c-cal/archive/v0.5.20.tar.gz" + sha256: "acc352359bd06f8597415c366cf4ec4f00d0b0da92d637039a73323dd55b6cd0" + "0.5.19": + url: "https://github.com/awslabs/aws-c-cal/archive/refs/tags/v0.5.19.tar.gz" + sha256: "23452ab7960c480f1ec0a96ac55bde32d7d27c4a664baeadc248923b19c12086" "0.5.17": url: "https://github.com/awslabs/aws-c-cal/archive/v0.5.17.tar.gz" sha256: "40297da04443d4ee2988d1c5fb0dc4a156d0e4cfaf80e6a1df1867452566d540" @@ -12,9 +18,35 @@ sources: url: "https://github.com/awslabs/aws-c-cal/archive/v0.5.11.tar.gz" sha256: "ef46e121b2231a0b19afce8af4b32d77501df4d470e926990918456636cd83c0" patches: + "0.5.20": + - patch_file: "patches/0002-apple-corefoundation-0.5.13.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" + "0.5.19": + - patch_file: "patches/0002-apple-corefoundation-0.5.13.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" + "0.5.17": + - patch_file: "patches/0002-apple-corefoundation-0.5.13.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" + "0.5.13": + - patch_file: "patches/0002-apple-corefoundation-0.5.13.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" "0.5.12": - - patch_file: "patches/0001-use-openssl-cmake-imported-target.cmake" - base_path: "source_subfolder" + - patch_file: "patches/0001-use-openssl-cmake-imported-target.patch" + - patch_file: "patches/0002-apple-corefoundation-0.5.11.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" "0.5.11": - - patch_file: "patches/0001-use-openssl-cmake-imported-target.cmake" - base_path: "source_subfolder" + - patch_file: "patches/0001-use-openssl-cmake-imported-target.patch" + - patch_file: "patches/0002-apple-corefoundation-0.5.11.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" diff --git a/recipes/aws-c-cal/all/conanfile.py b/recipes/aws-c-cal/all/conanfile.py index 363b562fb03ab..1316e6e52c194 100644 --- a/recipes/aws-c-cal/all/conanfile.py +++ b/recipes/aws-c-cal/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.3" class AwsCCal(ConanFile): @@ -21,22 +25,13 @@ class AwsCCal(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _needs_openssl(self): - return self.settings.os != "Windows" and not tools.is_apple_os(self.settings.os) + return self.settings.os != "Windows" and not is_apple_os(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"]) + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -45,41 +40,49 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - if tools.Version(self.version) <= "0.5.11": + if Version(self.version) <= "0.5.11": self.requires("aws-c-common/0.6.11") else: - self.requires("aws-c-common/0.7.4") + self.requires("aws-c-common/0.8.2") if self._needs_openssl: self.requires("openssl/1.1.1q") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["USE_OPENSSL"] = self._needs_openssl - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["USE_OPENSSL"] = self._needs_openssl + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-cal")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-cal")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-cal") @@ -97,22 +100,22 @@ def package_info(self): self.cpp_info.components["aws-c-cal-lib"].requires = ["aws-c-common::aws-c-common-lib"] if self.settings.os == "Windows": self.cpp_info.components["aws-c-cal-lib"].system_libs.append("ncrypt") - elif tools.is_apple_os(self.settings.os): - self.cpp_info.components["aws-c-cal-lib"].frameworks.append("Security") + elif is_apple_os(self): + self.cpp_info.components["aws-c-cal-lib"].frameworks.extend(["CoreFoundation", "Security"]) elif self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["aws-c-cal-lib"].system_libs.append("dl") self.user_info.with_openssl = self._needs_openssl if self._needs_openssl: self.cpp_info.components["aws-c-cal-lib"].requires.append("openssl::crypto") - if not self.options["openssl"].shared: + if not self.dependencies["openssl"].options.shared: # aws-c-cal does not statically link to openssl and searches dynamically for openssl symbols . # Mark these as undefined so the linker will include them. # This avoids dynamical look-up for a system crypto library. crypto_symbols = [ "HMAC_Update", "HMAC_Final", "HMAC_Init_ex", ] - if tools.Version(self.deps_cpp_info["openssl"].version) >= "1.1": + if Version(self.dependencies["openssl"].ref.version) >= "1.1": crypto_symbols.extend([ "HMAC_CTX_new", "HMAC_CTX_free", "HMAC_CTX_reset", ]) diff --git a/recipes/aws-c-cal/all/patches/0001-use-openssl-cmake-imported-target.cmake b/recipes/aws-c-cal/all/patches/0001-use-openssl-cmake-imported-target.patch similarity index 100% rename from recipes/aws-c-cal/all/patches/0001-use-openssl-cmake-imported-target.cmake rename to recipes/aws-c-cal/all/patches/0001-use-openssl-cmake-imported-target.patch diff --git a/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.11.patch b/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.11.patch new file mode 100644 index 0000000000000..3de09bddfa119 --- /dev/null +++ b/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.11.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,7 +76,12 @@ elseif (APPLE) + message(FATAL_ERROR "Security Framework not found") + endif () + +- list(APPEND PLATFORM_LIBS "-framework Security") ++ find_library(COREFOUNDATION_LIB CoreFoundation) ++ if(NOT COREFOUNDATION_LIB) ++ message(FATAL_ERROR "CoreFoundation Framework not found") ++ endif() ++ ++ list(APPEND PLATFORM_LIBS "-framework Security -framework CoreFoundation") + endif() + else () + if (NOT BYO_CRYPTO) +--- a/source/darwin/securityframework_ecc.c ++++ b/source/darwin/securityframework_ecc.c +@@ -7,6 +7,7 @@ + #include + #include + ++#include + #include + #include + diff --git a/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.13.patch b/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.13.patch new file mode 100644 index 0000000000000..422624b80de7e --- /dev/null +++ b/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.13.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -78,7 +78,12 @@ elseif (APPLE) + message(FATAL_ERROR "Security Framework not found") + endif () + +- list(APPEND PLATFORM_LIBS "-framework Security") ++ find_library(COREFOUNDATION_LIB CoreFoundation) ++ if(NOT COREFOUNDATION_LIB) ++ message(FATAL_ERROR "CoreFoundation Framework not found") ++ endif() ++ ++ list(APPEND PLATFORM_LIBS "-framework Security -framework CoreFoundation") + endif() + else () + if (NOT BYO_CRYPTO) +--- a/source/darwin/securityframework_ecc.c ++++ b/source/darwin/securityframework_ecc.c +@@ -7,6 +7,7 @@ + #include + #include + ++#include + #include + #include + diff --git a/recipes/aws-c-cal/all/test_package/CMakeLists.txt b/recipes/aws-c-cal/all/test_package/CMakeLists.txt index 975ded3bef12d..7ed07f4d9b8e6 100644 --- a/recipes/aws-c-cal/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-cal/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-cal REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-cal) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-cal) diff --git a/recipes/aws-c-cal/all/test_package/conanfile.py b/recipes/aws-c-cal/all/test_package/conanfile.py index 2862c460d7754..1b3c18ef08ac1 100644 --- a/recipes/aws-c-cal/all/test_package/conanfile.py +++ b/recipes/aws-c-cal/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.cmake import CMake, cmake_layout import os import io + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,10 +22,10 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): stream = io.StringIO() - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True, output=stream) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun", output=stream) self.output.info(stream.getvalue()) if self.deps_user_info["aws-c-cal"].with_openssl == "True": assert "found static libcrypto" in stream.getvalue() diff --git a/recipes/aws-c-cal/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-cal/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8a88842ed46e6 --- /dev/null +++ b/recipes/aws-c-cal/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-cal REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-cal) diff --git a/recipes/aws-c-cal/all/test_v1_package/conanfile.py b/recipes/aws-c-cal/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ff0f4e1acbd6f --- /dev/null +++ b/recipes/aws-c-cal/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, CMake, tools +import os +import io + + +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): + stream = io.StringIO() + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True, output=stream) + self.output.info(stream.getvalue()) + if self.deps_user_info["aws-c-cal"].with_openssl == "True": + assert "found static libcrypto" in stream.getvalue() diff --git a/recipes/aws-c-cal/config.yml b/recipes/aws-c-cal/config.yml index e742c8041e410..f969df4acc583 100644 --- a/recipes/aws-c-cal/config.yml +++ b/recipes/aws-c-cal/config.yml @@ -1,4 +1,8 @@ versions: + "0.5.20": + folder: all + "0.5.19": + folder: all "0.5.17": folder: all "0.5.13": diff --git a/recipes/aws-c-common/all/conandata.yml b/recipes/aws-c-common/all/conandata.yml index 26e66ad5a8e95..773702bbe2c98 100644 --- a/recipes/aws-c-common/all/conandata.yml +++ b/recipes/aws-c-common/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.8.2": + url: "https://github.com/awslabs/aws-c-common/archive/v0.8.2.tar.gz" + sha256: "36edc6e486c43bbb34059dde227e872c0d41ab54f0b3609d38f188cfbbc6d1f8" "0.7.5": url: "https://github.com/awslabs/aws-c-common/archive/v0.7.5.tar.gz" sha256: "e34fd3d3d32e3597f572205aaabbe995e162f4015e14c7328987b596bd25812c" diff --git a/recipes/aws-c-common/config.yml b/recipes/aws-c-common/config.yml index 6664f0d33a038..5a8e794412c2f 100644 --- a/recipes/aws-c-common/config.yml +++ b/recipes/aws-c-common/config.yml @@ -1,4 +1,6 @@ versions: + "0.8.2": + folder: all "0.7.5": folder: all "0.7.4": diff --git a/recipes/aws-c-compression/all/CMakeLists.txt b/recipes/aws-c-compression/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-compression/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-compression/all/conandata.yml b/recipes/aws-c-compression/all/conandata.yml index e91acbde59dd4..1baf0be5b106a 100644 --- a/recipes/aws-c-compression/all/conandata.yml +++ b/recipes/aws-c-compression/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.2.15": + url: "https://github.com/awslabs/aws-c-compression/archive/v0.2.15.tar.gz" + sha256: "11d58a229e2961b2b36493155a981dea2c8a0bc0d113b0073deb8c3189cfa04e" "0.2.14": url: "https://github.com/awslabs/aws-c-compression/archive/v0.2.14.tar.gz" sha256: "8737863ced57d92f5a0bdde554bf0fe70eaa76aae118fec09a6c361dfc55d0d5" diff --git a/recipes/aws-c-compression/all/conanfile.py b/recipes/aws-c-compression/all/conanfile.py index ad431bea82df0..635a3e71fc9b4 100644 --- a/recipes/aws-c-compression/all/conanfile.py +++ b/recipes/aws-c-compression/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class AwsCCompression(ConanFile): @@ -22,48 +24,52 @@ class AwsCCompression(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-compression")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-compression")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-compression") diff --git a/recipes/aws-c-compression/all/test_package/CMakeLists.txt b/recipes/aws-c-compression/all/test_package/CMakeLists.txt index 915167add7ecd..8efb2e9b0efa5 100644 --- a/recipes/aws-c-compression/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-compression/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-compression REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-compression) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-compression) diff --git a/recipes/aws-c-compression/all/test_package/conanfile.py b/recipes/aws-c-compression/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/aws-c-compression/all/test_package/conanfile.py +++ b/recipes/aws-c-compression/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/aws-c-compression/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e3ad5964d2a88 --- /dev/null +++ b/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-compression REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-compression) diff --git a/recipes/aws-c-compression/all/test_v1_package/conanfile.py b/recipes/aws-c-compression/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/aws-c-compression/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/aws-c-compression/config.yml b/recipes/aws-c-compression/config.yml index 05d0149941499..5a381bb0e6674 100644 --- a/recipes/aws-c-compression/config.yml +++ b/recipes/aws-c-compression/config.yml @@ -1,4 +1,6 @@ versions: + "0.2.15": + folder: all "0.2.14": folder: all "0.2.13": diff --git a/recipes/aws-c-event-stream/all/CMakeLists.txt b/recipes/aws-c-event-stream/all/CMakeLists.txt deleted file mode 100644 index 969e73de12b57..0000000000000 --- a/recipes/aws-c-event-stream/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-event-stream/all/conandata.yml b/recipes/aws-c-event-stream/all/conandata.yml index 494754a3729b1..61428e916296b 100644 --- a/recipes/aws-c-event-stream/all/conandata.yml +++ b/recipes/aws-c-event-stream/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.2.15": + url: "https://github.com/awslabs/aws-c-event-stream/archive/v0.2.15.tar.gz" + sha256: "4ff2ada07ede3c6afa4b8e6e20de541e717038307f29b38c27efa7c4d875ee26" "0.2.12": url: "https://github.com/awslabs/aws-c-event-stream/archive/v0.2.12.tar.gz" sha256: "cc4ebfe715d8df5b9e3f4a3ce9b67d5f480017a7ebbbfa1d5e64ea53ec672580" @@ -13,7 +16,5 @@ sources: sha256: "f1b423a487b5d6dca118bfc0d0c6cc596dc476b282258a3228e73a8f730422d4" patches: "0.1.5": - - base_path: "source_subfolder" - patch_file: "patches/0001-disable-tests-bin.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-use-PROJECT_SOURCE_DIR.patch" + - patch_file: "patches/0001-disable-tests-bin.patch" + - patch_file: "patches/0002-use-PROJECT_SOURCE_DIR.patch" diff --git a/recipes/aws-c-event-stream/all/conanfile.py b/recipes/aws-c-event-stream/all/conanfile.py index 08ef8038f7003..25bb2fd989f0a 100644 --- a/recipes/aws-c-event-stream/all/conanfile.py +++ b/recipes/aws-c-event-stream/all/conanfile.py @@ -1,18 +1,18 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.52.0" class AwsCEventStream(ConanFile): name = "aws-c-event-stream" description = "C99 implementation of the vnd.amazon.eventstream content-type" - topics = ("aws", "eventstream", "content", ) + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-event-stream" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt", "aws_eventstream_target.cmake", "patches/*" - generators = "cmake", "cmake_find_package" + topics = ("aws", "eventstream", "content", ) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,11 +23,8 @@ class AwsCEventStream(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,52 +32,69 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-checksums/0.1.12") - self.requires("aws-c-common/0.6.19") - if tools.Version(self.version) >= "0.2": - self.requires("aws-c-io/0.11.2") + self.requires("aws-checksums/0.1.13") + self.requires("aws-c-common/0.8.2") + if Version(self.version) >= "0.2": + if Version(self.version) < "0.2.11": + self.requires("aws-c-io/0.10.20") + else: + self.requires("aws-c-io/0.13.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_BINARIES"] = False + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_BINARIES"] = False - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-event-stream")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-event-stream")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-event-stream") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-event-stream") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-event-stream" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-event-stream" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["aws-c-event-stream-lib"].names["cmake_find_package"] = "aws-c-event-stream" self.cpp_info.components["aws-c-event-stream-lib"].names["cmake_find_package_multi"] = "aws-c-event-stream" self.cpp_info.components["aws-c-event-stream-lib"].libs = ["aws-c-event-stream"] self.cpp_info.components["aws-c-event-stream-lib"].requires = ["aws-c-common::aws-c-common-lib", "aws-checksums::aws-checksums"] - if tools.Version(self.version) >= "0.2": + if Version(self.version) >= "0.2": self.cpp_info.components["aws-c-event-stream-lib"].requires.append("aws-c-io::aws-c-io-lib") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "aws-c-event-stream" + self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-event-stream" + self.cpp_info.names["cmake_find_package"] = "AWS" + self.cpp_info.names["cmake_find_package_multi"] = "AWS" diff --git a/recipes/aws-c-event-stream/all/test_package/CMakeLists.txt b/recipes/aws-c-event-stream/all/test_package/CMakeLists.txt index 360ccf8545330..05cae5027e20e 100644 --- a/recipes/aws-c-event-stream/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-event-stream/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-event-stream REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-event-stream) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-event-stream) diff --git a/recipes/aws-c-event-stream/all/test_package/conanfile.py b/recipes/aws-c-event-stream/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-event-stream/all/test_package/conanfile.py +++ b/recipes/aws-c-event-stream/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-event-stream/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-event-stream/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..674dc4a319004 --- /dev/null +++ b/recipes/aws-c-event-stream/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-event-stream REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-event-stream) diff --git a/recipes/aws-c-event-stream/all/test_v1_package/conanfile.py b/recipes/aws-c-event-stream/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-event-stream/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/aws-c-event-stream/config.yml b/recipes/aws-c-event-stream/config.yml index a93345494d8de..96ac653286f12 100644 --- a/recipes/aws-c-event-stream/config.yml +++ b/recipes/aws-c-event-stream/config.yml @@ -1,9 +1,11 @@ versions: + "0.2.15": + folder: all "0.2.12": folder: all "0.2.11": folder: all - 0.2.7: + "0.2.7": folder: all - 0.1.5: + "0.1.5": folder: all diff --git a/recipes/aws-c-http/all/CMakeLists.txt b/recipes/aws-c-http/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-http/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-http/all/conandata.yml b/recipes/aws-c-http/all/conandata.yml index 87f7955d95d07..09a36b1a86c13 100644 --- a/recipes/aws-c-http/all/conandata.yml +++ b/recipes/aws-c-http/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.6.22": + url: "https://github.com/awslabs/aws-c-http/archive/v0.6.22.tar.gz" + sha256: "a178fd04bd1618469cd21afc5b84cbe436d1f9d9e036fefbd3a8f00356da4d4c" "0.6.13": url: "https://github.com/awslabs/aws-c-http/archive/v0.6.13.tar.gz" sha256: "8c69f8fc58b7073039e598383da3e1fd9b23f392cb992dbe769a7b80f342dbaf" diff --git a/recipes/aws-c-http/all/conanfile.py b/recipes/aws-c-http/all/conanfile.py index 6e56f19ff07d9..5f4b5242c4dbe 100644 --- a/recipes/aws-c-http/all/conanfile.py +++ b/recipes/aws-c-http/all/conanfile.py @@ -1,17 +1,18 @@ +from conan import ConanFile +from conan.tools.scm import Version +from conan.tools.files import get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class AwsCHttp(ConanFile): name = "aws-c-http" description = "C99 implementation of the HTTP/1.1 and HTTP/2 specifications" - topics = ("aws", "amazon", "cloud", "http", "http2", ) + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-http" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "http", "http2", ) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,48 +23,58 @@ class AwsCHttp(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") - self.requires("aws-c-compression/0.2.14") - self.requires("aws-c-io/0.10.20") + self.requires("aws-c-common/0.8.2") + self.requires("aws-c-compression/0.2.15") + if Version(self.version) < "0.6.22": + self.requires("aws-c-io/0.10.20") + else: + self.requires("aws-c-io/0.13.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-http")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-http")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-http") diff --git a/recipes/aws-c-http/all/test_package/CMakeLists.txt b/recipes/aws-c-http/all/test_package/CMakeLists.txt index 7b2b79320df60..94387e3cbcded 100644 --- a/recipes/aws-c-http/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-http/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-http REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-http) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-http) diff --git a/recipes/aws-c-http/all/test_package/conanfile.py b/recipes/aws-c-http/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-http/all/test_package/conanfile.py +++ b/recipes/aws-c-http/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-http/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-http/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b3195e120b0b2 --- /dev/null +++ b/recipes/aws-c-http/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-http REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-http) diff --git a/recipes/aws-c-http/all/test_v1_package/conanfile.py b/recipes/aws-c-http/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-http/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/aws-c-http/config.yml b/recipes/aws-c-http/config.yml index ac476c864a916..ab4b9f0488086 100644 --- a/recipes/aws-c-http/config.yml +++ b/recipes/aws-c-http/config.yml @@ -1,4 +1,6 @@ versions: + "0.6.22": + folder: all "0.6.13": folder: all "0.6.10": diff --git a/recipes/aws-c-io/all/CMakeLists.txt b/recipes/aws-c-io/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-io/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-io/all/conandata.yml b/recipes/aws-c-io/all/conandata.yml index 9893bcceca8e0..4a9102a6ede26 100644 --- a/recipes/aws-c-io/all/conandata.yml +++ b/recipes/aws-c-io/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.13.4": + url: "https://github.com/awslabs/aws-c-io/archive/v0.13.4.tar.gz" + sha256: "133bd0aa46caa2041962cd4f6d076209686ce2934af82f86d1a258df4cbdce8b" "0.11.2": url: "https://github.com/awslabs/aws-c-io/archive/v0.11.2.tar.gz" sha256: "b60270d23b6e2f4a5d80e64ca6538ba114cd6044b53752964c940f87e59bf0d9" diff --git a/recipes/aws-c-io/all/conanfile.py b/recipes/aws-c-io/all/conanfile.py index a460634d03107..84b513c37e69f 100644 --- a/recipes/aws-c-io/all/conanfile.py +++ b/recipes/aws-c-io/all/conanfile.py @@ -1,17 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.52.0" class AwsCIO(ConanFile): name = "aws-c-io" description = "IO and TLS for application protocols" - topics = ("aws", "amazon", "cloud", "io", "tls",) + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-io" - license = "Apache-2.0", - + topics = ("aws", "amazon", "cloud", "io", "tls",) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,58 +23,63 @@ class AwsCIO(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): # the versions of aws-c-common and aws-c-io are tied since aws-c-common/0.6.12 and aws-c-io/0.10.10 # Please refer https://github.com/conan-io/conan-center-index/issues/7763 - if tools.Version(self.version) <= "0.10.9": + if Version(self.version) <= "0.10.9": self.requires("aws-c-common/0.6.11") self.requires("aws-c-cal/0.5.11") else: - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") self.requires("aws-c-cal/0.5.13") if self.settings.os in ["Linux", "FreeBSD", "Android"]: - self.requires("s2n/1.3.9") + self.requires("s2n/1.3.15") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-io")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-io")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-io") diff --git a/recipes/aws-c-io/all/test_package/CMakeLists.txt b/recipes/aws-c-io/all/test_package/CMakeLists.txt index 819bf242a1b07..de3176cc25055 100644 --- a/recipes/aws-c-io/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-io/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-io REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/aws-c-io/all/test_package/conanfile.py b/recipes/aws-c-io/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/aws-c-io/all/test_package/conanfile.py +++ b/recipes/aws-c-io/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-io/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-io/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e45dc2bc298c6 --- /dev/null +++ b/recipes/aws-c-io/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-io REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} AWS::aws-c-io) diff --git a/recipes/aws-c-io/all/test_v1_package/conanfile.py b/recipes/aws-c-io/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-io/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/aws-c-io/config.yml b/recipes/aws-c-io/config.yml index 5fac743e25830..6dca88e3f0554 100644 --- a/recipes/aws-c-io/config.yml +++ b/recipes/aws-c-io/config.yml @@ -1,4 +1,6 @@ versions: + "0.13.4": + folder: all "0.11.2": folder: all "0.10.20": diff --git a/recipes/aws-c-mqtt/all/CMakeLists.txt b/recipes/aws-c-mqtt/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-mqtt/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-mqtt/all/conandata.yml b/recipes/aws-c-mqtt/all/conandata.yml index 22b006adcd3d9..6240cf10ee0f5 100644 --- a/recipes/aws-c-mqtt/all/conandata.yml +++ b/recipes/aws-c-mqtt/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.12": + url: "https://github.com/awslabs/aws-c-mqtt/archive/v0.7.12.tar.gz" + sha256: "cf80f1b4f37aa8a6b8698315fae32cbf2bd944b67784f07b5762f392f18e64df" "0.7.10": url: "https://github.com/awslabs/aws-c-mqtt/archive/v0.7.10.tar.gz" sha256: "95667477e17bc99d49a1d6674d7fb98f9a0379b6966cb2ed4863152e959d9e8f" diff --git a/recipes/aws-c-mqtt/all/conanfile.py b/recipes/aws-c-mqtt/all/conanfile.py index 1e0ca9593f67c..4edb02ac94d9f 100644 --- a/recipes/aws-c-mqtt/all/conanfile.py +++ b/recipes/aws-c-mqtt/all/conanfile.py @@ -1,18 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class AwsCMQTT(ConanFile): name = "aws-c-mqtt" description = "C99 implementation of the MQTT 3.1.1 specification." - topics = ("aws", "amazon", "cloud", "mqtt") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-mqtt" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "mqtt") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,49 +25,59 @@ class AwsCMQTT(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") self.requires("aws-c-cal/0.5.13") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") + if Version(self.version) < "0.7.12": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-mqtt")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-mqtt")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-mqtt") diff --git a/recipes/aws-c-mqtt/all/test_package/CMakeLists.txt b/recipes/aws-c-mqtt/all/test_package/CMakeLists.txt index 721080a47fbac..04c8de77ba626 100644 --- a/recipes/aws-c-mqtt/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-mqtt/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-mqtt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-mqtt) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-mqtt) diff --git a/recipes/aws-c-mqtt/all/test_package/conanfile.py b/recipes/aws-c-mqtt/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-mqtt/all/test_package/conanfile.py +++ b/recipes/aws-c-mqtt/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-mqtt/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-mqtt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..610e2350e6503 --- /dev/null +++ b/recipes/aws-c-mqtt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-mqtt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-mqtt) diff --git a/recipes/aws-c-mqtt/all/test_v1_package/conanfile.py b/recipes/aws-c-mqtt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-mqtt/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/aws-c-mqtt/config.yml b/recipes/aws-c-mqtt/config.yml index 92ca5ab76486c..edbab7e67d700 100644 --- a/recipes/aws-c-mqtt/config.yml +++ b/recipes/aws-c-mqtt/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.12": + folder: all "0.7.10": folder: all "0.7.9": diff --git a/recipes/aws-c-s3/all/CMakeLists.txt b/recipes/aws-c-s3/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-s3/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-s3/all/conandata.yml b/recipes/aws-c-s3/all/conandata.yml index 4daad0a6b73cc..af6e82a742aa6 100644 --- a/recipes/aws-c-s3/all/conandata.yml +++ b/recipes/aws-c-s3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.49": + url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.49.tar.gz" + sha256: "71acbba41a02477a6c352172da561bc2138bf239b936490c773d7aaa83afc9ab" "0.1.37": url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.37.tar.gz" sha256: "2c35100c1739300e438d47f49aaa2c374001416a79fe3c6f27d79371fb2ac90b" diff --git a/recipes/aws-c-s3/all/conanfile.py b/recipes/aws-c-s3/all/conanfile.py index 59a016d054869..131627214ba79 100644 --- a/recipes/aws-c-s3/all/conanfile.py +++ b/recipes/aws-c-s3/all/conanfile.py @@ -1,18 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.47.0" class AwsCS3(ConanFile): name = "aws-c-s3" description = "C99 implementation of the S3 client" - topics = ("aws", "amazon", "cloud", "s3") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-s3" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "s3") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,51 +23,62 @@ class AwsCS3(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") - self.requires("aws-c-auth/0.6.11") - if tools.Version(self.version) >= "0.1.36": - self.requires("aws-checksums/0.1.12") + self.requires("aws-c-common/0.8.2") + if Version(self.version) < "0.1.49": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + self.requires("aws-c-auth/0.6.11") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + self.requires("aws-c-auth/0.6.17") + if Version(self.version) >= "0.1.36": + self.requires("aws-checksums/0.1.13") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-s3")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-s3")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-s3") @@ -88,5 +99,5 @@ def package_info(self): "aws-c-http::aws-c-http-lib", "aws-c-auth::aws-c-auth-lib" ] - if tools.Version(self.version) >= "0.1.36": + if Version(self.version) >= "0.1.36": self.cpp_info.components["aws-c-s3-lib"].requires.append("aws-checksums::aws-checksums-lib") diff --git a/recipes/aws-c-s3/all/test_package/CMakeLists.txt b/recipes/aws-c-s3/all/test_package/CMakeLists.txt index 4af87d8f6333f..8e0fdd1abc04c 100644 --- a/recipes/aws-c-s3/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-s3/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-s3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-s3) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-s3) diff --git a/recipes/aws-c-s3/all/test_package/conanfile.py b/recipes/aws-c-s3/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-s3/all/test_package/conanfile.py +++ b/recipes/aws-c-s3/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0778b2e2c7246 --- /dev/null +++ b/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-s3 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-s3) diff --git a/recipes/aws-c-s3/all/test_v1_package/conanfile.py b/recipes/aws-c-s3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/aws-c-s3/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-s3/config.yml b/recipes/aws-c-s3/config.yml index 86679f6500b25..182095498622b 100644 --- a/recipes/aws-c-s3/config.yml +++ b/recipes/aws-c-s3/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.49": + folder: all "0.1.37": folder: all "0.1.29": diff --git a/recipes/aws-c-sdkutils/all/CMakeLists.txt b/recipes/aws-c-sdkutils/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-sdkutils/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-sdkutils/all/conandata.yml b/recipes/aws-c-sdkutils/all/conandata.yml index a2d7aa973057e..7ec4906cf9a7f 100644 --- a/recipes/aws-c-sdkutils/all/conandata.yml +++ b/recipes/aws-c-sdkutils/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.3": + url: "https://github.com/awslabs/aws-c-sdkutils/archive/v0.1.3.tar.gz" + sha256: "13d99c0877424a8fad40f312762968012dd54ec60a4438fb601ee65ff8b2484b" "0.1.2": url: "https://github.com/awslabs/aws-c-sdkutils/archive/refs/tags/v0.1.2.tar.gz" sha256: "d654670c145212ed3ce0699a988b9f83ebf3e7c44ed74d4d0772dc95ad46b38e" diff --git a/recipes/aws-c-sdkutils/all/conanfile.py b/recipes/aws-c-sdkutils/all/conanfile.py index 37509472eb1f5..43b3b4f755411 100644 --- a/recipes/aws-c-sdkutils/all/conanfile.py +++ b/recipes/aws-c-sdkutils/all/conanfile.py @@ -1,18 +1,17 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.52.0" class AwsCSDKUtils(ConanFile): name = "aws-c-sdkutils" - description = "aws c language sdk utility library." - topics = ("aws", "amazon", "cloud", "utility") + description = "C99 library implementing AWS SDK specific utilities. Includes utilities for ARN parsing, reading AWS profiles, etc..." + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-sdkutils" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt", - generators = "cmake", "cmake_find_package_multi" + topics = ("aws", "amazon", "cloud", "utility", "ARN") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,45 +22,52 @@ class AwsCSDKUtils(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-sdkutils")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-sdkutils")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-sdkutils") @@ -77,4 +83,3 @@ def package_info(self): self.cpp_info.components["aws-c-sdkutils-lib"].libs = ["aws-c-sdkutils"] self.cpp_info.components["aws-c-sdkutils-lib"].requires = ["aws-c-common::aws-c-common-lib"] - diff --git a/recipes/aws-c-sdkutils/all/test_package/CMakeLists.txt b/recipes/aws-c-sdkutils/all/test_package/CMakeLists.txt index 61121c6334930..4b5efc665c153 100644 --- a/recipes/aws-c-sdkutils/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-sdkutils/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-sdkutils REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/aws-c-sdkutils/all/test_package/conanfile.py b/recipes/aws-c-sdkutils/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-sdkutils/all/test_package/conanfile.py +++ b/recipes/aws-c-sdkutils/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..6e620de3b4bc3 --- /dev/null +++ b/recipes/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-sdkutils REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} AWS::aws-c-sdkutils) diff --git a/recipes/aws-c-sdkutils/all/test_v1_package/conanfile.py b/recipes/aws-c-sdkutils/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-sdkutils/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/aws-c-sdkutils/config.yml b/recipes/aws-c-sdkutils/config.yml index eb8addc0ca6d3..b2ced6f0d7ab7 100644 --- a/recipes/aws-c-sdkutils/config.yml +++ b/recipes/aws-c-sdkutils/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.3": + folder: all "0.1.2": folder: all "0.1.1": diff --git a/recipes/aws-checksums/all/CMakeLists.txt b/recipes/aws-checksums/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-checksums/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-checksums/all/conandata.yml b/recipes/aws-checksums/all/conandata.yml index 88de28be65063..ddf66e3fcf5ae 100644 --- a/recipes/aws-checksums/all/conandata.yml +++ b/recipes/aws-checksums/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.13": + url: "https://github.com/awslabs/aws-checksums/archive/v0.1.13.tar.gz" + sha256: "0f897686f1963253c5069a0e495b85c31635ba146cd3ac38cc2ea31eaf54694d" "0.1.12": url: "https://github.com/awslabs/aws-checksums/archive/v0.1.12.tar.gz" sha256: "394723034b81cc7cd528401775bc7aca2b12c7471c92350c80a0e2fb9d2909fe" @@ -10,9 +13,6 @@ sources: sha256: "6e6bed6f75cf54006b6bafb01b3b96df19605572131a2260fddaf0e87949ced0" patches: "0.1.5": - - base_path: "source_subfolder" - patch_file: "patches/0001-use-PROJECT_SOURCE_DIR.cmake" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-overriding-fPIC.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-disable-building-tests.patch" + - patch_file: "patches/0001-use-PROJECT_SOURCE_DIR.patch" + - patch_file: "patches/0002-disable-overriding-fPIC.patch" + - patch_file: "patches/0003-disable-building-tests.patch" diff --git a/recipes/aws-checksums/all/conanfile.py b/recipes/aws-checksums/all/conanfile.py index 0cc74755103d4..d3412c3a07b16 100644 --- a/recipes/aws-checksums/all/conanfile.py +++ b/recipes/aws-checksums/all/conanfile.py @@ -1,8 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.52.0" class AwsChecksums(ConanFile): name = "aws-checksums" @@ -10,11 +11,10 @@ class AwsChecksums(ConanFile): "Cross-Platform HW accelerated CRC32c and CRC32 with fallback to efficient " "SW implementations. C interface with language bindings for each of our SDKs." ) - topics = ("aws", "checksum", ) + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-checksums" - license = "Apache-2.0", - + topics = ("aws", "checksum", ) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,17 +25,8 @@ class AwsChecksums(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,37 +34,47 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-checksums")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-checksums")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-checksums") diff --git a/recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.cmake b/recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.patch similarity index 100% rename from recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.cmake rename to recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.patch diff --git a/recipes/aws-checksums/all/test_package/CMakeLists.txt b/recipes/aws-checksums/all/test_package/CMakeLists.txt index 5032e04785efc..9922744f24e3f 100644 --- a/recipes/aws-checksums/all/test_package/CMakeLists.txt +++ b/recipes/aws-checksums/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-checksums REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-checksums) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-checksums) diff --git a/recipes/aws-checksums/all/test_package/conanfile.py b/recipes/aws-checksums/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/aws-checksums/all/test_package/conanfile.py +++ b/recipes/aws-checksums/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/aws-checksums/all/test_v1_package/CMakeLists.txt b/recipes/aws-checksums/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..915af9f83a60f --- /dev/null +++ b/recipes/aws-checksums/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-checksums REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-checksums) diff --git a/recipes/aws-checksums/all/test_v1_package/conanfile.py b/recipes/aws-checksums/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/aws-checksums/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/aws-checksums/config.yml b/recipes/aws-checksums/config.yml index 9f54b2f6052e0..55fedf4c307f5 100644 --- a/recipes/aws-checksums/config.yml +++ b/recipes/aws-checksums/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.13": + folder: all "0.1.12": folder: all "0.1.11": diff --git a/recipes/aws-crt-cpp/all/CMakeLists.txt b/recipes/aws-crt-cpp/all/CMakeLists.txt deleted file mode 100644 index 38522bd23de5d..0000000000000 --- a/recipes/aws-crt-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-crt-cpp/all/conandata.yml b/recipes/aws-crt-cpp/all/conandata.yml index 723445d104dfe..5615e65f10a0b 100644 --- a/recipes/aws-crt-cpp/all/conandata.yml +++ b/recipes/aws-crt-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.18.8": + url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.18.8.tar.gz" + sha256: "70ea622cf8c1a7028b24078e909ee5898990444436584178f58d61b50b5b197d" "0.17.23": url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.17.23.tar.gz" sha256: "28061c3efa493519cfae46e4ea96389f03a81eeec7613d7da861dd8c5f4f6598" @@ -9,9 +12,15 @@ sources: url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.14.3.tar.gz" sha256: "3ea16c43e691bab0c373ba1ad072f6535390c516ebda658dfaf4d074d920e0fb" patches: + "0.18.8": + - patch_file: "patches/0.17.23-fix-cast-error.patch" + patch_description: "fix const cast error" + patch_type: "portability" "0.17.23": - - base_path: "source_subfolder" - patch_file: "patches/0.17.23-fix-cast-error.patch" + - patch_file: "patches/0.17.23-fix-cast-error.patch" + patch_description: "fix const cast error" + patch_type: "portability" "0.17.12": - - base_path: "source_subfolder" - patch_file: "patches/0.17.12-fix-cast-error.patch" + - patch_file: "patches/0.17.12-fix-cast-error.patch" + patch_description: "fix const cast error" + patch_type: "portability" diff --git a/recipes/aws-crt-cpp/all/conanfile.py b/recipes/aws-crt-cpp/all/conanfile.py index fb49c50bc21cd..c70a676efc102 100644 --- a/recipes/aws-crt-cpp/all/conanfile.py +++ b/recipes/aws-crt-cpp/all/conanfile.py @@ -1,16 +1,20 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class AwsCrtCpp(ConanFile): name = "aws-crt-cpp" description = "C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++." - topics = ("aws", "amazon", "cloud", "wrapper") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-crt-cpp" - license = "Apache-2.0", - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "wrapper") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,16 +25,12 @@ class AwsCrtCpp(ConanFile): "fPIC": True, } - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,55 +38,64 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-event-stream/0.2.7") - self.requires("aws-c-common/0.6.19") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") - self.requires("aws-c-auth/0.6.11") - self.requires("aws-c-mqtt/0.7.10") - self.requires("aws-c-s3/0.1.37") - self.requires("aws-checksums/0.1.12") + self.requires("aws-c-common/0.8.2") + self.requires("aws-checksums/0.1.13") + if Version(self.version) < "0.17.29": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + self.requires("aws-c-auth/0.6.11") + self.requires("aws-c-s3/0.1.37") + self.requires("aws-c-mqtt/0.7.10") + self.requires("aws-c-event-stream/0.2.7") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + self.requires("aws-c-auth/0.6.17") + self.requires("aws-c-s3/0.1.49") + self.requires("aws-c-mqtt/0.7.12") + self.requires("aws-c-event-stream/0.2.15") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["BUILD_DEPS"] = False - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_DEPS"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-crt-cpp")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-crt-cpp")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-crt-cpp") self.cpp_info.set_property("cmake_target_name", "AWS::aws-crt-cpp") - self.cpp_info.filenames["cmake_find_package"] = "aws-crt-cpp" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-crt-cpp" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["aws-crt-cpp-lib"].names["cmake_find_package"] = "aws-crt-cpp" self.cpp_info.components["aws-crt-cpp-lib"].names["cmake_find_package_multi"] = "aws-crt-cpp" self.cpp_info.components["aws-crt-cpp-lib"].libs = ["aws-crt-cpp"] @@ -100,3 +109,9 @@ def package_info(self): "aws-c-s3::aws-c-s3-lib", "aws-checksums::aws-checksums-lib" ] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "aws-crt-cpp" + self.cpp_info.filenames["cmake_find_package_multi"] = "aws-crt-cpp" + self.cpp_info.names["cmake_find_package"] = "AWS" + self.cpp_info.names["cmake_find_package_multi"] = "AWS" diff --git a/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt b/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt index 74debee402ca9..50b34b056a787 100644 --- a/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt +++ b/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(aws-crt-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} AWS::aws-crt-cpp) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/aws-crt-cpp/all/test_package/conanfile.py b/recipes/aws-crt-cpp/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-crt-cpp/all/test_package/conanfile.py +++ b/recipes/aws-crt-cpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt b/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..31592420f8acc --- /dev/null +++ b/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-crt-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/aws-crt-cpp/all/test_v1_package/conanfile.py b/recipes/aws-crt-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/aws-crt-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-crt-cpp/config.yml b/recipes/aws-crt-cpp/config.yml index cd074764fbd37..a2a8f6922a602 100644 --- a/recipes/aws-crt-cpp/config.yml +++ b/recipes/aws-crt-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "0.18.8": + folder: all "0.17.23": folder: all "0.17.12": diff --git a/recipes/bandit/all/conandata.yml b/recipes/bandit/all/conandata.yml new file mode 100644 index 0000000000000..f6a1c1fc0eaad --- /dev/null +++ b/recipes/bandit/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "cci.20210618": + url: "https://github.com/banditcpp/bandit/archive/77f50861c09d794af9ae5f65111b330d9b721054.tar.gz" + sha256: "4fe2eeb623e16a09b56f7a4e3d8fde864a5a4a67226cb514945fa7e9a1ae216a" +patches: + "cci.20210618": + - patch_file: "patches/0001-change-snowhouse-path.patch" + patch_description: "Fix snowhouse.h include path" + patch_type: "conan" diff --git a/recipes/bandit/all/conanfile.py b/recipes/bandit/all/conanfile.py new file mode 100644 index 0000000000000..31fd2c6978fa4 --- /dev/null +++ b/recipes/bandit/all/conanfile.py @@ -0,0 +1,46 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.51.3" + + +class BanditConan(ConanFile): + name = "bandit" + description = "Human-friendly unit testing for C++11" + topics = ("testing", "header-only") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/banditcpp/bandit" + license = "MIT" + + 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 requirements(self): + self.requires("snowhouse/5.0.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def layout(self): + basic_layout(self) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, "LICENSE.txt", src=os.path.join(self.source_folder, "docs"), dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "include", "bandit"), src=os.path.join(self.source_folder, "bandit")) + + def package_id(self): + self.info.clear() + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + diff --git a/recipes/bandit/all/patches/0001-change-snowhouse-path.patch b/recipes/bandit/all/patches/0001-change-snowhouse-path.patch new file mode 100644 index 0000000000000..1df54a4f04d5b --- /dev/null +++ b/recipes/bandit/all/patches/0001-change-snowhouse-path.patch @@ -0,0 +1,13 @@ +diff --git a/bandit/adapters/snowhouse.h b/bandit/adapters/snowhouse.h +index f3d9fde..ee3844c 100644 +--- a/bandit/adapters/snowhouse.h ++++ b/bandit/adapters/snowhouse.h +@@ -3,7 +3,7 @@ + + #include + #include +-#include ++#include + + namespace bandit { + namespace adapter { diff --git a/recipes/bandit/all/test_package/CMakeLists.txt b/recipes/bandit/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..58ffec4a070b7 --- /dev/null +++ b/recipes/bandit/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +find_package(bandit REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} bandit::bandit) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bandit/all/test_package/conanfile.py b/recipes/bandit/all/test_package/conanfile.py new file mode 100644 index 0000000000000..40f70f535b209 --- /dev/null +++ b/recipes/bandit/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def 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) + 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/bandit/all/test_package/test_package.cpp b/recipes/bandit/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..764be0a694402 --- /dev/null +++ b/recipes/bandit/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include +#include + +using namespace snowhouse; +using namespace bandit; + +go_bandit([]() { + describe("context", []() { + bool b; + + before_each([&]() { + b = true; + }); + + it("is true", [&]() { + AssertThat(b, IsTrue()); + }); + }); +}); + +int main(int argc, char** argv) { + return bandit::run(argc, argv); +} + diff --git a/recipes/bandit/all/test_v1_package/CMakeLists.txt b/recipes/bandit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..08111eba078e8 --- /dev/null +++ b/recipes/bandit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(bandit REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE bandit::bandit) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bandit/all/test_v1_package/conanfile.py b/recipes/bandit/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/bandit/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/bandit/config.yml b/recipes/bandit/config.yml new file mode 100644 index 0000000000000..5cbf4c1d7cb53 --- /dev/null +++ b/recipes/bandit/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20210618": + folder: "all" diff --git a/recipes/base64/all/CMakeLists.txt b/recipes/base64/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/base64/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/base64/all/conandata.yml b/recipes/base64/all/conandata.yml index 4a9e80d3b3b00..6ebaff03fb45d 100644 --- a/recipes/base64/all/conandata.yml +++ b/recipes/base64/all/conandata.yml @@ -1,10 +1,19 @@ sources: + "0.5.0": + url: "https://github.com/aklomp/base64/archive/v0.5.0.tar.gz" + sha256: "b21be58a90d31302ba86056db7ef77a481393b9359c505be5337d7d54e8a0559" "0.4.0": - sha256: 1fce54059c504b2604c22c20cd930444a71b3340fc81334c037da63976d92002 - url: https://github.com/aklomp/base64/archive/v0.4.0.tar.gz + url: "https://github.com/aklomp/base64/archive/v0.4.0.tar.gz" + sha256: "1fce54059c504b2604c22c20cd930444a71b3340fc81334c037da63976d92002" patches: + "0.5.0": + - patch_file: "patches/0.5.0-0001-make.patch" + patch_description: "add library taget" + patch_type: "conan" "0.4.0": - - base_path: "source_subfolder" - patch_file: "patches/make.patch" - - base_path: "source_subfolder" - patch_file: "patches/cmake.patch" + - patch_file: "patches/0.4.0-0001-make.patch" + patch_description: "add library taget" + patch_type: "conan" + - patch_file: "patches/0.4.0-0002-cmake.patch" + patch_description: "provide CMakeLists.txt for MSVC" + patch_type: "conan" diff --git a/recipes/base64/all/conanfile.py b/recipes/base64/all/conanfile.py index 6db47a061d928..d56ae8c5bcf10 100644 --- a/recipes/base64/all/conanfile.py +++ b/recipes/base64/all/conanfile.py @@ -1,85 +1,125 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import Environment +from conan.tools.files import copy, get, apply_conandata_patches, chdir, export_conandata_patches, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + import os -from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools +required_conan_version = ">=1.52.0" class Base64Conan(ConanFile): name = "base64" + description = "Fast Base64 stream encoder/decoder" license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/aklomp/base64" - description = "Fast Base64 stream encoder/decoder" - topics = ("base64", "codec") - exports_sources = "patches/**", "CMakeLists.txt" - generators = "cmake" + topics = ("base64", "codec", "encoder", "decoder") settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False] + "shared": [True, False], + "fPIC": [True, False], } default_options = { - "fPIC": True + "shared": False, + "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == 'Windows': del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + def layout(self): + if self._use_cmake: + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + def validate(self): + if Version(self.version) < "0.5.0" and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support build shared.") - def _build_cmake(self): - cmake = self._configure_cmake() - cmake.build(target="base64") + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + @property + def _use_cmake(self): + return is_msvc(self) or Version(self.version) >= "0.5.0" - def _build_autotools(self): - autotools = AutoToolsBuildEnvironment(self) - if self.settings.arch == "x86" or self.settings.arch == "x86_64": - extra_env = { - "AVX2_CFLAGS": "-mavx2", - "SSSE3_CFLAGS": "-mssse3", - "SSE41_CFLAGS": "-msse4.1", - "SSE42_CFLAGS": "-msse4.2", - "AVX_CFLAGS": "-mavx" - } + def generate(self): + if self._use_cmake: + tc = CMakeToolchain(self) + tc.generate() else: - # ARM-specific instructions can be enabled here - extra_env = {} - with tools.environment_append(extra_env): - with tools.chdir(self._source_subfolder): - autotools.make(target="lib/libbase64.a") + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - self._patch_sources() - if self.settings.compiler == "Visual Studio": - self._build_cmake() + apply_conandata_patches(self) + if self._use_cmake: + cmake = CMake(self) + cmake.configure() + if Version(self.version) >= "0.5.0": + cmake.build() + else: + cmake.build(target="base64") else: - self._build_autotools() + env = Environment() + if self.settings.arch == "x86" or self.settings.arch == "x86_64": + env.append("AVX2_CFLAGS", "-mavx2") + env.append("SSSE3_CFLAGS", "-mssse3") + env.append("SSE41_CFLAGS", "-msse4.1") + env.append("SSE42_CFLAGS", "-msse4.2") + env.append("AVX_CFLAGS", "-mavx") + else: + # ARM-specific instructions can be enabled here + pass + with env.vars(self).apply(), \ + chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make(target="lib/libbase64.a") def package(self): - self.copy(pattern="*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="*.a", dst="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) - 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) + if self._use_cmake: + cmake = CMake(self) + cmake.install() + if Version(self.version) >= "0.5.0": + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + else: + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib")) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + else: + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) def package_info(self): self.cpp_info.libs = ["base64"] + + if Version(self.version) >= "0.5.0" and not self.options.shared: + self.cpp_info.defines.append("BASE64_STATIC_DEFINE") diff --git a/recipes/base64/all/patches/make.patch b/recipes/base64/all/patches/0.4.0-0001-make.patch similarity index 100% rename from recipes/base64/all/patches/make.patch rename to recipes/base64/all/patches/0.4.0-0001-make.patch diff --git a/recipes/base64/all/patches/cmake.patch b/recipes/base64/all/patches/0.4.0-0002-cmake.patch similarity index 100% rename from recipes/base64/all/patches/cmake.patch rename to recipes/base64/all/patches/0.4.0-0002-cmake.patch diff --git a/recipes/base64/all/patches/0.5.0-0001-make.patch b/recipes/base64/all/patches/0.5.0-0001-make.patch new file mode 100644 index 0000000000000..f20d7ff2ec119 --- /dev/null +++ b/recipes/base64/all/patches/0.5.0-0001-make.patch @@ -0,0 +1,14 @@ +diff --git a/Makefile b/Makefile +index 2bb01e2..200ca73 100644 +--- a/Makefile ++++ b/Makefile +@@ -63,6 +63,9 @@ lib/libbase64.o: $(OBJS) + $(LD) -r -o $@ $^ + $(OBJCOPY) --keep-global-symbols=lib/exports.txt $@ + ++lib/libbase64.a: $(OBJS) ++ $(AR) rc $@ $^ ++ + lib/config.h: + @echo "#define HAVE_AVX2 $(HAVE_AVX2)" > $@ + @echo "#define HAVE_NEON32 $(HAVE_NEON32)" >> $@ diff --git a/recipes/base64/all/test_package/CMakeLists.txt b/recipes/base64/all/test_package/CMakeLists.txt index 48b855b8a30aa..195fdf269b250 100644 --- a/recipes/base64/all/test_package/CMakeLists.txt +++ b/recipes/base64/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package C) -add_executable(example example.c) -target_link_libraries(example ${CONAN_LIBS}) +find_package(base64 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE base64::base64) diff --git a/recipes/base64/all/test_package/conanfile.py b/recipes/base64/all/test_package/conanfile.py index 9a662bfeb73fe..a9fb96656f203 100644 --- a/recipes/base64/all/test_package/conanfile.py +++ b/recipes/base64/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class CppcodecTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "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) @@ -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", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/base64/all/test_package/example.c b/recipes/base64/all/test_package/test_package.c similarity index 100% rename from recipes/base64/all/test_package/example.c rename to recipes/base64/all/test_package/test_package.c diff --git a/recipes/base64/all/test_v1_package/CMakeLists.txt b/recipes/base64/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..6c32de99d28f7 --- /dev/null +++ b/recipes/base64/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(base64 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE base64::base64) diff --git a/recipes/base64/all/test_v1_package/conanfile.py b/recipes/base64/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/base64/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/base64/config.yml b/recipes/base64/config.yml index 80f918766690c..d13fcfd021b7b 100644 --- a/recipes/base64/config.yml +++ b/recipes/base64/config.yml @@ -1,4 +1,5 @@ ---- versions: + "0.5.0": + folder: all "0.4.0": folder: all diff --git a/recipes/bdwgc/all/CMakeLists.txt b/recipes/bdwgc/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/bdwgc/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/bdwgc/all/conandata.yml b/recipes/bdwgc/all/conandata.yml index 1d60bdd779fbf..97d6a0b86b6e9 100644 --- a/recipes/bdwgc/all/conandata.yml +++ b/recipes/bdwgc/all/conandata.yml @@ -5,10 +5,13 @@ sources: "8.0.6": url: "https://github.com/ivmai/bdwgc/releases/download/v8.0.6/gc-8.0.6.tar.gz" sha256: "3b4914abc9fa76593596773e4da671d7ed4d5390e3d46fbf2e5f155e121bea11" + "8.2.2": + url: "https://github.com/ivmai/bdwgc/releases/download/v8.2.2/gc-8.2.2.tar.gz" + sha256: "f30107bcb062e0920a790ffffa56d9512348546859364c23a14be264b38836a0" patches: "8.0.4": - - patch_file: "patches/update-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/update-cmake-8_0_4.patch" "8.0.6": - patch_file: "patches/update-cmake-8_0_6.patch" - base_path: "source_subfolder" + "8.2.2": + - patch_file: "patches/update-cmake-8_2_2.patch" diff --git a/recipes/bdwgc/all/conanfile.py b/recipes/bdwgc/all/conanfile.py index 9cf6cf0dd7e0b..925a47c27595c 100644 --- a/recipes/bdwgc/all/conanfile.py +++ b/recipes/bdwgc/all/conanfile.py @@ -1,20 +1,21 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, get, save, rmdir, copy, load +from conan.errors import ConanException import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class BdwGcConan(ConanFile): name = "bdwgc" homepage = "https://www.hboehm.info/gc/" description = "The Boehm-Demers-Weiser conservative C/C++ Garbage Collector (libgc, bdwgc, boehm-gc)" - topics = ("conan", "gc", "garbage", "collector") + topics = ("gc", "garbage", "collector") url = "https://github.com/conan-io/conan-center-index" license = "MIT" settings = "os", "compiler", "build_type", "arch" - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake" _autotools_options_defaults = ( ("cplusplus", False,), @@ -25,7 +26,6 @@ class BdwGcConan(ConanFile): ("handle_fork", True,), ("thread_local_alloc", True,), ("threads_discovery", True,), - ("parallel_mark", True,), ("gcj_support", True,), ("java_finalization", True,), ("sigrt_signals", False,), @@ -39,7 +39,6 @@ class BdwGcConan(ConanFile): ("munmap", True,), ("dynamic_loading", True,), ("register_main_static_data", True,), - ("gc_assertions", False,), ("checksums", False,), ("single_obj_compilation", False,), ) @@ -48,6 +47,7 @@ class BdwGcConan(ConanFile): "shared": [True, False], "fPIC": [True, False], } + default_options = { "shared": False, "fPIC": True, @@ -56,11 +56,9 @@ class BdwGcConan(ConanFile): options[option] = [True, False] default_options[option] = default - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + 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 config_options(self): if self.settings.os == "Windows": @@ -68,47 +66,60 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - if tools.Version(self.version) <= "8.0.6": + try: + del self.options.fPIC + except Exception: + pass + if Version(self.version) < "8.2.0": del self.options.throw_bad_alloc_library if not self.options.cplusplus: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.settings.os == "Windows": - self.requires("libatomic_ops/7.6.10") + self.requires("libatomic_ops/7.6.14") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) for option, _ in self._autotools_options_defaults: - self._cmake.definitions["enable_{}".format(option)] = self.options.get_safe(option) - self._cmake.definitions["disable_gc_debug"] = not self.options.gc_debug - self._cmake.definitions["disable_handle_fork"] = not self.options.handle_fork - self._cmake.definitions["install_headers"] = True - self._cmake.definitions["build_tests"] = False - self._cmake.verbose = True - self._cmake.parallel = False - self._cmake.configure() - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + if option == "cord": + tc.variables["build_cord"] = self.options.get_safe(option) + elif option == "cplusplus": + tc.cache_variables["enable_cplusplus"] = str(self.options.get_safe(option)) + else: + tc.variables["enable_{}".format(option)] = self.options.get_safe(option) + tc.variables["disable_gc_debug"] = not self.options.gc_debug + tc.variables["disable_handle_fork"] = not self.options.handle_fork + tc.variables["install_headers"] = True + tc.variables["enable_docs"] = False + tc.variables["build_tests"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def _extract_copyright(self): - readme_md = open(os.path.join(self._source_subfolder, "README.md")).read() + readme_md = load(self, os.path.join(self.source_folder, "README.md")) copyright_header = "## Copyright & Warranty\n" index = readme_md.find(copyright_header) if index == -1: @@ -116,28 +127,43 @@ def _extract_copyright(self): return readme_md[index+len(copyright_header):] def package(self): - tools.save(os.path.join(self.package_folder, "licenses", "COPYRIGHT"), self._extract_copyright()) - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "COPYRIGHT"), self._extract_copyright()) + cmake = CMake(self) cmake.install() - - @property - def _libs(self): - libs = [] - if self.options.get_safe("throw_bad_alloc_library"): - libs.append("gctba") - if self.options.cplusplus: - libs.append("gccpp") - if self.options.cord: - libs.append("cord") - libs.append("gc") - return libs + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.names["pkg_config"] = "bdw-gc" - self.cpp_info.libs = self._libs - self.cpp_info.defines = ["GC_DLL" if self.options.shared else "GC_NOT_DLL"] - if not self.options.shared: - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread", "dl"] + self.cpp_info.set_property("cmake_file_name", "BDWgc") + self.cpp_info.set_property("cmake_target_name", "BDWgc::BDWgc") + + # TODO: Remove on Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "BDWgc" + self.cpp_info.names["cmake_find_package_multi"] = "BDWgc" + + self.cpp_info.components["gc"].set_property("cmake_target_name", "BDWgc::gc") + self.cpp_info.components["gc"].set_property("pkg_config_name", "bdw-gc") + self.cpp_info.components["gc"].libs = ["gc"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["gc"].system_libs = ["pthread", "dl"] + self.cpp_info.components["gc"].defines = ["GC_DLL" if self.options.shared else "GC_NOT_DLL"] if self.options.gc_debug: - self.cpp_info.defines.append("GC_DEBUG") + self.cpp_info.components["gc"].defines.append("GC_DEBUG") + if self.settings.os == "Windows": + self.cpp_info.components["gc"].requires = ["libatomic_ops::atomic_ops"] + + if self.options.cplusplus and self.options.get_safe("throw_bad_alloc_library"): + self.cpp_info.components["gctba"].set_property("cmake_target_name", "BDWgc::gctba") + self.cpp_info.components["gctba"].libs = ["gctba"] + self.cpp_info.components["gctba"].requires = ["gc"] + + if self.options.cplusplus: + self.cpp_info.components["gccpp"].set_property("cmake_target_name", "BDWgc::gccpp") + self.cpp_info.components["gccpp"].libs = ["gccpp"] + self.cpp_info.components["gccpp"].requires = ["gc"] + + if self.options.cord: + self.cpp_info.components["cord"].set_property("cmake_target_name", "BDWgc::cord") + self.cpp_info.components["cord"].libs = ["cord"] + self.cpp_info.components["cord"].requires = ["gc"] diff --git a/recipes/bdwgc/all/patches/update-cmake.patch b/recipes/bdwgc/all/patches/update-cmake-8_0_4.patch similarity index 99% rename from recipes/bdwgc/all/patches/update-cmake.patch rename to recipes/bdwgc/all/patches/update-cmake-8_0_4.patch index 35f75a11f629a..1af6e770494fc 100644 --- a/recipes/bdwgc/all/patches/update-cmake.patch +++ b/recipes/bdwgc/all/patches/update-cmake-8_0_4.patch @@ -1,6 +1,6 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -21,241 +21,596 @@ +@@ -21,241 +21,603 @@ # this will generate gc.sln # @@ -335,7 +335,14 @@ + include_directories(${Threads_INCLUDE_DIR}) + set(THREADDLLIBS ${CMAKE_THREAD_LIBS_INIT}) + endif() -+ include_directories(libatomic_ops/src) ++ if (MSVC) ++ find_package(Atomic_ops CONFIG) ++ if (Atomic_ops_FOUND) ++ get_target_property(AO_INCLUDE_DIRS Atomic_ops::atomic_ops ++ INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${AO_INCLUDE_DIRS}) ++ endif() ++ endif() + if (NOT (APPLE OR CYGWIN OR MSYS OR WIN32 OR HOST MATCHES mips-.*-irix6.*)) + set(THREADDLLIBS ${THREADDLLIBS} -ldl) + # The predefined CMAKE_DL_LIBS may be broken. diff --git a/recipes/bdwgc/all/patches/update-cmake-8_0_6.patch b/recipes/bdwgc/all/patches/update-cmake-8_0_6.patch index 97f0276e5915d..10451ed429544 100644 --- a/recipes/bdwgc/all/patches/update-cmake-8_0_6.patch +++ b/recipes/bdwgc/all/patches/update-cmake-8_0_6.patch @@ -1,6 +1,6 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -21,232 +21,592 @@ +@@ -21,232 +21,599 @@ # this will generate gc.sln # @@ -321,7 +321,14 @@ + include_directories(${Threads_INCLUDE_DIR}) + set(THREADDLLIBS ${CMAKE_THREAD_LIBS_INIT}) + endif() -+ include_directories(libatomic_ops/src) ++ if (MSVC) ++ find_package(Atomic_ops CONFIG) ++ if (Atomic_ops_FOUND) ++ get_target_property(AO_INCLUDE_DIRS Atomic_ops::atomic_ops ++ INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${AO_INCLUDE_DIRS}) ++ endif() ++ endif() + if (NOT (APPLE OR CYGWIN OR MSYS OR WIN32 OR HOST MATCHES mips-.*-irix6.*)) + set(THREADDLLIBS ${THREADDLLIBS} -ldl) + # The predefined CMAKE_DL_LIBS may be broken. diff --git a/recipes/bdwgc/all/patches/update-cmake-8_2_2.patch b/recipes/bdwgc/all/patches/update-cmake-8_2_2.patch new file mode 100644 index 0000000000000..3d721c976bf45 --- /dev/null +++ b/recipes/bdwgc/all/patches/update-cmake-8_2_2.patch @@ -0,0 +1,15 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -161,6 +161,12 @@ if (enable_threads) + message(STATUS "Thread library: ${CMAKE_THREAD_LIBS_INIT}") + if (without_libatomic_ops OR BORLAND OR MSVC OR WATCOM) + include_directories(libatomic_ops/src) ++ find_package(Atomic_ops CONFIG) ++ if (Atomic_ops_FOUND) ++ get_target_property(AO_INCLUDE_DIRS Atomic_ops::atomic_ops ++ INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${AO_INCLUDE_DIRS}) ++ endif() + # Note: alternatively, use CFLAGS_EXTRA to pass -I<...>/libatomic_ops/src. + else() + # Assume the compiler supports GCC atomic intrinsics. diff --git a/recipes/bdwgc/all/test_package/CMakeLists.txt b/recipes/bdwgc/all/test_package/CMakeLists.txt index 7b9b613cbb24a..6b8623ba2be96 100644 --- a/recipes/bdwgc/all/test_package/CMakeLists.txt +++ b/recipes/bdwgc/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(BDWgc CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE BDWgc::gc) diff --git a/recipes/bdwgc/all/test_package/conanfile.py b/recipes/bdwgc/all/test_package/conanfile.py index b5ecfa88d3a13..fde7967ed16f1 100644 --- a/recipes/bdwgc/all/test_package/conanfile.py +++ b/recipes/bdwgc/all/test_package/conanfile.py @@ -1,10 +1,19 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package_multi", "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,5 +21,5 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin","test_package"), run_environment=True) + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/bdwgc/all/test_v1_package/CMakeLists.txt b/recipes/bdwgc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8ab3169f9e927 --- /dev/null +++ b/recipes/bdwgc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(BDWgc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE BDWgc::gc) diff --git a/recipes/bdwgc/all/test_v1_package/conanfile.py b/recipes/bdwgc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..dfe389167a895 --- /dev/null +++ b/recipes/bdwgc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake +from conan.tools.build import cross_building + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake_find_package_multi", "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + self.run(os.path.join("bin","test_package"), run_environment=True) diff --git a/recipes/bdwgc/config.yml b/recipes/bdwgc/config.yml index 1f22cca255b0c..a32355f74df3f 100644 --- a/recipes/bdwgc/config.yml +++ b/recipes/bdwgc/config.yml @@ -3,3 +3,5 @@ versions: folder: all "8.0.6": folder: all + "8.2.2": + folder: all diff --git a/recipes/benchmark/all/CMakeLists.txt b/recipes/benchmark/all/CMakeLists.txt deleted file mode 100644 index 08bd91ff0594a..0000000000000 --- a/recipes/benchmark/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") - include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -else() - include(conanbuildinfo.cmake) -endif() -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/benchmark/all/conandata.yml b/recipes/benchmark/all/conandata.yml index bcab7bca71fa9..115dd22fdab4a 100644 --- a/recipes/benchmark/all/conandata.yml +++ b/recipes/benchmark/all/conandata.yml @@ -1,13 +1,16 @@ sources: - "1.5.6": - url: "https://github.com/google/benchmark/archive/v1.5.6.tar.gz" - sha256: "789f85b4810d13ff803834ea75999e41b326405d83d6a538baf01499eda96102" - "1.6.0": - url: "https://github.com/google/benchmark/archive/v1.6.0.tar.gz" - sha256: "1f71c72ce08d2c1310011ea6436b31e39ccab8c2db94186d26657d41747c85d6" - "1.6.1": - url: "https://github.com/google/benchmark/archive/v1.6.1.tar.gz" - sha256: "6132883bc8c9b0df5375b16ab520fac1a85dc9e4cf5be59480448ece74b278d4" + "1.7.0": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.7.0.tar.gz" + sha256: "3aff99169fa8bdee356eaa1f691e835a6e57b1efeadb8a0f9f228531158246ac" "1.6.2": url: "https://github.com/google/benchmark/archive/v1.6.2.tar.gz" sha256: "a9f77e6188c1cd4ebedfa7538bf5176d6acc72ead6f456919e5f464ef2f06158" + "1.6.1": + url: "https://github.com/google/benchmark/archive/v1.6.1.tar.gz" + sha256: "6132883bc8c9b0df5375b16ab520fac1a85dc9e4cf5be59480448ece74b278d4" + "1.6.0": + url: "https://github.com/google/benchmark/archive/v1.6.0.tar.gz" + sha256: "1f71c72ce08d2c1310011ea6436b31e39ccab8c2db94186d26657d41747c85d6" + "1.5.6": + url: "https://github.com/google/benchmark/archive/v1.5.6.tar.gz" + sha256: "789f85b4810d13ff803834ea75999e41b326405d83d6a538baf01499eda96102" diff --git a/recipes/benchmark/all/conanfile.py b/recipes/benchmark/all/conanfile.py index fbabb91905a8c..6b7ecc174442b 100644 --- a/recipes/benchmark/all/conanfile.py +++ b/recipes/benchmark/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.build import 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.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class BenchmarkConan(ConanFile): @@ -13,10 +17,8 @@ class BenchmarkConan(ConanFile): url = "https://github.com/conan-io/conan-center-index/" homepage = "https://github.com/google/benchmark" license = "Apache-2.0" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = "arch", "build_type", "compiler", "os" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -30,71 +32,80 @@ class BenchmarkConan(ConanFile): "enable_exceptions": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version.value) <= 12: - raise ConanInvalidConfiguration("{} {} does not support Visual Studio <= 12".format(self.name, self.version)) def configure(self): if self.options.shared: - del self.options.fPIC - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Windows shared builds are not supported right now, see issue #639") + try: + del self.options.fPIC + except Exception: + pass - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def layout(self): + cmake_layout(self, src_folder="src") - self._cmake.definitions["BENCHMARK_ENABLE_TESTING"] = "OFF" - self._cmake.definitions["BENCHMARK_ENABLE_GTEST_TESTS"] = "OFF" - self._cmake.definitions["BENCHMARK_ENABLE_LTO"] = "ON" if self.options.enable_lto else "OFF" - self._cmake.definitions["BENCHMARK_ENABLE_EXCEPTIONS"] = "ON" if self.options.enable_exceptions else "OFF" + 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: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support msvc shared builds") + 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["BENCHMARK_ENABLE_TESTING"] = "OFF" + tc.variables["BENCHMARK_ENABLE_GTEST_TESTS"] = "OFF" + tc.variables["BENCHMARK_ENABLE_LTO"] = self.options.enable_lto + tc.variables["BENCHMARK_ENABLE_EXCEPTIONS"] = self.options.enable_exceptions + if Version(self.version) >= "1.6.1": + tc.variables["BENCHMARK_ENABLE_WERROR"] = False + tc.variables["BENCHMARK_FORCE_WERROR"] = False if self.settings.os != "Windows": if cross_building(self): - self._cmake.definitions["HAVE_STD_REGEX"] = False - self._cmake.definitions["HAVE_POSIX_REGEX"] = False - self._cmake.definitions["HAVE_STEADY_CLOCK"] = False - self._cmake.definitions["BENCHMARK_USE_LIBCXX"] = "ON" if self.settings.compiler.get_safe("libcxx") == "libc++" else "OFF" + tc.variables["HAVE_STD_REGEX"] = False + tc.variables["HAVE_POSIX_REGEX"] = False + tc.variables["HAVE_STEADY_CLOCK"] = False + tc.variables["BENCHMARK_USE_LIBCXX"] = self.settings.compiler.get_safe("libcxx") == "libc++" else: - self._cmake.definitions["BENCHMARK_USE_LIBCXX"] = "OFF" - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["BENCHMARK_USE_LIBCXX"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig')) - tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake')) - tools.rmdir(os.path.join(self.package_folder, 'share')) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = ["benchmark", "benchmark_main"] + self.cpp_info.set_property("cmake_file_name", "benchmark") + self.cpp_info.set_property("pkg_config_name", "benchmark") + + self.cpp_info.components["_benchmark"].set_property("cmake_target_name", "benchmark::benchmark") + self.cpp_info.components["_benchmark"].libs = ["benchmark"] + if Version(self.version) >= "1.7.0" and not self.options.shared: + self.cpp_info.components["_benchmark"].defines.append("BENCHMARK_STATIC_DEFINE") if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs.extend(["pthread", "rt"]) + self.cpp_info.components["_benchmark"].system_libs.extend(["pthread", "rt"]) elif self.settings.os == "Windows": - self.cpp_info.system_libs.append("shlwapi") + self.cpp_info.components["_benchmark"].system_libs.append("shlwapi") elif self.settings.os == "SunOS": - self.cpp_info.system_libs.append("kstat") + self.cpp_info.components["_benchmark"].system_libs.append("kstat") + + self.cpp_info.components["benchmark_main"].set_property("cmake_target_name", "benchmark::benchmark_main") + self.cpp_info.components["benchmark_main"].libs = ["benchmark_main"] + self.cpp_info.components["benchmark_main"].requires = ["_benchmark"] + + # workaround to have all components in CMakeDeps of downstream recipes + self.cpp_info.set_property("cmake_target_name", "benchmark::benchmark_main") diff --git a/recipes/benchmark/all/test_package/CMakeLists.txt b/recipes/benchmark/all/test_package/CMakeLists.txt index 196188113685c..58358ea09a5db 100644 --- a/recipes/benchmark/all/test_package/CMakeLists.txt +++ b/recipes/benchmark/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(benchmark REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE benchmark::benchmark benchmark::benchmark_main) diff --git a/recipes/benchmark/all/test_package/conanfile.py b/recipes/benchmark/all/test_package/conanfile.py index d882f9a0f3178..0a6bc68712d90 100644 --- a/recipes/benchmark/all/test_package/conanfile.py +++ b/recipes/benchmark/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -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, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): 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.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/benchmark/all/test_v1_package/CMakeLists.txt b/recipes/benchmark/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..3a15245dc7e07 --- /dev/null +++ b/recipes/benchmark/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(benchmark REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE benchmark::benchmark benchmark::benchmark_main) diff --git a/recipes/benchmark/all/test_v1_package/conanfile.py b/recipes/benchmark/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/benchmark/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", "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/benchmark/config.yml b/recipes/benchmark/config.yml index 75621c0323825..29d13bedc4f34 100644 --- a/recipes/benchmark/config.yml +++ b/recipes/benchmark/config.yml @@ -1,9 +1,11 @@ versions: - "1.5.6": + "1.7.0": folder: all - "1.6.0": + "1.6.2": folder: all "1.6.1": folder: all - "1.6.2": + "1.6.0": + folder: all + "1.5.6": folder: all diff --git a/recipes/bison/all/conandata.yml b/recipes/bison/all/conandata.yml index cab26f5d149a0..67b0780a7f658 100644 --- a/recipes/bison/all/conandata.yml +++ b/recipes/bison/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.8.2": + url: "https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.gz" + sha256: "06c9e13bdf7eb24d4ceb6b59205a4f67c2c7e7213119644430fe82fbd14a0abb" "3.7.6": url: "https://ftp.gnu.org/gnu/bison/bison-3.7.6.tar.gz" sha256: "69dc0bb46ea8fc307d4ca1e0b61c8c355eb207d0b0c69f4f8462328e74d7b9ea" @@ -9,6 +12,13 @@ sources: url: "https://ftp.gnu.org/gnu/bison/bison-3.5.3.tar.gz" sha256: "34e201d963156618a0ea5bc87220f660a1e08403dd3c7c7903d4f38db3f40039" 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_file: "patches/0002-3.7.6-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" + base_path: "source_subfolder" + - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" + base_path: "source_subfolder" "3.7.6": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" base_path: "source_subfolder" diff --git a/recipes/bison/all/conanfile.py b/recipes/bison/all/conanfile.py index e52d761c606cd..86d0e584d5c46 100644 --- a/recipes/bison/all/conanfile.py +++ b/recipes/bison/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools +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 import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class BisonConan(ConanFile): @@ -43,16 +46,20 @@ def configure(self): 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") + 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.4") + self.build_requires("automake/1.16.5") if self.settings.os != "Windows": self.build_requires("flex/2.6.4") 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 @@ -105,31 +112,30 @@ def _configure_autotools(self): return self._autotools def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.settings.os == "Windows": # replace embedded unix paths by windows paths - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "echo '#define BINDIR \"$(bindir)\"';", "echo '#define BINDIR \"$(shell cygpath -m \"$(bindir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "echo '#define PKGDATADIR \"$(pkgdatadir)\"';", "echo '#define PKGDATADIR \"$(shell cygpath -m \"$(pkgdatadir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "echo '#define DATADIR \"$(datadir)\"';", "echo '#define DATADIR \"$(shell cygpath -m \"$(datadir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "echo '#define DATAROOTDIR \"$(datarootdir)\"';", "echo '#define DATAROOTDIR \"$(shell cygpath -m \"$(datarootdir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "dist_man_MANS = $(top_srcdir)/doc/bison.1", "dist_man_MANS =") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "yacc.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "src", "yacc.in"), "@prefix@", "${}_ROOT".format(self.name.upper())) - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "yacc.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "src", "yacc.in"), "@bindir@", "${}_ROOT/bin".format(self.name.upper())) diff --git a/recipes/bison/all/patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch b/recipes/bison/all/patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch new file mode 100644 index 0000000000000..b40517e5083c9 --- /dev/null +++ b/recipes/bison/all/patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch @@ -0,0 +1,29 @@ +From dffa2a21edeba243ef76b75e0c2081ec15fe95bd Mon Sep 17 00:00:00 2001 +From: SSE4 +Date: Wed, 3 Apr 2019 19:48:12 +0700 +Subject: [PATCH 3/4] 0003 + +--- + lib/spawn-pipe.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/spawn-pipe.c b/lib/spawn-pipe.c +index 3af5167..09e9cad 100644 +--- a/lib/spawn-pipe.c ++++ b/lib/spawn-pipe.c +@@ -213,10 +213,10 @@ create_pipe (const char *progname, + xalloc_die (); + + if (pipe_stdout) +- if (pipe2_safer (ifd, O_BINARY | O_CLOEXEC) < 0) ++ if (pipe2_safer (ifd, O_TEXT | O_CLOEXEC) < 0) + error (EXIT_FAILURE, errno, _("cannot create pipe")); + if (pipe_stdin) +- if (pipe2_safer (ofd, O_BINARY | O_CLOEXEC) < 0) ++ if (pipe2_safer (ofd, O_TEXT | O_CLOEXEC) < 0) + error (EXIT_FAILURE, errno, _("cannot create pipe")); + /* Data flow diagram: + * +-- +2.7.4.windows.1 + diff --git a/recipes/bison/config.yml b/recipes/bison/config.yml index c06b3140cfec4..7e22e455ae51e 100644 --- a/recipes/bison/config.yml +++ b/recipes/bison/config.yml @@ -1,4 +1,6 @@ versions: + "3.8.2": + folder: all "3.7.6": folder: all "3.7.1": diff --git a/recipes/bitflags/all/conandata.yml b/recipes/bitflags/all/conandata.yml new file mode 100644 index 0000000000000..2abe2034e3c41 --- /dev/null +++ b/recipes/bitflags/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.5.0": + url: "https://github.com/m-peko/bitflags/archive/refs/tags/v1.5.0.tar.gz" + sha256: 1ea19e03e05e8e78faf0126a1a100e591467828bc816224e9cda330b104e69b5 diff --git a/recipes/bitflags/all/conanfile.py b/recipes/bitflags/all/conanfile.py new file mode 100644 index 0000000000000..c9f1d462a3694 --- /dev/null +++ b/recipes/bitflags/all/conanfile.py @@ -0,0 +1,59 @@ +import os + +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 +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.50.0" + + +class BitFlags(ConanFile): + name = "bitflags" + description = "Single-header header-only C++11 / C++14 / C++17 library for easily managing set of auto-generated type-safe flags" + topics = ("bits", "bitflags", "header-only") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/m-peko/bitflags" + license = "MIT" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_compilers_version(self): + return {"apple-clang": "5", "clang": "5", "gcc": "7", "Visual Studio": "14"} + + @property + def _minimum_cpp_standard(self): + return 11 + + def layout(self): + basic_layout(self) + + 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) + try: + if Version(self.settings.compiler.version) < self._minimum_compilers_version[str(self.settings.compiler)]: + raise ConanInvalidConfiguration(f"{self.ref} requires a compiler that supports C++{self._minimum_cpp_standard}.") + except KeyError: + self.output.warn("Unknown compiler encountered. Assuming it supports C++11.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=self.source_folder) + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "bitflags") + self.cpp_info.set_property("cmake_target_name", "bitflags::bitflags") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/bitflags/all/test_package/CMakeLists.txt b/recipes/bitflags/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..51b69634fef26 --- /dev/null +++ b/recipes/bitflags/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +find_package(bitflags REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE bitflags::bitflags) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bitflags/all/test_package/conanfile.py b/recipes/bitflags/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e506c322ce801 --- /dev/null +++ b/recipes/bitflags/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, cmake_layout + +required_conan_version = ">=1.50.0" + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/bitflags/all/test_package/test_package.cpp b/recipes/bitflags/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..91a9730c23c5a --- /dev/null +++ b/recipes/bitflags/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include "bitflags/bitflags.hpp" +#include +#include + +BEGIN_BITFLAGS(Flags) +FLAG(none) +FLAG(flag_a) +FLAG(flag_b) +FLAG(flag_c) +END_BITFLAGS(Flags) + +DEFINE_FLAG(Flags, none) +DEFINE_FLAG(Flags, flag_a) +DEFINE_FLAG(Flags, flag_b) +DEFINE_FLAG(Flags, flag_c) + +int main() { + std::cout << +Flags::none.bits << " - " << Flags::none.name << '\n'; + std::cout << +Flags::flag_a.bits << " - " << Flags::flag_a.name << '\n'; + std::cout << +Flags::flag_b.bits << " - " << Flags::flag_b.name << '\n'; + std::cout << +Flags::flag_c.bits << " - " << Flags::flag_c.name << '\n'; + + const auto flags = Flags::flag_a | Flags::flag_b; + + assert(flags & Flags::flag_a); + assert(!(flags & Flags::flag_c)); +} diff --git a/recipes/bitflags/all/test_v1_package/CMakeLists.txt b/recipes/bitflags/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..789568c184c15 --- /dev/null +++ b/recipes/bitflags/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(bitflags REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE bitflags::bitflags) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bitflags/all/test_v1_package/conanfile.py b/recipes/bitflags/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/bitflags/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bitflags/config.yml b/recipes/bitflags/config.yml new file mode 100644 index 0000000000000..16b5c7979d806 --- /dev/null +++ b/recipes/bitflags/config.yml @@ -0,0 +1,3 @@ +versions: + "1.5.0": + folder: "all" diff --git a/recipes/boost-ext-ut/all/conanfile.py b/recipes/boost-ext-ut/all/conanfile.py index df8a7ffd45545..bce6579a06de7 100644 --- a/recipes/boost-ext-ut/all/conanfile.py +++ b/recipes/boost-ext-ut/all/conanfile.py @@ -3,12 +3,12 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import check_min_vs, is_msvc from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class UTConan(ConanFile): @@ -37,8 +37,7 @@ def _minimum_compilers_version(self): } def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, patch["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if Version(self.version) <= "1.1.8": @@ -47,13 +46,13 @@ def config_options(self): self.options.disable_module = True def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) if Version(self.version) <= "1.1.8" and is_msvc(self): - raise ConanInvalidConfiguration(f"{self.name} version 1.1.8 may not be built with MSVC. " + raise ConanInvalidConfiguration(f"{self.ref} may not be built with MSVC. " "Please use at least version 1.1.9 with MSVC.") if is_msvc(self): @@ -64,12 +63,12 @@ def validate(self): min_version = self._minimum_compilers_version.get( str(self.settings.compiler)) if not min_version: - self.output.warn(f"{self.name} recipe lacks information about the {self.settings.compiler} " + self.output.warn(f"{self.ref} recipe lacks information about the {self.settings.compiler} " "compiler support.") else: if Version(self.settings.compiler.version) < min_version: raise ConanInvalidConfiguration( - f"{self.name} requires C++{self._minimum_cpp_standard} support. " + f"{self.ref} requires C++{self._minimum_cpp_standard} support. " f"The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it.") def source(self): @@ -102,17 +101,19 @@ def package_id(self): self.info.clear() def package_info(self): + newer_than_1_1_8 = Version(self.version) > "1.1.8" + namespace = "Boost" if newer_than_1_1_8 else "boost" self.cpp_info.set_property("cmake_file_name", "ut") - self.cpp_info.set_property("cmake_target_name", "boost::ut") + self.cpp_info.set_property("cmake_target_name", f"{namespace}::ut") - self.cpp_info.names["cmake_find_package"] = "boost" - self.cpp_info.names["cmake_find_package_multi"] = "boost" + self.cpp_info.names["cmake_find_package"] = namespace + self.cpp_info.names["cmake_find_package_multi"] = namespace self.cpp_info.filenames["cmake_find_package"] = "ut" self.cpp_info.filenames["cmake_find_package_multi"] = "ut" self.cpp_info.components["ut"].names["cmake_find_package"] = "ut" self.cpp_info.components["ut"].names["cmake_find_package_multi"] = "ut" - if Version(self.version) > "1.1.8": + if newer_than_1_1_8: self.cpp_info.components["ut"].includedirs = [os.path.join("include", "ut-" + self.version, "include")] if self.options.get_safe("disable_module"): diff --git a/recipes/boost-ext-ut/all/test_package/CMakeLists.txt b/recipes/boost-ext-ut/all/test_package/CMakeLists.txt index 99ad6ec453970..1f234990a3bc2 100644 --- a/recipes/boost-ext-ut/all/test_package/CMakeLists.txt +++ b/recipes/boost-ext-ut/all/test_package/CMakeLists.txt @@ -1,11 +1,13 @@ -cmake_minimum_required(VERSION 3.16) -project(test_package) - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED yes) -set(CMAKE_CXX_EXTENSIONS no) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) find_package(ut REQUIRED CONFIG) +set(namespace Boost) +if(ut_VERSION VERSION_LESS "1.1.9") + set(namespace boost) +endif() + add_executable(test_package test_package.cpp) -target_link_libraries(test_package PRIVATE boost::ut) +target_link_libraries(test_package PRIVATE "${namespace}::ut") +target_compile_features(test_package PRIVATE cxx_std_20) diff --git a/recipes/boost-ext-ut/all/test_package/conanfile.py b/recipes/boost-ext-ut/all/test_package/conanfile.py index 87a7297528bf3..cb68885270b30 100644 --- a/recipes/boost-ext-ut/all/test_package/conanfile.py +++ b/recipes/boost-ext-ut/all/test_package/conanfile.py @@ -8,6 +8,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/boost-ext-ut/all/test_v1_package/CMakeLists.txt b/recipes/boost-ext-ut/all/test_v1_package/CMakeLists.txt index 05c457be73ade..b3e2caed93a69 100644 --- a/recipes/boost-ext-ut/all/test_v1_package/CMakeLists.txt +++ b/recipes/boost-ext-ut/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,16 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package) - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED yes) -set(CMAKE_CXX_EXTENSIONS no) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) find_package(ut REQUIRED CONFIG) +set(namespace Boost) +if(ut_VERSION VERSION_LESS "1.1.9") + set(namespace boost) +endif() + add_executable(test_package ../test_package/test_package.cpp) -target_link_libraries(test_package boost::ut) +target_link_libraries(test_package PRIVATE "${namespace}::ut") +target_compile_features(test_package PRIVATE cxx_std_20) diff --git a/recipes/boost/all/conandata.yml b/recipes/boost/all/conandata.yml index 3798685661eda..ca9313ee3988b 100644 --- a/recipes/boost/all/conandata.yml +++ b/recipes/boost/all/conandata.yml @@ -58,6 +58,12 @@ sources: "https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.bz2" ] sha256: "475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39" + 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" + ] + sha256: "1e19565d82e43bc59209a168f5ac899d3ba471d55c7610c677d4ccf2c9c500c0" patches: 1.70.0: - patch_file: "patches/0001-beast-fix-moved-from-executor.patch" @@ -240,5 +246,33 @@ patches: - patch_file: "patches/1.79.0-geometry_no_rtti.patch" base_path: "source_subfolder" patch_type: "portability" - url: "https://github.com/boostorg/geometry/commit/b354162798749b3aaa539755e7b9be49d2b9a9c4.patch" patch_source: "https://github.com/boostorg/geometry/discussions/1041" + 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" + patch_type: "conan" + base_path: "source_subfolder" + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + base_path: "source_subfolder" + - patch_file: "patches/1.80.0-0001-filesystem-win-fix-dir-it-net-share.patch" + patch_description: "Directory iterators may fail to construct for a network share on Windows prior to 10" + patch_type: "official" + patch_source: "https://github.com/boostorg/filesystem/issues/245" + base_path: "source_subfolder" + - patch_file: "patches/1.80.0-0002-filesystem-fix-weakly-canonical-long-path.patch" + patch_description: 'On Windows, weakly_canonical fails to process paths that start with the "\\?\" prefix' + patch_type: "official" + patch_source: "https://github.com/boostorg/filesystem/issues/247" + base_path: "source_subfolder" + - patch_file: "patches/1.80.0-0003-unordered-valid-after-move.patch" + patch_description: "Containers are not in a valid state after moving" + patch_type: "official" + patch_source: "https://github.com/boostorg/unordered/issues/139" + base_path: "source_subfolder" + - patch_file: "patches/1.80.0-0004-filesystem-posix-fix-no-at-apis-missing-include.patch" + patch_description: "On POSIX systems that don't support *at APIs, compilation fails due to a missing include" + patch_type: "official" + patch_source: "https://github.com/boostorg/filesystem/issues/250" + base_path: "source_subfolder" diff --git a/recipes/boost/all/conanfile.py b/recipes/boost/all/conanfile.py index 0342414637931..cc2f76d2b6808 100644 --- a/recipes/boost/all/conanfile.py +++ b/recipes/boost/all/conanfile.py @@ -253,6 +253,10 @@ def _python_executable(self): def _is_windows_platform(self): return self.settings.os in ["Windows", "WindowsStore", "WindowsCE"] + @property + def _is_apple_embedded_platform(self): + return self.settings.os in ["iOS", "watchOS", "tvOS"] + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -359,7 +363,7 @@ def _shared(self): @property def _stacktrace_addr2line_available(self): - if (self.settings.os in ["iOS", "watchOS", "tvOS"] or self.settings.get_safe("os.subsystem") == "catalyst"): + if (self._is_apple_embedded_platform or self.settings.get_safe("os.subsystem") == "catalyst"): # sandboxed environment - cannot launch external processes (like addr2line), system() function is forbidden return False return not self.options.header_only and not self.options.without_stacktrace and self.settings.os != "Windows" @@ -969,7 +973,7 @@ def _build_flags(self): flags.append("numa=on") # https://www.boost.org/doc/libs/1_70_0/libs/context/doc/html/context/architectures.html - if self._b2_os: + if not self._is_apple_embedded_platform and self._b2_os: flags.append(f"target-os={self._b2_os}") if self._b2_architecture: flags.append(f"architecture={self._b2_architecture}") @@ -1277,6 +1281,9 @@ def create_library_config(deps_name, name): if asflags.strip(): contents += f'"{asflags.strip()}" ' + if self._is_apple_embedded_platform: + contents += f'"{self._b2_os}" ' + contents += " ;" self.output.warn(contents) diff --git a/recipes/boost/all/dependencies/dependencies-1.80.0.yml b/recipes/boost/all/dependencies/dependencies-1.80.0.yml new file mode 100644 index 0000000000000..4cabd8ca5c44d --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.80.0.yml @@ -0,0 +1,275 @@ +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 +- 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 + 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 + 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.80.0 diff --git a/recipes/boost/all/patches/1.80.0-0001-filesystem-win-fix-dir-it-net-share.patch b/recipes/boost/all/patches/1.80.0-0001-filesystem-win-fix-dir-it-net-share.patch new file mode 100644 index 0000000000000..0d28b86bb670c --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0001-filesystem-win-fix-dir-it-net-share.patch @@ -0,0 +1,31 @@ +commit 9c9d127bddc2b72187c57f4933c49666255d7a4f +Author: Olavo Belloc +Date: Mon Aug 8 10:54:02 2022 +0200 + + Limit the buffer size for compatibility with previous versions of Windows + + The reported error was reproduced on Windows 7 and 8.1, but not on an early + version of Windows 10 (2004). + + Closes https://github.com/boostorg/filesystem/pull/246. + Likely fixes https://github.com/boostorg/filesystem/issues/245. + +diff --git a/libs/filesystem/src/directory.cpp b/libs/filesystem/src/directory.cpp +index 6a3e1dc..9334893 100644 +--- a/libs/filesystem/src/directory.cpp ++++ b/libs/filesystem/src/directory.cpp +@@ -599,9 +599,12 @@ extra_data_format g_extra_data_format = file_directory_information_format; + * \brief Extra buffer size for GetFileInformationByHandleEx-based or NtQueryDirectoryFile-based directory iterator. + * + * Must be large enough to accommodate at least one FILE_DIRECTORY_INFORMATION or *_DIR_INFO struct and one filename. +- * NTFS, VFAT, exFAT support filenames up to 255 UTF-16/UCS-2 characters. ReFS supports filenames up to 32768 UTF-16 characters. ++ * NTFS, VFAT, exFAT and ReFS support filenames up to 255 UTF-16/UCS-2 characters. (For ReFS, there is no information ++ * on the on-disk format, and it is possible that it supports longer filenames, up to 32768 UTF-16/UCS-2 characters.) ++ * The buffer cannot be larger than 64k, because up to Windows 8.1, NtQueryDirectoryFile and GetFileInformationByHandleEx ++ * fail with ERROR_INVALID_PARAMETER when trying to retrieve the filenames from a network share. + */ +-BOOST_CONSTEXPR_OR_CONST std::size_t dir_itr_extra_size = sizeof(file_id_extd_dir_info) + 65536u; ++BOOST_CONSTEXPR_OR_CONST std::size_t dir_itr_extra_size = 65536u; + + inline system::error_code dir_itr_close(dir_itr_imp& imp) BOOST_NOEXCEPT + { diff --git a/recipes/boost/all/patches/1.80.0-0002-filesystem-fix-weakly-canonical-long-path.patch b/recipes/boost/all/patches/1.80.0-0002-filesystem-fix-weakly-canonical-long-path.patch new file mode 100644 index 0000000000000..9312059a60000 --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0002-filesystem-fix-weakly-canonical-long-path.patch @@ -0,0 +1,171 @@ +commit 476ca7b6c1d37a5d796f8525813a9a64c9e54ffc +Author: Andrey Semashev +Date: Wed Aug 10 04:57:21 2022 +0300 + + Fix weakly_canonical on Windows with long paths prefix. + + During its operation, weakly_canonical would call status() on the path + consisting only from the root name of the input path. This would fail + with ERROR_INVALID_FUNCTION if the root name starts with the "\\?\" prefix, + as the root name path is not absolute. + + To fix this, we don't check the status of the root name path (which is + not the correct check anyways as it tests the current directory on the + corresponding drive for existence, which is not what we want). Additionally, + avoid calling status() on the paths containing dot and dot-dot elements + during the weakly_canonical execution for the same reason - the "\\?\" + prefix disables most of the path processing in Windows APIs, including + dot and dot-dot elements resolution. + + Fixes https://github.com/boostorg/filesystem/issues/247. + +diff --git a/libs/filesystem/src/operations.cpp b/libs/filesystem/src/operations.cpp +index dd636e9..ca2fff3 100644 +--- a/libs/filesystem/src/operations.cpp ++++ b/libs/filesystem/src/operations.cpp +@@ -4434,7 +4434,7 @@ path weakly_canonical(path const& p, path const& base, system::error_code* ec) + path head(p); + for (; !head.empty(); --itr) + { +- file_status head_status = detail::status_impl(head, &local_ec); ++ file_status head_status(detail::status_impl(head, &local_ec)); + if (BOOST_UNLIKELY(head_status.type() == fs::status_error)) + { + if (!ec) +@@ -4450,32 +4450,83 @@ path weakly_canonical(path const& p, path const& base, system::error_code* ec) + head.remove_filename(); + } + ++ if (head.empty()) ++ return p.lexically_normal(); ++ ++ path const& dot_p = dot_path(); ++ path const& dot_dot_p = dot_dot_path(); ++ + #else + +- // On Windows, filesystem APIs such as GetFileAttributesW perform lexical path normalization internally. +- // As a result, a path like "c:\a\.." can be reported as present even if "c:\a" is not. This would break +- // canonical, as symlink_status that it calls internally would report an error that the file at the intermediate +- // path does not exist. To avoid this, scan the initial path in the forward direction. +- // Also, operate on paths with preferred separators. This can be important on Windows since GetFileAttributesW, +- // which is called in status() may return "file not found" for paths to network shares and mounted cloud +- // storages that have forward slashes as separators. ++ // On Windows, filesystem APIs such as GetFileAttributesW and CreateFileW perform lexical path normalization ++ // internally. As a result, a path like "c:\a\.." can be reported as present even if "c:\a" is not. This would ++ // break canonical, as symlink_status that it calls internally would report an error that the file at the ++ // intermediate path does not exist. To avoid this, scan the initial path in the forward direction. ++ // Also, operate on paths with preferred separators. This can be important on Windows since GetFileAttributesW ++ // or CreateFileW, which is called in status() may return "file not found" for paths to network shares and ++ // mounted cloud storages that have forward slashes as separators. ++ // Also, avoid querying status of the root name such as \\?\c: as CreateFileW returns ERROR_INVALID_FUNCTION for ++ // such path. Querying the status of a root name such as c: is also not right as this path refers to the current ++ // directory on drive C:, which is not what we want to test for existence anyway. + path::iterator itr(p.begin()); + path head; +- for (; itr != p_end; ++itr) ++ if (p.has_root_name()) + { +- path const& p_elem = *itr; +- if (p_elem.size() == 1u && detail::is_directory_separator(p_elem.native()[0])) ++ BOOST_ASSERT(itr != p_end); ++ head = *itr; ++ ++itr; ++ } ++ ++ if (p.has_root_directory()) ++ { ++ BOOST_ASSERT(itr != p_end); ++ // Convert generic separator returned by the iterator for the root directory to ++ // the preferred separator. ++ head += path::preferred_separator; ++ ++itr; ++ } ++ ++ if (!head.empty()) ++ { ++ file_status head_status(detail::status_impl(head, &local_ec)); ++ if (BOOST_UNLIKELY(head_status.type() == fs::status_error)) + { +- // Convert generic separator returned by the iterator for the root directory to +- // the preferred separator. +- head += path::preferred_separator; ++ if (!ec) ++ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::weakly_canonical", head, local_ec)); ++ ++ *ec = local_ec; ++ return path(); + } +- else ++ ++ if (head_status.type() == fs::file_not_found) ++ { ++ // If the root path does not exist then no path element exists ++ return p.lexically_normal(); ++ } ++ } ++ ++ path const& dot_p = dot_path(); ++ path const& dot_dot_p = dot_dot_path(); ++ for (; itr != p_end; ++itr) ++ { ++ path const& p_elem = *itr; ++ ++ // Avoid querying status of paths containing dot and dot-dot elements, as this will break ++ // if the root name starts with "\\?\". ++ if (p_elem == dot_p) ++ continue; ++ ++ if (p_elem == dot_dot_p) + { +- head /= p_elem; ++ if (head.has_relative_path()) ++ head.remove_filename(); ++ ++ continue; + } + +- file_status head_status = detail::status_impl(head, &local_ec); ++ head /= p_elem; ++ ++ file_status head_status(detail::status_impl(head, &local_ec)); + if (BOOST_UNLIKELY(head_status.type() == fs::status_error)) + { + if (!ec) +@@ -4492,33 +4543,22 @@ path weakly_canonical(path const& p, path const& base, system::error_code* ec) + } + } + ++ if (head.empty()) ++ return p.lexically_normal(); ++ + #endif + +- path const& dot_p = dot_path(); +- path const& dot_dot_p = dot_dot_path(); + path tail; + bool tail_has_dots = false; + for (; itr != p_end; ++itr) + { + path const& tail_elem = *itr; +-#if defined(BOOST_WINDOWS_API) +- if (tail_elem.size() == 1u && detail::is_directory_separator(tail_elem.native()[0])) +- { +- // Convert generic separator returned by the iterator for the root directory to +- // the preferred separator. +- tail += path::preferred_separator; +- continue; +- } +-#endif + tail /= tail_elem; + // for a later optimization, track if any dot or dot-dot elements are present + if (!tail_has_dots && (tail_elem == dot_p || tail_elem == dot_dot_p)) + tail_has_dots = true; + } + +- if (head.empty()) +- return p.lexically_normal(); +- + head = detail::canonical(head, base, &local_ec); + if (BOOST_UNLIKELY(!!local_ec)) + { diff --git a/recipes/boost/all/patches/1.80.0-0003-unordered-valid-after-move.patch b/recipes/boost/all/patches/1.80.0-0003-unordered-valid-after-move.patch new file mode 100644 index 0000000000000..4245f23e76299 --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0003-unordered-valid-after-move.patch @@ -0,0 +1,175 @@ +diff -urN a/boost/unordered/detail/fca.hpp b/boost/unordered/detail/fca.hpp +--- a/boost/unordered/detail/fca.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ b/boost/unordered/detail/fca.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -646,7 +646,7 @@ + + size_type bucket_count() const { return size_; } + +- iterator begin() const { return ++at(size_); } ++ iterator begin() const { return size_ == 0 ? end() : ++at(size_); } + + iterator end() const + { +@@ -660,6 +660,10 @@ + + local_iterator begin(size_type n) const + { ++ if (size_ == 0) { ++ return this->end(n); ++ } ++ + return local_iterator( + (buckets + static_cast(n))->next); + } +@@ -670,12 +674,16 @@ + + iterator at(size_type n) const + { +- std::size_t const N = group::N; ++ if (size_ > 0) { ++ std::size_t const N = group::N; + +- iterator pbg(buckets + static_cast(n), +- groups + static_cast(n / N)); ++ iterator pbg(buckets + static_cast(n), ++ groups + static_cast(n / N)); + +- return pbg; ++ return pbg; ++ } else { ++ return this->end(); ++ } + } + + span raw() +diff -urN a/boost/unordered/detail/implementation.hpp b/boost/unordered/detail/implementation.hpp +--- a/boost/unordered/detail/implementation.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ b/boost/unordered/detail/implementation.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -2054,12 +2054,14 @@ + + std::size_t bucket_size(std::size_t index) const + { +- bucket_iterator itb = buckets_.at(index); +- node_pointer n = itb->next; + std::size_t count = 0; +- while (n) { +- ++count; +- n = n->next; ++ if (size_ > 0) { ++ bucket_iterator itb = buckets_.at(index); ++ node_pointer n = itb->next; ++ while (n) { ++ ++count; ++ n = n->next; ++ } + } + return count; + } +@@ -2420,11 +2422,14 @@ + node_pointer find_node_impl( + Key const& x, bucket_iterator itb) const + { +- key_equal const& pred = this->key_eq(); +- node_pointer p = itb->next; +- for (; p; p = p->next) { +- if (pred(x, extractor::extract(p->value()))) { +- break; ++ node_pointer p = node_pointer(); ++ if (itb != buckets_.end()) { ++ key_equal const& pred = this->key_eq(); ++ p = itb->next; ++ for (; p; p = p->next) { ++ if (pred(x, extractor::extract(p->value()))) { ++ break; ++ } + } + } + return p; +@@ -2453,11 +2458,13 @@ + inline iterator transparent_find( + Key const& k, Hash const& h, Pred const& pred) const + { +- std::size_t const key_hash = h(k); +- bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); +- for (node_pointer p = itb->next; p; p = p->next) { +- if (BOOST_LIKELY(pred(k, extractor::extract(p->value())))) { +- return iterator(p, itb); ++ if (size_ > 0) { ++ std::size_t const key_hash = h(k); ++ bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); ++ for (node_pointer p = itb->next; p; p = p->next) { ++ if (BOOST_LIKELY(pred(k, extractor::extract(p->value())))) { ++ return iterator(p, itb); ++ } + } + } + +@@ -2467,11 +2474,13 @@ + template + node_pointer* find_prev(Key const& key, bucket_iterator itb) + { +- key_equal pred = this->key_eq(); +- for (node_pointer* pp = boost::addressof(itb->next); *pp; +- pp = boost::addressof((*pp)->next)) { +- if (pred(key, extractor::extract((*pp)->value()))) { +- return pp; ++ if (size_ > 0) { ++ key_equal pred = this->key_eq(); ++ for (node_pointer* pp = boost::addressof(itb->next); *pp; ++ pp = boost::addressof((*pp)->next)) { ++ if (pred(key, extractor::extract((*pp)->value()))) { ++ return pp; ++ } + } + } + typedef node_pointer* node_pointer_pointer; +diff -urN a/boost/unordered/unordered_map.hpp b/boost/unordered/unordered_map.hpp +--- a/boost/unordered/unordered_map.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ b/boost/unordered/unordered_map.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -2069,6 +2069,10 @@ + template + float unordered_map::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); +@@ -2506,6 +2510,10 @@ + template + float unordered_multimap::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); +diff -urN a/boost/unordered/unordered_set.hpp b/boost/unordered/unordered_set.hpp +--- a/boost/unordered/unordered_set.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ b/boost/unordered/unordered_set.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -1586,6 +1586,10 @@ + template + float unordered_set::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); +@@ -1986,6 +1990,10 @@ + template + float unordered_multiset::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); diff --git a/recipes/boost/all/patches/1.80.0-0004-filesystem-posix-fix-no-at-apis-missing-include.patch b/recipes/boost/all/patches/1.80.0-0004-filesystem-posix-fix-no-at-apis-missing-include.patch new file mode 100644 index 0000000000000..dfa4438d93acd --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0004-filesystem-posix-fix-no-at-apis-missing-include.patch @@ -0,0 +1,21 @@ +commit 5864f397ccad30f6e73221b90bdac57a303b9752 +Author: Andrey Semashev +Date: Fri Aug 12 12:59:56 2022 +0300 + + Fixed a missing include on POSIX systems that don't support *at APIs. + + Fixes https://github.com/boostorg/filesystem/issues/250. + +diff --git a/libs/filesystem/src/operations.cpp b/libs/filesystem/src/operations.cpp +index ca2fff3..e22967e 100644 +--- a/libs/filesystem/src/operations.cpp ++++ b/libs/filesystem/src/operations.cpp +@@ -70,7 +70,7 @@ + + #include + #include +-#if _POSIX_C_SOURCE < 200809L ++#if !defined(BOOST_FILESYSTEM_HAS_POSIX_AT_APIS) + #include + #endif + #include diff --git a/recipes/boost/all/patches/1.80.0-locale-fail-on-missing-backend.patch b/recipes/boost/all/patches/1.80.0-locale-fail-on-missing-backend.patch new file mode 100644 index 0000000000000..e352396226710 --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-locale-fail-on-missing-backend.patch @@ -0,0 +1,84 @@ +diff --git a/libs/locale/build/Jamfile.v2 b/libs/locale/build/Jamfile.v2 +index 3c517c884..0f521dbcf 100644 +--- a/libs/locale/build/Jamfile.v2 ++++ b/libs/locale/build/Jamfile.v2 +@@ -20,6 +20,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 ; +@@ -29,7 +30,8 @@ feature.feature boost.locale.winapi : on off : optional propagated ; + + ## iconv + +-exe has_iconv : $(TOP)/build/has_iconv.cpp ; ++obj has_iconv_libc_obj : $(TOP)/build/has_iconv.cpp ; ++exe has_iconv : has_iconv_libc_obj ; + explicit has_iconv ; + + ICONV_PATH = [ modules.peek : ICONV_PATH ] ; +@@ -43,7 +45,8 @@ lib iconv + + explicit iconv ; + +-exe has_external_iconv : $(TOP)/build/has_iconv.cpp iconv ; ++obj has_iconv_libc_ext : $(TOP)/build/has_iconv.cpp iconv ; ++exe has_external_iconv : has_iconv_libc_ext iconv ; + explicit has_external_iconv ; + + exe accepts_shared_option : $(TOP)/build/option.cpp +@@ -230,10 +233,37 @@ rule configure-full ( properties * : flags-only ) + if [ configure.builds has_iconv : $(properties) : "iconv (libc)" ] + { + found-iconv = true ; +- } else if [ configure.builds has_external_iconv : $(properties) : "iconv (separate)" ] ++ if libiconv in $(properties) ++ { ++ if [ configure.builds has_external_iconv : $(properties) : "iconv (separate)" ] ++ { ++ result += iconv ; ++ } ++ else ++ { ++ EXIT "- Boost.Locale found iconv (libc) instead of iconv (separate) library to be built." ; ++ } ++ } ++ } ++ else if libc in $(properties) + { +- found-iconv = true ; +- result += iconv ; ++ EXIT "- Boost.Locale failed to find iconv (libc) library to be built." ; ++ } ++ else ++ { ++ if [ configure.builds has_external_iconv : $(properties) : "iconv (separate)" ] ++ { ++ found-iconv = true ; ++ result += iconv ; ++ } ++ else if libiconv in $(properties) ++ { ++ EXIT "- Boost.Locale failed to find iconv (separate) library to be built." ; ++ } ++ } ++ if ! $(found-iconv) ++ { ++ EXIT "- Boost.Locale failed to find iconv library to be built." ; + } + } + if $(found-iconv) +@@ -273,6 +303,10 @@ rule configure-full ( properties * : flags-only ) + /boost/thread//boost_thread + ; + } ++ else ++ { ++ EXIT "- Boost.Locale failed to find ICU library to be built." ; ++ } + } + + if ! $(found-iconv) && ! $(found-icu) && ! windows in $(properties) && ! cygwin in $(properties) diff --git a/recipes/boost/config.yml b/recipes/boost/config.yml index a68be93f2ddb0..c2b37ebeaa9db 100644 --- a/recipes/boost/config.yml +++ b/recipes/boost/config.yml @@ -19,3 +19,5 @@ versions: folder: all 1.79.0: folder: all + 1.80.0: + folder: all diff --git a/recipes/box2d/2.4.x/CMakeLists.txt b/recipes/box2d/2.4.x/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/box2d/2.4.x/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/box2d/2.4.x/conandata.yml b/recipes/box2d/2.4.x/conandata.yml index 3e9aef1571a09..c7372e2a8f037 100644 --- a/recipes/box2d/2.4.x/conandata.yml +++ b/recipes/box2d/2.4.x/conandata.yml @@ -7,5 +7,4 @@ sources: sha256: "d6b4650ff897ee1ead27cf77a5933ea197cbeef6705638dd181adc2e816b23c2" patches: "2.4.0": - - patch_file: "patches/install-and-allow-shared.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-install-and-allow-shared.patch" diff --git a/recipes/box2d/2.4.x/conanfile.py b/recipes/box2d/2.4.x/conanfile.py index 0a37f41d13d33..ae09ce435deda 100644 --- a/recipes/box2d/2.4.x/conanfile.py +++ b/recipes/box2d/2.4.x/conanfile.py @@ -1,7 +1,10 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rm, rmdir, copy +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version -required_conan_version = ">=1.29.1" +required_conan_version = ">=1.52.0" class Box2dConan(ConanFile): @@ -16,55 +19,53 @@ class Box2dConan(ConanFile): "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True,} - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("box2d-%s" % self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BOX2D_BUILD_TESTBED"] = False - self._cmake.definitions["BOX2D_BUILD_UNIT_TESTS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.variables["BOX2D_BUILD_TESTBED"] = False + tc.variables["BOX2D_BUILD_UNIT_TESTS"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.configure() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", self.package_folder, recursive=True) def package_info(self): self.cpp_info.names["cmake_find_package"] = "box2d" self.cpp_info.names["cmake_find_package_multi"] = "box2d" self.cpp_info.libs = ["box2d"] - if tools.Version(self.version) >= "2.4.1" and self.options.shared: + if Version(self.version) >= "2.4.1" and self.options.shared: self.cpp_info.defines.append("B2_SHARED") diff --git a/recipes/box2d/2.4.x/patches/install-and-allow-shared.patch b/recipes/box2d/2.4.x/patches/0001-install-and-allow-shared.patch similarity index 100% rename from recipes/box2d/2.4.x/patches/install-and-allow-shared.patch rename to recipes/box2d/2.4.x/patches/0001-install-and-allow-shared.patch diff --git a/recipes/box2d/2.4.x/test_package/CMakeLists.txt b/recipes/box2d/2.4.x/test_package/CMakeLists.txt index 373fb5bb61846..fb4d8d7f5888a 100644 --- a/recipes/box2d/2.4.x/test_package/CMakeLists.txt +++ b/recipes/box2d/2.4.x/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(box2d REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/box2d/2.4.x/test_package/conanfile.py b/recipes/box2d/2.4.x/test_package/conanfile.py index 7513484720425..d1ce1a2cbc477 100644 --- a/recipes/box2d/2.4.x/test_package/conanfile.py +++ b/recipes/box2d/2.4.x/test_package/conanfile.py @@ -1,10 +1,19 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout class Box2DTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - 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.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/box2d/2.4.x/test_v1_package/CMakeLists.txt b/recipes/box2d/2.4.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..373fb5bb61846 --- /dev/null +++ b/recipes/box2d/2.4.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) + +find_package(box2d REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} box2d::box2d) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/box2d/2.4.x/test_v1_package/conanfile.py b/recipes/box2d/2.4.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7513484720425 --- /dev/null +++ b/recipes/box2d/2.4.x/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class Box2DTestConan(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.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/box2d/2.4.x/test_v1_package/test_package.cpp b/recipes/box2d/2.4.x/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..7dfa813bc1d2e --- /dev/null +++ b/recipes/box2d/2.4.x/test_v1_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include "box2d/box2d.h" + +int main(void) { + b2Vec2 gravity(0.0f, -10.0f); + b2World world(gravity); + + b2BodyDef groundBodyDef; + groundBodyDef.position.Set(0.0f, -10.0f); + + b2Body* groundBody = world.CreateBody(&groundBodyDef); + b2PolygonShape groundBox; + groundBox.SetAsBox(50.0f, 10.0f); + + return 0; +} diff --git a/recipes/brynet/all/conanfile.py b/recipes/brynet/all/conanfile.py index 33bea6b1fd799..f19ddf2cfae85 100644 --- a/recipes/brynet/all/conanfile.py +++ b/recipes/brynet/all/conanfile.py @@ -1,18 +1,21 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class BrynetConan(ConanFile): name = "brynet" description = "Header Only Cross platform high performance TCP network library using C++ 11." license = "MIT" - topics = ("conan", "brynet", "networking", "tcp", "websocket") + topics = ("networking", "tcp", "websocket") homepage = "https://github.com/IronsDu/brynet" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler" + settings = "os", "arch", "compiler", "build_type" options = { "with_openssl": [True, False], } @@ -22,30 +25,34 @@ class BrynetConan(ConanFile): no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1q", transitive_headers=True, transitive_libs=True) + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.options.with_openssl: self.cpp_info.defines.append("BRYNET_USE_OPENSSL") if self.settings.os == "Windows": diff --git a/recipes/brynet/all/test_package/CMakeLists.txt b/recipes/brynet/all/test_package/CMakeLists.txt index 33ae887aa6aea..d7b3556ccaf55 100644 --- a/recipes/brynet/all/test_package/CMakeLists.txt +++ b/recipes/brynet/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(brynet REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE brynet::brynet) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/brynet/all/test_package/conanfile.py b/recipes/brynet/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/brynet/all/test_package/conanfile.py +++ b/recipes/brynet/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/brynet/all/test_v1_package/CMakeLists.txt b/recipes/brynet/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d6bc29a53890 --- /dev/null +++ b/recipes/brynet/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(brynet REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE brynet::brynet) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/brynet/all/test_v1_package/conanfile.py b/recipes/brynet/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/brynet/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bzip3/all/CMakeLists.txt b/recipes/bzip3/all/CMakeLists.txt index 783a1988b3c10..62b301abbb58e 100644 --- a/recipes/bzip3/all/CMakeLists.txt +++ b/recipes/bzip3/all/CMakeLists.txt @@ -9,6 +9,12 @@ set(BZIP3_INC ) add_library(bzip3) + +if (VERSION VERSION_GREATER_EQUAL "1.1.5") +target_sources(bzip3 PRIVATE + ${BZIP3_SRC_DIR}/src/libbz3.c +) +else() target_sources(bzip3 PRIVATE ${BZIP3_SRC_DIR}/src/cm.c ${BZIP3_SRC_DIR}/src/crc32.c @@ -17,12 +23,17 @@ target_sources(bzip3 PRIVATE ${BZIP3_SRC_DIR}/src/lzp.c ${BZIP3_SRC_DIR}/src/rle.c ) +endif() target_include_directories(bzip3 PUBLIC ${BZIP3_SRC_DIR}/include) set_target_properties(bzip3 PROPERTIES PUBLIC_HEADER "${BZIP3_INC}" C_VISIBILITY_PRESET hidden C_EXTENSIONS OFF ) +if (VERSION VERSION_GREATER_EQUAL "1.1.6" AND (MSVC OR MSVC90 OR MSVC10) AND BUILD_SHARED_LIBS) + target_compile_definitions(bzip3 PRIVATE "BZIP3_DLL_EXPORT=1") +endif() + if (BZIP3_WITH_THREAD) find_package(Threads REQUIRED) target_link_libraries(bzip3 PRIVATE Threads::Threads) diff --git a/recipes/bzip3/all/conandata.yml b/recipes/bzip3/all/conandata.yml index a3a9020f9818f..87478fcf26ffd 100644 --- a/recipes/bzip3/all/conandata.yml +++ b/recipes/bzip3/all/conandata.yml @@ -1,8 +1,16 @@ sources: + "1.1.6": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.6/bzip3-1.1.6.tar.bz2" + sha256: "2bfd35dd57ab80b35b25e3ad628e0ff8f1f5e6dea02a8d472914823ea2e07e96" + "1.1.5": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.5/bzip3-1.1.5.tar.bz2" + sha256: "2f5012b0004b6c23d5f606deed9191fdce44849234edbcf26e0316bf7856d114" "1.1.4": url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.4/bzip3-1.1.4.tar.bz2" sha256: "e23a06ae17fc36192e79d0151950b3bbd4e26381af50ba4b4fd7a2d9797e498f" patches: + "1.1.5": + - patch_file: "patches/1.1.5-0002-export-symbols.patch" "1.1.4": - - patch_file: "patches/0001-make-restrict-alias.patch" - - patch_file: "patches/0002-export-symbols.patch" + - patch_file: "patches/1.1.4-0001-make-restrict-alias.patch" + - patch_file: "patches/1.1.4-0002-export-symbols.patch" diff --git a/recipes/bzip3/all/conanfile.py b/recipes/bzip3/all/conanfile.py index 196224b72dc65..2d6313f87447b 100644 --- a/recipes/bzip3/all/conanfile.py +++ b/recipes/bzip3/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class BZip3Conan(ConanFile): @@ -29,8 +29,7 @@ class BZip3Conan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,7 +42,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: del self.settings.compiler.libcxx except Exception: diff --git a/recipes/bzip3/all/patches/0001-make-restrict-alias.patch b/recipes/bzip3/all/patches/1.1.4-0001-make-restrict-alias.patch similarity index 100% rename from recipes/bzip3/all/patches/0001-make-restrict-alias.patch rename to recipes/bzip3/all/patches/1.1.4-0001-make-restrict-alias.patch diff --git a/recipes/bzip3/all/patches/0002-export-symbols.patch b/recipes/bzip3/all/patches/1.1.4-0002-export-symbols.patch similarity index 100% rename from recipes/bzip3/all/patches/0002-export-symbols.patch rename to recipes/bzip3/all/patches/1.1.4-0002-export-symbols.patch diff --git a/recipes/bzip3/all/patches/1.1.5-0002-export-symbols.patch b/recipes/bzip3/all/patches/1.1.5-0002-export-symbols.patch new file mode 100644 index 0000000000000..e76dc6e0d184e --- /dev/null +++ b/recipes/bzip3/all/patches/1.1.5-0002-export-symbols.patch @@ -0,0 +1,83 @@ +diff --git a/include/libbz3.h b/include/libbz3.h +index a5ac58a..a9b13fd 100644 +--- a/include/libbz3.h ++++ b/include/libbz3.h +@@ -22,6 +22,16 @@ + + #include + ++#ifdef bzip3_EXPORTS ++#ifdef _WIN32 ++ #define BZIP3_API __declspec(dllexport) ++#else ++ #define BZIP3_API __attribute__((visibility("default"))) ++#endif ++#else ++ #define BZIP3_API ++#endif ++ + #define BZ3_OK 0 + #define BZ3_ERR_OUT_OF_BOUNDS -1 + #define BZ3_ERR_BWT -2 +@@ -35,31 +45,31 @@ struct bz3_state; + /** + * @brief Get the last error number associated with a given state. + */ +-int8_t bz3_last_error(struct bz3_state * state); ++BZIP3_API int8_t bz3_last_error(struct bz3_state * state); + + /** + * @brief Return a user-readable message explaining the cause of the last error. + */ +-const char * bz3_strerror(struct bz3_state * state); ++BZIP3_API const char * bz3_strerror(struct bz3_state * state); + + /** + * @brief Construct a new block encoder state, which will encode blocks as big as the given block size. + * The decoder will be able to decode blocks at most as big as the given block size. + * Returns NULL in case allocation fails or the block size is not between 65K and 511M + */ +-struct bz3_state * bz3_new(int32_t block_size); ++BZIP3_API struct bz3_state * bz3_new(int32_t block_size); + + /** + * @brief Free the memory occupied by a block encoder state. + */ +-void bz3_free(struct bz3_state * state); ++BZIP3_API void bz3_free(struct bz3_state * state); + + /** + * @brief Encode a single block. Returns the amount of bytes written to `buffer'. + * `buffer' must be able to hold at least `size + size / 50 + 32' bytes. The size must not + * exceed the block size associated with the state. + */ +-int32_t bz3_encode_block(struct bz3_state * state, uint8_t * buffer, int32_t size); ++BZIP3_API int32_t bz3_encode_block(struct bz3_state * state, uint8_t * buffer, int32_t size); + + /** + * @brief Decode a single block. +@@ -68,7 +78,7 @@ int32_t bz3_encode_block(struct bz3_state * state, uint8_t * buffer, int32_t siz + * @param size The size of the compressed data in `buffer' + * @param orig_size The original size of the data before compression. + */ +-int32_t bz3_decode_block(struct bz3_state * state, uint8_t * buffer, int32_t size, int32_t orig_size); ++BZIP3_API int32_t bz3_decode_block(struct bz3_state * state, uint8_t * buffer, int32_t size, int32_t orig_size); + + /** + * @brief Encode `n' blocks, all in parallel. +@@ -80,13 +90,13 @@ int32_t bz3_decode_block(struct bz3_state * state, uint8_t * buffer, int32_t siz + * + * Present in the shared library only if -lpthread was present during building. + */ +-void bz3_encode_blocks(struct bz3_state * states[], uint8_t * buffers[], int32_t sizes[], int32_t n); ++BZIP3_API void bz3_encode_blocks(struct bz3_state * states[], uint8_t * buffers[], int32_t sizes[], int32_t n); + + /** + * @brief Decode `n' blocks, all in parallel. + * Same specifics as `bz3_encode_blocks', but doesn't overwrite `sizes'. + */ +-void bz3_decode_blocks(struct bz3_state * states[], uint8_t * buffers[], int32_t sizes[], int32_t orig_sizes[], ++BZIP3_API void bz3_decode_blocks(struct bz3_state * states[], uint8_t * buffers[], int32_t sizes[], int32_t orig_sizes[], + int32_t n); + + #endif diff --git a/recipes/bzip3/config.yml b/recipes/bzip3/config.yml index f7bc2bb892fbd..fa8612a6d0ffa 100644 --- a/recipes/bzip3/config.yml +++ b/recipes/bzip3/config.yml @@ -1,3 +1,7 @@ versions: + "1.1.6": + folder: all + "1.1.5": + folder: all "1.1.4": folder: all diff --git a/recipes/c-blosc/all/CMakeLists.txt b/recipes/c-blosc/all/CMakeLists.txt deleted file mode 100644 index 541886c829c5a..0000000000000 --- a/recipes/c-blosc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/c-blosc/all/conandata.yml b/recipes/c-blosc/all/conandata.yml index ce6bd3efcd60b..dfd824d8023f0 100644 --- a/recipes/c-blosc/all/conandata.yml +++ b/recipes/c-blosc/all/conandata.yml @@ -23,22 +23,15 @@ sources: patches: "1.21.1": - patch_file: "patches/cmake-dependencies-1.21.1+.patch" - base_path: "source_subfolder" "1.21.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" - base_path: "source_subfolder" "1.20.1": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" - base_path: "source_subfolder" "1.20.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" - base_path: "source_subfolder" "1.19.0": - patch_file: "patches/cmake-dependencies-1.19.0.patch" - base_path: "source_subfolder" "1.18.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" - base_path: "source_subfolder" "1.17.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" - base_path: "source_subfolder" diff --git a/recipes/c-blosc/all/conanfile.py b/recipes/c-blosc/all/conanfile.py index 6d4729341decd..88c3ac390c7a0 100644 --- a/recipes/c-blosc/all/conanfile.py +++ b/recipes/c-blosc/all/conanfile.py @@ -1,9 +1,11 @@ -from conan import ConanFile, tools -from conan.tools.files import apply_conandata_patches -from conans import CMake +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class CbloscConan(ConanFile): @@ -34,25 +36,8 @@ class CbloscConan(ConanFile): "with_zstd": 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 _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": @@ -62,13 +47,25 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_snappy: self.requires("snappy/1.1.9") if self.options.with_zlib: @@ -77,58 +74,60 @@ def requirements(self): self.requires("zstd/1.5.2") def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BLOSC_INSTALL"] = True + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_TESTS"] = False + if Version(self.version) >= "1.20.0": + tc.variables["BUILD_FUZZERS"] = False + tc.variables["BUILD_BENCHMARKS"] = False + simd_intrinsics = self.options.get_safe("simd_intrinsics", False) + tc.variables["DEACTIVATE_SSE2"] = simd_intrinsics not in ["sse2", "avx2"] + tc.variables["DEACTIVATE_AVX2"] = simd_intrinsics != "avx2" + tc.variables["DEACTIVATE_LZ4"] = not self.options.with_lz4 + tc.variables["DEACTIVATE_SNAPPY"] = not self.options.with_snappy + tc.variables["DEACTIVATE_ZLIB"] = not self.options.with_zlib + tc.variables["DEACTIVATE_ZSTD"] = not self.options.with_zstd + tc.variables["DEACTIVATE_SYMBOLS_CHECK"] = True + tc.variables["PREFER_EXTERNAL_LZ4"] = True + if Version(self.version) < "1.19.0": + tc.variables["PREFER_EXTERNAL_SNAPPY"] = True + tc.variables["PREFER_EXTERNAL_ZLIB"] = True + tc.variables["PREFER_EXTERNAL_ZSTD"] = True + tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + # Generate a relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() - def build(self): - apply_conandata_patches(self) - tools.files.rmdir(self, os.path.join(self._source_subfolder, "cmake")) - cmake = self._configure_cmake() - cmake.build() + deps = CMakeDeps(self) + deps.generate() + def _patch_sources(self): + apply_conandata_patches(self) + rmdir(self, os.path.join(self.source_folder, "cmake")) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BLOSC_INSTALL"] = True - self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["BUILD_SHARED"] = self.options.shared - self._cmake.definitions["BUILD_TESTS"] = False - if tools.scm.Version(self.version) >= "1.20.0": - self._cmake.definitions["BUILD_FUZZERS"] = False - self._cmake.definitions["BUILD_BENCHMARKS"] = False - simd_intrinsics = self.options.get_safe("simd_intrinsics", False) - self._cmake.definitions["DEACTIVATE_SSE2"] = simd_intrinsics not in ["sse2", "avx2"] - self._cmake.definitions["DEACTIVATE_AVX2"] = simd_intrinsics != "avx2" - self._cmake.definitions["DEACTIVATE_LZ4"] = not self.options.with_lz4 - self._cmake.definitions["DEACTIVATE_SNAPPY"] = not self.options.with_snappy - self._cmake.definitions["DEACTIVATE_ZLIB"] = not self.options.with_zlib - self._cmake.definitions["DEACTIVATE_ZSTD"] = not self.options.with_zstd - self._cmake.definitions["DEACTIVATE_SYMBOLS_CHECK"] = True - self._cmake.definitions["PREFER_EXTERNAL_LZ4"] = True - if tools.scm.Version(self.version) < "1.19.0": - self._cmake.definitions["PREFER_EXTERNAL_SNAPPY"] = True - self._cmake.definitions["PREFER_EXTERNAL_ZLIB"] = True - self._cmake.definitions["PREFER_EXTERNAL_ZSTD"] = True - # Generate a relocatable shared lib on Macos - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): licenses = ["BLOSC.txt", "BITSHUFFLE.txt", "FASTLZ.txt"] for license_file in licenses: - self.copy(license_file, dst="licenses", src=os.path.join(self._source_subfolder, "LICENSES")) - cmake = self._configure_cmake() + copy(self, license_file, src=os.path.join(self.source_folder, "LICENSES"), dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "blosc") - prefix = "lib" if self._is_msvc and not self.options.shared else "" - self.cpp_info.libs = ["{}blosc".format(prefix)] + 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") - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "blosc" diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.18.1-.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.18.1-.patch index 04f2ab0166de3..d4a2354fd9ed0 100644 --- a/recipes/c-blosc/all/patches/cmake-dependencies-1.18.1-.patch +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.18.1-.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -122,12 +122,11 @@ option(PREFER_EXTERNAL_ZLIB +@@ -122,12 +122,12 @@ option(PREFER_EXTERNAL_ZLIB option(PREFER_EXTERNAL_ZSTD "Find and use external Zstd library instead of included sources." OFF) @@ -10,6 +10,7 @@ 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.") @@ -27,7 +28,7 @@ if (NOT DEACTIVATE_ZSTD) if (PREFER_EXTERNAL_ZSTD) - find_package(Zstd) -+ find_package(zstd) ++ find_package(zstd REQUIRED CONFIG) else () message(STATUS "Using ZSTD internal sources.") endif (PREFER_EXTERNAL_ZSTD) @@ -38,7 +39,7 @@ if(NOT DEACTIVATE_LZ4) if(LZ4_FOUND) - set(LIBS ${LIBS} ${LZ4_LIBRARY}) -+ set(LIBS ${LIBS} "CONAN_PKG::lz4") ++ 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}) @@ -65,7 +66,7 @@ if (NOT DEACTIVATE_ZSTD) if (ZSTD_FOUND) - set(LIBS ${LIBS} ${ZSTD_LIBRARY}) -+ set(LIBS ${LIBS} "zstd::zstd") ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) else (ZSTD_FOUND) file(GLOB ZSTD_FILES ${ZSTD_LOCAL_DIR}/common/*.c diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.19.0.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.19.0.patch index 5ef7800ef0bef..3f5a9b46096f3 100644 --- a/recipes/c-blosc/all/patches/cmake-dependencies-1.19.0.patch +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.19.0.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -117,12 +117,11 @@ option(PREFER_EXTERNAL_ZLIB +@@ -117,12 +117,12 @@ option(PREFER_EXTERNAL_ZLIB option(PREFER_EXTERNAL_ZSTD "Find and use external Zstd library instead of included sources." OFF) @@ -10,6 +10,7 @@ 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.") @@ -27,7 +28,7 @@ if (NOT DEACTIVATE_ZSTD) if (PREFER_EXTERNAL_ZSTD) - find_package(Zstd) -+ find_package(zstd) ++ find_package(zstd REQUIRED CONFIG) else () message(STATUS "Using ZSTD internal sources.") endif (PREFER_EXTERNAL_ZSTD) @@ -38,7 +39,7 @@ if(NOT DEACTIVATE_LZ4) if(LZ4_FOUND) - set(LIBS ${LIBS} ${LZ4_LIBRARY}) -+ set(LIBS ${LIBS} "CONAN_PKG::lz4") ++ 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}) @@ -65,7 +66,7 @@ if (NOT DEACTIVATE_ZSTD) if (ZSTD_FOUND) - set(LIBS ${LIBS} ${ZSTD_LIBRARY}) -+ set(LIBS ${LIBS} "zstd::zstd") ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) else (ZSTD_FOUND) file(GLOB ZSTD_FILES ${ZSTD_LOCAL_DIR}/common/*.c diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.20.0+.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.20.0+.patch index c943456b7a005..428ddd7762cfb 100644 --- a/recipes/c-blosc/all/patches/cmake-dependencies-1.20.0+.patch +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.20.0+.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -121,12 +121,11 @@ option(PREFER_EXTERNAL_ZLIB +@@ -121,12 +121,12 @@ option(PREFER_EXTERNAL_ZLIB option(PREFER_EXTERNAL_ZSTD "Find and use external Zstd library instead of included sources." OFF) @@ -10,6 +10,7 @@ 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.") @@ -27,7 +28,7 @@ if (NOT DEACTIVATE_ZSTD) if (PREFER_EXTERNAL_ZSTD) - find_package(Zstd) -+ find_package(zstd) ++ find_package(zstd REQUIRED CONFIG) else () message(STATUS "Using ZSTD internal sources.") endif (PREFER_EXTERNAL_ZSTD) @@ -38,7 +39,7 @@ if(NOT DEACTIVATE_LZ4) if(LZ4_FOUND) - set(LIBS ${LIBS} ${LZ4_LIBRARY}) -+ set(LIBS ${LIBS} "CONAN_PKG::lz4") ++ 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}) @@ -65,7 +66,7 @@ if (NOT DEACTIVATE_ZSTD) if (ZSTD_FOUND) - set(LIBS ${LIBS} ${ZSTD_LIBRARY}) -+ set(LIBS ${LIBS} "zstd::zstd") ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) else (ZSTD_FOUND) file(GLOB ZSTD_FILES ${ZSTD_LOCAL_DIR}/common/*.c diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.21.1+.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.1+.patch index 704fd3e436b1d..fb62441ddd89b 100644 --- a/recipes/c-blosc/all/patches/cmake-dependencies-1.21.1+.patch +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.1+.patch @@ -1,5 +1,3 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f5eff9e..92b35f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,12 +121,12 @@ option(PREFER_EXTERNAL_ZLIB @@ -12,7 +10,7 @@ index f5eff9e..92b35f2 100644 if(NOT DEACTIVATE_LZ4) if(PREFER_EXTERNAL_LZ4) - find_package(LZ4) -+ ### find_package(LZ4) ++ find_package(lz4 REQUIRED CONFIG) + set(LZ4_FOUND TRUE) else() message(STATUS "Using LZ4 internal sources.") @@ -30,12 +28,10 @@ index f5eff9e..92b35f2 100644 if (NOT DEACTIVATE_ZSTD) if (PREFER_EXTERNAL_ZSTD) - find_package(Zstd) -+ find_package(zstd) ++ find_package(zstd REQUIRED CONFIG) else () message(STATUS "Using ZSTD internal sources.") endif (PREFER_EXTERNAL_ZSTD) -diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt -index 84b72e5..20b94e0 100644 --- a/blosc/CMakeLists.txt +++ b/blosc/CMakeLists.txt @@ -91,7 +91,7 @@ endif(WIN32) @@ -43,7 +39,7 @@ index 84b72e5..20b94e0 100644 if(NOT DEACTIVATE_LZ4) if(LZ4_FOUND) - set(LIBS ${LIBS} ${LZ4_LIBRARY}) -+ set(LIBS ${LIBS} "CONAN_PKG::lz4") ++ 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}) @@ -70,7 +66,7 @@ index 84b72e5..20b94e0 100644 if (NOT DEACTIVATE_ZSTD) if (ZSTD_FOUND) - set(LIBS ${LIBS} ${ZSTD_LIBRARY}) -+ set(LIBS ${LIBS} "zstd::zstd") ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) else (ZSTD_FOUND) file(GLOB ZSTD_FILES ${ZSTD_LOCAL_DIR}/common/*.c diff --git a/recipes/c-blosc/all/test_package/CMakeLists.txt b/recipes/c-blosc/all/test_package/CMakeLists.txt index e54e578850692..e73da46b32d37 100644 --- a/recipes/c-blosc/all/test_package/CMakeLists.txt +++ b/recipes/c-blosc/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(c-blosc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} c-blosc::c-blosc) +target_link_libraries(${PROJECT_NAME} PRIVATE c-blosc::c-blosc) diff --git a/recipes/c-blosc/all/test_package/conanfile.py b/recipes/c-blosc/all/test_package/conanfile.py index 72910d4a2a0b5..0a6bc68712d90 100644 --- a/recipes/c-blosc/all/test_package/conanfile.py +++ b/recipes/c-blosc/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conan import ConanFile, tools -from conans import CMake +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) @@ -13,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/c-blosc/all/test_v1_package/CMakeLists.txt b/recipes/c-blosc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..178f209fe3a3a --- /dev/null +++ b/recipes/c-blosc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(c-blosc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE c-blosc::c-blosc) diff --git a/recipes/c-blosc/all/test_v1_package/conanfile.py b/recipes/c-blosc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..72910d4a2a0b5 --- /dev/null +++ b/recipes/c-blosc/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conan import ConanFile, tools +from conans import CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.build.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/c-blosc2/all/CMakeLists.txt b/recipes/c-blosc2/all/CMakeLists.txt deleted file mode 100644 index dd348757f3de8..0000000000000 --- a/recipes/c-blosc2/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/c-blosc2/all/conandata.yml b/recipes/c-blosc2/all/conandata.yml index 81c0e81ea55e8..1d8b50594a371 100644 --- a/recipes/c-blosc2/all/conandata.yml +++ b/recipes/c-blosc2/all/conandata.yml @@ -1,9 +1,18 @@ sources: + "2.4.2": + url: "https://github.com/Blosc/c-blosc2/archive/v2.4.2.tar.gz" + sha256: "763ded7a6286abd248a79b1560ce8bfda11018b699a450b3e43c529f284a5232" + "2.4.1": + url: "https://github.com/Blosc/c-blosc2/archive/refs/tags/v2.4.1.tar.gz" + sha256: "f09a43bfac563ceda611a213c799ca5359c3b629281e0a4f3a543e692a64a931" "2.2.0": url: "https://github.com/Blosc/c-blosc2/archive/refs/tags/v2.2.0.tar.gz" sha256: "66f9977de26d6bc9ea1c0e623d873c3225e4fff709aa09b3335fd09d41d57c0e" patches: + "2.4.2": + - patch_file: "patches/2.4.1-0001-fix-cmake.patch" + "2.4.1": + - patch_file: "patches/2.4.1-0001-fix-cmake.patch" "2.2.0": - patch_file: "patches/2.2.0-0001-fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/c-blosc2/all/conanfile.py b/recipes/c-blosc2/all/conanfile.py index 598a57dd49f99..3b7bb98ece38b 100644 --- a/recipes/c-blosc2/all/conanfile.py +++ b/recipes/c-blosc2/all/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, CMake, tools -from conan.tools.microsoft import is_msvc +from conan import ConanFile +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, get, copy, rm, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os -import functools import glob -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.51.3" class CBlosc2Conan(ConanFile): name = "c-blosc2" @@ -19,7 +21,7 @@ class CBlosc2Conan(ConanFile): "fPIC": [True, False], "simd_intrinsics": [None, "sse2", "avx2"], "with_lz4": [True, False], - "with_zlib": [None, "zlib", "zlib-ng"], + "with_zlib": [None, "zlib", "zlib-ng", "zlib-ng-compat"], "with_zstd": [True, False], "with_plugins": [True, False], } @@ -32,20 +34,10 @@ class CBlosc2Conan(ConanFile): "with_zstd": True, "with_plugins": True, } - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -55,17 +47,32 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + # c-blosc2 uses zlib-ng with zlib compat options. - if self.options.with_zlib == "zlib-ng": + if self.options.with_zlib == "zlib-ng-compat": self.options["zlib-ng"].zlib_compat = True + elif self.options.with_zlib == "zlib-ng": + self.options["zlib-ng"].zlib_compat = False + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_lz4: self.requires("lz4/1.9.3") - if self.options.with_zlib == "zlib-ng": + if self.options.with_zlib in ["zlib-ng", "zlib-ng-compat"]: self.requires("zlib-ng/2.0.6") elif self.options.with_zlib == "zlib": self.requires("zlib/1.2.12") @@ -73,60 +80,66 @@ def requirements(self): self.requires("zstd/1.5.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BLOSC_IS_SUBPROJECT"] = False - cmake.definitions["BLOSC_INSTALL"] = True - cmake.definitions["BUILD_STATIC"] = not self.options.shared - cmake.definitions["BUILD_SHARED"] = self.options.shared - cmake.definitions["BUILD_TESTS"] = False - cmake.definitions["BUILD_FUZZERS"] = False - cmake.definitions["BUILD_BENCHMARKS"] = False - cmake.definitions["BUILD_EXAMPLES"] = False + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BLOSC_IS_SUBPROJECT"] = False + tc.cache_variables["BLOSC_INSTALL"] = True + tc.cache_variables["BUILD_STATIC"] = not bool(self.options.shared) + tc.cache_variables["BUILD_SHARED"] = bool(self.options.shared) + tc.cache_variables["BUILD_TESTS"] = False + tc.cache_variables["BUILD_FUZZERS"] = False + tc.cache_variables["BUILD_BENCHMARKS"] = False + tc.cache_variables["BUILD_EXAMPLES"] = False simd_intrinsics = self.options.get_safe("simd_intrinsics", False) - cmake.definitions["DEACTIVATE_AVX2"] = simd_intrinsics != "avx2" - cmake.definitions["DEACTIVATE_LZ4"] = not self.options.with_lz4 - cmake.definitions["PREFER_EXTERNAL_LZ4"] = self.options.with_lz4 - cmake.definitions["DEACTIVATE_ZLIB"] = self.options.with_zlib == None - cmake.definitions["PREFER_EXTERNAL_ZLIB"] = self.options.with_zlib != None - cmake.definitions["DEACTIVATE_ZSTD"] = not self.options.with_zstd - cmake.definitions["PREFER_EXTERNAL_ZSTD"] = self.options.with_zstd - cmake.definitions["BUILD_PLUGINS"] = self.options.with_plugins - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["DEACTIVATE_AVX2"] = simd_intrinsics != "avx2" + tc.cache_variables["DEACTIVATE_LZ4"] = not bool(self.options.with_lz4) + tc.cache_variables["PREFER_EXTERNAL_LZ4"] = True + tc.cache_variables["DEACTIVATE_ZLIB"] = self.options.with_zlib is None + tc.cache_variables["PREFER_EXTERNAL_ZLIB"] = True + tc.cache_variables["DEACTIVATE_ZSTD"] = not bool(self.options.with_zstd) + tc.cache_variables["PREFER_EXTERNAL_ZSTD"] = True + tc.cache_variables["BUILD_PLUGINS"] = bool(self.options.with_plugins) + if self.options.with_zlib == "zlib-ng-compat": + tc.preprocessor_definitions["ZLIB_COMPAT"] = "1" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - for filename in glob.glob(os.path.join(self._source_subfolder, "cmake", "Find*.cmake")): + for filename in glob.glob(os.path.join(self.source_folder, "cmake", "Find*.cmake")): if os.path.basename(filename) not in [ "FindSIMD.cmake", ]: - os.remove(filename) + rm(self, os.path.basename(filename), os.path.join(self.source_folder, "cmake")) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): licenses = ["BLOSC.txt", "BITSHUFFLE.txt", "FASTLZ.txt", "LZ4.txt", "ZLIB.txt", "STDINT.txt"] for license_file in licenses: - self.copy(license_file, dst="licenses", src=os.path.join(self._source_subfolder, "LICENSES")) - cmake = self._configure_cmake() + copy(self, pattern=license_file, dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "LICENSES")) + + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # Remove MS runtime files for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), dll_pattern_to_remove) + rm(self, pattern=dll_pattern_to_remove, folder=os.path.join(self.package_folder, "bin"), recursive=True) def package_info(self): self.cpp_info.set_property("pkg_config_name", "blosc2") + prefix = "lib" if is_msvc(self) and not self.options.shared else "" self.cpp_info.libs = ["{}blosc2".format(prefix)] if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch b/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch index ea02b0e3d45f3..cef3c154b1ab2 100644 --- a/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch +++ b/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index bd8cb34..5d8981f 100644 +index bd8cb34..9c4cfe0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,8 @@ if(NOT WIN32) @@ -12,7 +12,7 @@ index bd8cb34..5d8981f 100644 if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.4) cmake_policy(SET CMP0063 NEW) endif() -@@ -144,26 +145,17 @@ if(BUILD_LITE) +@@ -144,26 +145,26 @@ if(BUILD_LITE) endif() if(PREFER_EXTERNAL_LZ4) @@ -26,15 +26,17 @@ index bd8cb34..5d8981f 100644 if(PREFER_EXTERNAL_ZLIB) - find_package(ZLIB_NG) - if (ZLIB_NG_FOUND) -- set(HAVE_ZLIB_NG TRUE) -- else() -- find_package(ZLIB) -- endif() -- ++ find_package(zlib-ng) ++ if (zlib-ng_FOUND) + set(HAVE_ZLIB_NG TRUE) + else() + find_package(ZLIB) + endif() + - if(NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) -- message(STATUS "No ZLIB found. Using ZLIB-NG internal sources.") -- endif() -+ find_package(ZLIB REQUIRED) ++ if(NOT (zlib-ng_FOUND OR ZLIB_FOUND)) + message(STATUS "No ZLIB found. Using ZLIB-NG internal sources.") + endif() endif() - if (NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) @@ -42,7 +44,7 @@ index bd8cb34..5d8981f 100644 message(STATUS "Using ZLIB-NG internal sources for ZLIB support.") set(HAVE_ZLIB_NG TRUE) add_definitions(-DZLIB_COMPAT) -@@ -184,7 +176,7 @@ endif() +@@ -184,7 +185,7 @@ endif() if(NOT DEACTIVATE_ZSTD) if(PREFER_EXTERNAL_ZSTD) @@ -51,3 +53,75 @@ index bd8cb34..5d8981f 100644 if(NOT ZSTD_FOUND) message(STATUS "No ZSTD library found. Using internal sources.") endif() +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index 7f3eac6..c7afecd 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -10,16 +10,16 @@ set(CMAKE_C_VISIBILITY_PRESET hidden) + + # includes + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) +-if(LZ4_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_INCLUDE_DIR}) ++if(lz4_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${lz4_INCLUDE_DIR}) + else() + set(LZ4_LOCAL_DIR ${INTERNAL_LIBS}/lz4-1.9.3) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_LOCAL_DIR}) + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_NG_INCLUDE_DIR}) ++ if(zlib-ng_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zlib-ng_INCLUDE_DIR}) + elseif(ZLIB_FOUND) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) + else() +@@ -29,8 +29,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIR}) ++ if(zstd_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zstd_INCLUDE_DIR}) + else() + set(ZSTD_LOCAL_DIR ${INTERNAL_LIBS}/zstd-1.5.2) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_LOCAL_DIR} +@@ -90,8 +90,8 @@ else() + endif() + endif() + +-if(LZ4_FOUND) +- set(LIBS ${LIBS} ${LZ4_LIBRARY}) ++if(lz4_FOUND) ++ set(LIBS ${LIBS} ${lz4_LIBRARIES}) + else() + file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${LZ4_FILES}) +@@ -99,10 +99,10 @@ else() + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(LIBS ${LIBS} ${ZLIB_NG_LIBRARY}) ++ if(zlib-ng_FOUND) ++ set(LIBS ${LIBS} ${zlib-ng_LIBRARIES}) + elseif(ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARY}) ++ set(LIBS ${LIBS} ${ZLIB_LIBRARIES}) + else() + set(ZLIB_LOCAL_DIR ${INTERNAL_LIBS}/${ZLIB_NG_DIR}) + file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c) +@@ -112,8 +112,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) ++ if(zstd_FOUND) ++ set(LIBS ${LIBS} ${zstd_LIBRARIES}) + else() + # 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-blosc2/all/patches/2.4.1-0001-fix-cmake.patch b/recipes/c-blosc2/all/patches/2.4.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..c7220f5674f37 --- /dev/null +++ b/recipes/c-blosc2/all/patches/2.4.1-0001-fix-cmake.patch @@ -0,0 +1,129 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 866c7f6..d68513a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -68,7 +68,8 @@ if(NOT WIN32) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") + endif() + +-cmake_minimum_required(VERSION 3.16.3) ++## TODO: dirty fix. ++cmake_minimum_required(VERSION 3.15) + if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.4) + cmake_policy(SET CMP0063 NEW) + endif() +@@ -144,26 +145,26 @@ if(BUILD_LITE) + endif() + + if(PREFER_EXTERNAL_LZ4) +- find_package(LZ4) ++ find_package(lz4) + else() + message(STATUS "Using LZ4 internal sources.") + endif() + + if(NOT DEACTIVATE_ZLIB) + if(PREFER_EXTERNAL_ZLIB) +- find_package(ZLIB_NG) +- if (ZLIB_NG_FOUND) ++ find_package(zlib-ng) ++ if (zlib-ng_FOUND) + set(HAVE_ZLIB_NG TRUE) + else() + find_package(ZLIB) + endif() + +- if(NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) ++ if(NOT (zlib-ng_FOUND OR ZLIB_FOUND)) + message(STATUS "No ZLIB found. Using ZLIB-NG internal sources.") + endif() + endif() + +- if (NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) ++ if (0) + message(STATUS "Using ZLIB-NG internal sources for ZLIB support.") + set(HAVE_ZLIB_NG TRUE) + add_definitions(-DZLIB_COMPAT) +@@ -184,8 +185,8 @@ endif() + + if(NOT DEACTIVATE_ZSTD) + if(PREFER_EXTERNAL_ZSTD) +- find_package(ZSTD) +- if(NOT ZSTD_FOUND) ++ find_package(zstd) ++ if(NOT zstd_FOUND) + message(STATUS "No ZSTD library found. Using internal sources.") + endif() + else() +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index 441bab6..f17e467 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -10,16 +10,16 @@ set(CMAKE_C_VISIBILITY_PRESET hidden) + + # includes + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) +-if(LZ4_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_INCLUDE_DIR}) ++if(lz4_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${lz4_INCLUDE_DIR}) + else() + set(LZ4_LOCAL_DIR ${INTERNAL_LIBS}/lz4-1.9.4) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_LOCAL_DIR}) + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_NG_INCLUDE_DIR}) ++ if(zlib-ng_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zlib-ng_INCLUDE_DIR}) + elseif(ZLIB_FOUND) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) + else() +@@ -29,8 +29,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIR}) ++ if(zstd_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zstd_INCLUDE_DIR}) + else() + set(ZSTD_LOCAL_DIR ${INTERNAL_LIBS}/zstd-1.5.2) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_LOCAL_DIR} +@@ -90,8 +90,8 @@ else() + endif() + endif() + +-if(LZ4_FOUND) +- set(LIBS ${LIBS} ${LZ4_LIBRARY}) ++if(lz4_FOUND) ++ set(LIBS ${LIBS} ${lz4_LIBRARIES}) + else() + file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${LZ4_FILES}) +@@ -99,10 +99,10 @@ else() + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(LIBS ${LIBS} ${ZLIB_NG_LIBRARY}) ++ if(zlib-ng_FOUND) ++ set(LIBS ${LIBS} ${zlib-ng_LIBRARIES}) + elseif(ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARY}) ++ set(LIBS ${LIBS} ${ZLIB_LIBRARIES}) + else() + set(ZLIB_LOCAL_DIR ${INTERNAL_LIBS}/${ZLIB_NG_DIR}) + file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c) +@@ -112,8 +112,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) ++ if(zstd_FOUND) ++ set(LIBS ${LIBS} ${zstd_LIBRARIES}) + else() + # 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-blosc2/all/test_package/CMakeLists.txt b/recipes/c-blosc2/all/test_package/CMakeLists.txt index 2b52be6633ff8..50ba489df290c 100644 --- a/recipes/c-blosc2/all/test_package/CMakeLists.txt +++ b/recipes/c-blosc2/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package C) find_package(c-blosc2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} c-blosc2::c-blosc2) +target_link_libraries(${PROJECT_NAME} PRIVATE c-blosc2::c-blosc2) diff --git a/recipes/c-blosc2/all/test_package/conanfile.py b/recipes/c-blosc2/all/test_package/conanfile.py index 333435871c7d8..a9fb96656f203 100644 --- a/recipes/c-blosc2/all/test_package/conanfile.py +++ b/recipes/c-blosc2/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import ConanFile, CMake -from conan import 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) @@ -13,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/c-blosc2/all/test_package/test_package.c b/recipes/c-blosc2/all/test_package/test_package.c index 57eacc94c15a2..754d85bde8768 100644 --- a/recipes/c-blosc2/all/test_package/test_package.c +++ b/recipes/c-blosc2/all/test_package/test_package.c @@ -35,6 +35,7 @@ int main(){ data[i] = i; } +#if !defined(BLOSC2_VERSION_MAJOR) /* Register the filter with the library */ printf("Blosc version info: %s (%s)\n", BLOSC_VERSION_STRING, BLOSC_VERSION_DATE); @@ -66,6 +67,40 @@ int main(){ /* After using it, destroy the Blosc environment */ blosc_destroy(); +#else + /* Register the filter with the library */ + printf("Blosc version info: %s (%s)\n", + BLOSC2_VERSION_STRING, BLOSC2_VERSION_DATE); + + /* Initialize the Blosc compressor */ + blosc2_init(); + + /* Compress with clevel=5 and shuffle active */ + csize = blosc2_compress(5, 1, sizeof(float), data, isize, data_out, osize); + if (csize == 0) { + printf("Buffer is uncompressible. Giving up.\n"); + return 1; + } + else if (csize < 0) { + printf("Compression error. Error code: %d\n", csize); + return csize; + } + + printf("Compression: %d -> %d (%.1fx)\n", isize, csize, (1.*isize) / csize); + + /* Decompress */ + dsize = blosc2_decompress(data_out, osize, data_dest, dsize); + if (dsize < 0) { + printf("Decompression error. Error code: %d\n", dsize); + return dsize; + } + + printf("Decompression succesful!\n"); + + /* After using it, destroy the Blosc environment */ + blosc2_destroy(); +#endif + for(i=0;i